Open hasanAjsf opened 3 years ago
I am strugling to solve this as well.
I am trying with gomobile:
CGO_ENABLED=1 \
gomobile bind \
-target=android/arm \
-o export.aar \
-v
I get this:
# gocv.io/x/gocv
ld: error: /usr/local/lib/libopencv_gapi.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_highgui.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_ml.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_objdetect.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_photo.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_stitching.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_video.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_calib3d.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_features2d.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_dnn.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_flann.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_videoio.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_imgcodecs.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_imgproc.so is incompatible with armelf_linux_eabi
ld: error: /usr/local/lib/libopencv_core.so is incompatible with armelf_linux_eabi
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
gomobile: go build -v -buildmode=c-shared -o=/tmp/gomobile-work-3913555039/android/src/main/jniL
ibs/armeabi-v7a/libgojni.so ./gobind failed: exit status 2
I think I need somehow to provide LIBS and CFLAGS to the linker and compiler.
If I set CGO_CPPFLAGS and CGO_LDFLAGS, process kind a moves forward:
export CGO_CPPFLAGS="-I/home/user/engine/gosseract/dependencies/output/armeabi-v7a/lib/sdk/native/jni/include/opencv2"
export CGO_LDFLAGS="-L/home/user/engine/gosseract/dependencies/output/armeabi-v7a/lib/sdk/native/libs/armeabi-v7a -lopencv_core -lopencv_videoio -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_objdetect -lopencv_features2d -lopencv_video -lopencv_dnn"
Errors:
d: error: undefined symbol: cv::dnn::dnn4_v20210608::readNet(std::__ndk1::basic_string<char, st
d::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<c
har, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_s
tring<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)
>>> referenced by dnn.cpp:4
>>> $WORK/b180/_x021.o:(Net_ReadNet)
ld: error: undefined symbol: cv::dnn::dnn4_v20210608::readNet(std::__ndk1::basic_string<char, st
d::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::vector<unsigne
d char, std::__ndk1::allocator<unsigned char> > const&, std::__ndk1::vector<unsigned char, std::
__ndk1::allocator<unsigned char> > const&)
>>> referenced by dnn.cpp:11
>>> $WORK/b180/_x021.o:(Net_ReadNetBytes)
Hi, I want to cross my so so it can be used at mobile, let's say Android, is there any other for I need to get into the Android device, or cross cooking will work smoothly? I've my GO lib that is running at Android through JNI, once I tried to use
gocv
in that lib, and croos compile my code, I got: