Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: undefined reference to 'jsimd_can_rgb_gray' #1

Open
hoozh opened this issue Oct 21, 2015 · 6 comments
Open

error: undefined reference to 'jsimd_can_rgb_gray' #1

hoozh opened this issue Oct 21, 2015 · 6 comments

Comments

@hoozh
Copy link

hoozh commented Oct 21, 2015

I'm not familiar with makefile, please help.

I meet errors when linking libjpeg-turbo to my own module.

.....
.....
[armeabi] Compile thumb  : jpeg-turbo <= jdatadst-tj.c
[armeabi] Compile thumb  : jpeg-turbo <= jdatasrc-tj.c
[armeabi] StaticLibrary  : libjpeg-turbo.a
[armeabi] SharedLibrary  : libimage_decode.so
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jccolor.c:603: error: undefined reference to 'jsimd_can_rgb_gray'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jccolor.c:658: error: undefined reference to 'jsimd_can_rgb_ycc'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jccolor.c:718: error: undefined reference to 'jsimd_rgb_gray_convert'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jccolor.c:718: error: undefined reference to 'jsimd_rgb_ycc_convert'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jcsample.c:502: error: undefined reference to 'jsimd_can_h2v1_downsample'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jcsample.c:520: error: undefined reference to 'jsimd_can_h2v2_downsample'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jcsample.c:537: error: undefined reference to 'jsimd_h2v1_downsample'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jcsample.c:537: error: undefined reference to 'jsimd_h2v2_downsample'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jdmerge.c:591: error: undefined reference to 'jsimd_can_h2v2_merged_upsample'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jdmerge.c:608: error: undefined reference to 'jsimd_can_h2v1_merged_upsample'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jdmerge.c:624: error: undefined reference to 'jsimd_h2v2_merged_upsample'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jdmerge.c:624: error: undefined reference to 'jsimd_h2v1_merged_upsample'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jdsample.c:458: error: undefined reference to 'jsimd_can_h2v1_fancy_upsample'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jdsample.c:463: error: undefined reference to 'jsimd_can_h2v1_upsample'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jdsample.c:472: error: undefined reference to 'jsimd_can_h2v2_fancy_upsample'
E:/Proj/RTMeasure/CameraEx/jni/vendor/libjpeg-turbo/libjpeg-turbo-1.4.1/jdsample.c:478: error: undefined reference to 'jsimd_can_h2v2_upsample'
.....
.....

here is my module's android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE            := image_decode
LOCAL_SRC_FILES         := imagedecode.c
LOCAL_STATIC_LIBRARIES  += libjpeg-turbo 
LOCAL_LDLIBS            := -llog
include $(BUILD_SHARED_LIBRARY)
@sorccu
Copy link
Member

sorccu commented Oct 21, 2015

You need NDK 10e or later.

@hoozh
Copy link
Author

hoozh commented Oct 21, 2015

Already upgrade to NDK 10e

I solved the problem, but i don't know if it is right

Modify file vendor/libjpeg-turbo/Android.mk

change line 87

else ifeq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_CFLAGS += \
    -DSIZEOF_SIZE_T=4 \

to

else ifeq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_SRC_FILES += \
    $(SOURCE_PATH)/simd/jsimd_arm.c \
    $(SOURCE_PATH)/simd/jsimd_arm_neon.S \

LOCAL_CFLAGS += \
    -DSIZEOF_SIZE_T=4 \

@sorccu
Copy link
Member

sorccu commented Oct 21, 2015

Hmm, well, actually I think our README is a bit wrong... armeabi (older than v7) doesn't necessarily support NEON, so we might actually have to remove armeabi from the supported ABIs. Your patch works (well, it compiles), but it's not guaranteed to work on actual devices.

@alexcohn
Copy link

In principle, there are ARM processors with NEON, and this can be sniffed at runtime. But this is probably not worth the effort. As of 12/26/2015, the official statistics page shows less than 3.5% of all Android devices running versions below Ice Cream Sandwich, which are potentially capable to run on ARM v6.

@sorccu
Copy link
Member

sorccu commented Dec 27, 2015

Yes, libjpeg-turbo can actually do the runtime check. However since it's impossible for me to even try it out without having access to a plain armeabi device (preferably one without neon and one with neon, so two in total), and have never even seen one in person, I never bothered. If someone wants to sponsor a new device or donate their old used device for the cause, I could probably take a look.

@perracodex
Copy link

to solve the problem you need to add the jsimd_none.c in the armeabi section.

In Android.mk, change this:

else ifeq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_CFLAGS += \
    -DSIZEOF_SIZE_T=4 \

to this:

else ifeq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_SRC_FILES += $(SOURCE_PATH)/jsimd_none.c

LOCAL_CFLAGS += \
    -DSIZEOF_SIZE_T=4 \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants