Open psyhtest opened 7 years ago
Apparently, std::is_same
is a C++11 feature, therefore the fix was simple:
diff --git a/program/caffe-time-opencl/.cm/meta.json b/program/caffe-time-opencl/.cm/meta.json
index 1cd6c37..64d8d64 100644
--- a/program/caffe-time-opencl/.cm/meta.json
+++ b/program/caffe-time-opencl/.cm/meta.json
@@ -109,7 +109,7 @@
"CK_ENV_LIB_CAFFE_EXTRA_INCLUDE"
],
"compiler_env": "CK_CXX",
- "compiler_flags_as_env": "$<<CK_OPT_UNWIND>>$ $<<CK_ENV_LIB_CAFFE_CXXFLAGS>>$",
+ "compiler_flags_as_env": "$<<CK_OPT_UNWIND>>$ $<<CK_ENV_LIB_CAFFE_CXXFLAGS>>$ $<<CK_COMPILER_FLAG_CPP11>>$",
"data_name": "caffe-opencl-time",
"extra_ld_vars": "$<<CK_ENV_LIB_HDF5_LFLAG>>$ $<<CK_ENV_LIB_HDF5_LFLAG_HL>>$ $<<CK_ENV_LIB_GLOG_LFLAG>>$ $<<CK_ENV_LIB_BOOST_LFLAG_THREAD>>$ $<<CK_ENV_LIB_BOOST_LFLAG_DATE_TIME>>$ $<<CK_ENV_LIB_BOOST_LFLAG_FILESYSTEM>>$ $<<CK_ENV_LIB_BOOST_LFLAG_SYSTEM>>$ $<<CK_ENV_LIB_OPENCV_LFLAG_IMGPROC>>$ $<<CK_ENV_LIB_OPENCV_LFLAG_HIGHGUI>>$ $<<CK_ENV_LIB_OPENCV_LFLAG_CORE>>$ $<<CK_ENV_LIB_OPENCV_LFLAG_IMGCODECS>>$ $<<CK_EXTRA_LIB_Z>>$ $<<CK_EXTRA_LIB_LOG>>$ $<<CK_EXTRA_LIB_M>>$ $<<CK_ENV_LIB_CAFFE_LFLAG_PROTO>>$ $<<CK_ENV_LIB_CAFFE_LINK_FLAGS>>$ $<<CK_ENV_LIB_STDCPP_STATIC>>$",
"main_language": "cpp",
Building for Android, however, still fails due to a linking issue :
$ ck compile program:caffe-time-opencl --target_os=android21-arm64
...
aarch64-linux-android-g++ -fPIE -pie -c --sysroot /home/anton/usr-local/android-ndk-r14b/platforms/android-21/arch-arm64 -I../ -DANDROID_USE_OPENMP=ON -DBLAS=Open -DCK_HOST_OS_NAME2_LINUX=1 -DCK_HOST_OS_NAME_LINUX=1 -DCK_TARGET_OS_NAME2_ANDROID=1 -DCK_TARGET_OS_NAME_LINUX=1 -DUSE_GREENTEA=ON -DUSE_LMDB=OFF -DUSE_OPENCV=ON -DXOPENME=ON -std=c++11 -I/home/anton/CK_TOOLS/lib-caffe-bvlc-opencl-clblast-trunk-android-ndk-4.9.x-android21-arm64/install/include -I/home/anton/CK_TOOLS/lib-gflags-2.2.0-android-ndk-4.9.x-android21-arm64/install/include -I/home/anton/CK_TOOLS/lib-glog-development-android-ndk-4.9.x-android21-arm64/install/include -I/home/anton/CK_TOOLS/lib-openblas-0.2.19-android-ndk-4.9.x-android21-arm64/install/include -I/home/anton/CK_TOOLS/lib-protobuf-3.1.0-android-ndk-4.9.x-android21-arm64/install/include -I/home/anton/CK_TOOLS/lib-opencv-3.2.0-android-ndk-4.9.x-android21-arm64/install/sdk/native/jni/include -I/home/anton/CK_TOOLS/lib-boost-1.62.0-android-ndk-4.9.x-android21-arm64/install/include -I/home/anton/CK_TOOLS/lib-opencl-stubs-1.2-android-ndk-4.9.x-android21-arm64/include -I/home/anton/CK_TOOLS/lib-boost-1.62.0-android-ndk-4.9.x-android21-arm64/install/include -I/home/anton/CK_TOOLS/lib-viennacl-src-dvdt-master-android21-arm64/src -I/home/anton/CK_TOOLS/lib-rtl-xopenme-0.3-android-ndk-4.9.x-android21-arm64/include -I/home/anton/usr-local/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/include -I/home/anton/usr-local/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include -I/home/anton/CK_TOOLS/lib-caffe-bvlc-opencl-clblast-trunk-android-ndk-4.9.x-android21-arm64/install/.build_release/src ../caffe.cpp -o caffe.o
aarch64-linux-android-g++ -fPIE -pie --sysroot /home/anton/usr-local/android-ndk-r14b/platforms/android-21/arch-arm64 caffe.o -o caffe -L/home/anton/CK_TOOLS/lib-caffe-bvlc-opencl-clblast-trunk-android-ndk-4.9.x-android21-arm64/install/lib -lcaffe -L/home/anton/CK_TOOLS/lib-gflags-2.2.0-android-ndk-4.9.x-android21-arm64/install/lib -lgflags -L/home/anton/CK_TOOLS/lib-glog-development-android-ndk-4.9.x-android21-arm64/install/lib -lglog -L/home/anton/CK_TOOLS/lib-openblas-0.2.19-android-ndk-4.9.x-android21-arm64/install/lib -lopenblas -L/home/anton/CK_TOOLS/lib-protobuf-3.1.0-android-ndk-4.9.x-android21-arm64/install/lib -lprotobuf -L/home/anton/CK_TOOLS/lib-opencv-3.2.0-android-ndk-4.9.x-android21-arm64/install/sdk/native/libs/arm64-v8a -lopencv_core -L/home/anton/CK_TOOLS/lib-boost-1.62.0-android-ndk-4.9.x-android21-arm64/install/lib -L/home/anton/CK_TOOLS/lib-opencl-stubs-1.2-android-ndk-4.9.x-android21-arm64/lib -lOpenCL -L/home/anton/CK_TOOLS/lib-rtl-xopenme-0.3-android-ndk-4.9.x-android21-arm64/lib -lrtlxopenme -lglog -lboost_thread -lboost_date_time -lboost_filesystem -lboost_system -lopencv_imgproc -lopencv_highgui -lopencv_core -lz -llog -lm /home/anton/usr-local/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/libgnustl_static.a
/usr/local/android-ndk-r14b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: warning: libgnustl_shared.so, needed by /home/anton/CK_TOOLS/lib-caffe-bvlc-opencl-clblast-trunk-android-ndk-4.9.x-android21-arm64/install/lib/libcaffe.so, not found (try using -rpath or -rpath-link)
/usr/local/android-ndk-r14b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: caffe: hidden symbol `_ZNSs13_S_copy_charsEPcS_S_' in /home/anton/usr-local/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/libgnustl_static.a(string-inst.o) is referenced by DSO
/usr/local/android-ndk-r14b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Hi, I fixed the problem putting the flag "-shared" on meta.json. Anyway, I am not using CK variables and the flag is hard-coded in the meta json file.
I tried to reproduce this issue on a clean machine (velocity, with all clean repos), and it compiles fine (with clblast)! Do you mind to remove CK-TOOLS and ck rm env:* -f and try it from scratch again, please? Can you then tell me if you still have this issue? Because I think that's it's not a problem anymore ... Thanks!
I reproduced the issue on a clean machine. The problem persist if I remove "-shared" from the meta.json of caffe-time-opencl
Bizzare - which machine did you use? velocity? I again rebuilt everything on velocity without -shared and it worked fine ... However, such problem happens when there is a mix between libs in /usr/lib and compiled by CK via LD_LIBRARY_PATH (I don't yet have a good solution for that) ...
And do you target x86(64) or it's for Android?
Oh, I see that it's for Android, while I am checking for x86_64 ...
I still can't reproduce this issue, but I suggest to remove -shared from meta (it's not correct for Windows), and use the following for compilation on problematic platforms: $ ck compile program:caffe-time-opencl --target_os=android21-arm64 --lflags=-shared