赞
踩
报错信息:
[78/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/lasquadtree.cpp.o
[79/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/lasinterval.cpp.o
[80/82] Linking CXX shared library E:\work\projects\LivoxLiDAR\livoxsdk\build\intermediates\cmake\debug\obj\armeabi-v7a\libLASlib.so
[81/82] Linking CXX shared library E:\work\projects\LivoxLiDAR\livoxsdk\build\intermediates\cmake\debug\obj\armeabi-v7a\libLidarApp.so
FAILED: E:/work/projects/LivoxLiDAR/livoxsdk/build/intermediates/cmake/debug/obj/armeabi-v7a/libLidarApp.so
cmd.exe /C "cd . && D:\Android\AndroidSdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi24 --gcc-toolchain=D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -std=c++11 -fPIC -pthread -fPIC -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libLidarApp.so -o E:\work\projects\LivoxLiDAR\livoxsdk\build\intermediates\cmake\debug\obj\armeabi-v7a\libLidarApp.so lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o E:/work/projects/LivoxLiDAR/livoxsdk/build/intermediates/cmake/debug/obj/armeabi-v7a/liblivoxsdk.so E:/work/projects/LivoxLiDAR/livoxsdk/build/intermediates/cmake/debug/obj/armeabi-v7a/libLASlib.so -landroid -llog -latomic -lm && cd ."
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: warning: shared library text segment is not shareable
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[82/82] Linking CXX executable lidarapp\lidarapp
ninja: build stopped: subcommand failed.> Task :livoxsdk:externalNativeBuildDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':livoxsdk:externalNativeBuildDebug'.
> Build command failed.
Error while executing process D:\Android\AndroidSdk\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C E:\work\projects\LivoxLiDAR\livoxsdk\.cxx\cmake\debug\armeabi-v7a LASlib LidarApp lidarapp livoxsdk}
ninja: Entering directory `E:\work\projects\LivoxLiDAR\livoxsdk\.cxx\cmake\debug\armeabi-v7a'
[1/82] Building CXX object CMakeFiles/livoxsdk.dir/src/base/network/unix/network_util.cpp.o
[2/82] Building CXX object CMakeFiles/livoxsdk.dir/src/comm/comm_port.cpp.o
[3/82] Building CXX object CMakeFiles/livoxsdk.dir/src/command_handler/hub_command_handler.cpp.o
[4/82] Building CXX object CMakeFiles/livoxsdk.dir/src/comm/sdk_protocol.cpp.o
[5/82] Building CXX object CMakeFiles/livoxsdk.dir/src/livox_sdk.cpp.o
[6/82] Building CXX object CMakeFiles/livoxsdk.dir/src/device_manager.cpp.o
[7/82] Building CXX object CMakeFiles/livoxsdk.dir/src/data_handler/hub_data_handler.cpp.o
[8/82] Building CXX object CMakeFiles/livoxsdk.dir/src/base/logging.cpp.o
[9/82] Building CXX object CMakeFiles/livoxsdk.dir/src/data_handler/lidar_data_handler.cpp.o
[10/82] Building CXX object CMakeFiles/livoxsdk.dir/src/third_party/FastCRC/FastCRCsw.cpp.o
[11/82] Building CXX object CMakeFiles/livoxsdk.dir/src/device_discovery.cpp.o
[12/82] Building CXX object CMakeFiles/livoxsdk.dir/src/data_handler/data_handler.cpp.o
[13/82] Building CXX object CMakeFiles/livoxsdk.dir/src/base/thread_base.cpp.o
[14/82] Building CXX object CMakeFiles/livoxsdk.dir/src/base/io_thread.cpp.o
[15/82] Building CXX object CMakeFiles/livoxsdk.dir/src/command_handler/command_handler.cpp.o
[16/82] Building CXX object CMakeFiles/livoxsdk.dir/src/command_handler/lidar_command_handler.cpp.o
[17/82] Building CXX object CMakeFiles/livoxsdk.dir/src/base/multiple_io/multiple_io_base.cpp.o
[18/82] Building CXX object CMakeFiles/livoxsdk.dir/src/command_handler/command_impl.cpp.o
[19/82] Building CXX object CMakeFiles/livoxsdk.dir/src/command_handler/command_channel.cpp.o
[20/82] Building CXX object CMakeFiles/livoxsdk.dir/src/base/multiple_io/multiple_io_epoll.cpp.o
[21/82] Building CXX object CMakeFiles/livoxsdk.dir/src/base/wake_up/unix/wake_up_pipe.cpp.o
[22/82] Building CXX object CMakeFiles/livoxsdk.dir/src/base/multiple_io/multiple_io_select.cpp.o
[23/82] Building CXX object CMakeFiles/livoxsdk.dir/src/base/multiple_io/multiple_io_poll.cpp.o
[24/82] Building CXX object CMakeFiles/livoxsdk.dir/src/base/multiple_io/multiple_io_kqueue.cpp.o
[25/82] Building CXX object lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o
[26/82] Building CXX object CMakeFiles/livoxsdk.dir/src/base/io_loop.cpp.o
[27/82] Building CXX object CMakeFiles/livoxsdk.dir/jnijavacpp.cpp.o
[28/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasignore.cpp.o
[29/82] Building CXX object lidarapp/CMakeFiles/lidarapp.dir/main.cpp.o
[30/82] Building CXX object lidarapp/CMakeFiles/lidarapp.dir/lds_lidar.cpp.o
[31/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreader_bin.cpp.o
[32/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/laswriter.cpp.o
[33/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreader.cpp.o
[34/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreader_shp.cpp.o
[35/82] Building CXX object CMakeFiles/livoxsdk.dir/livoxsdk.cpp.o
[36/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreader_asc.cpp.o
[37/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreader_dtm.cpp.o
[38/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreader_bil.cpp.o
[39/82] Linking CXX shared library E:\work\projects\LivoxLiDAR\livoxsdk\build\intermediates\cmake\debug\obj\armeabi-v7a\liblivoxsdk.so
[40/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreader_ply.cpp.o
[41/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreader_qfit.cpp.o
[42/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreader_las.cpp.o
[43/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreader_txt.cpp.o
[44/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreaderbuffered.cpp.o
[45/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/laswriter_bin.cpp.o
[46/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/laswriter_wrl.cpp.o
[47/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/laswriter_qfit.cpp.o
[48/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreaderstored.cpp.o
[49/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreaderpipeon.cpp.o
[50/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasreadermerged.cpp.o
[51/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/laswriter_txt.cpp.o
[52/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/laswritercompatible.cpp.o
[53/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/laswaveform13reader.cpp.o
[54/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/laswaveform13writer.cpp.o
[55/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/fopen_compressed.cpp.o
[56/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/laswriter_las.cpp.o
[57/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasutility.cpp.o
[58/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/lasreadpoint.cpp.o
[59/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/lasreaditemcompressed_v2.cpp.o
[60/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/laskdtree.cpp.o
[61/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/lasreaditemcompressed_v1.cpp.o
[62/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/lasreaditemcompressed_v3.cpp.o
[63/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/laswriteitemcompressed_v2.cpp.o
[64/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/laswritepoint.cpp.o
[65/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/laswriteitemcompressed_v1.cpp.o
[66/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/lasreaditemcompressed_v4.cpp.o
[67/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lasfilter.cpp.o
[68/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/arithmeticdecoder.cpp.o
[69/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/integercompressor.cpp.o
[70/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/laswriteitemcompressed_v3.cpp.o
[71/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/lastransform.cpp.o
E:/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASlib/src/lastransform.cpp:805:149: warning: multi-character character constant [-Wmultichar]
inline I32 get_command(CHAR* string) const { return sprintf(string, "-%s%c %u ", name(), (rgbi == 0 ? 'R' : (rgbi == 1 ? 'G' : (rgbi == 2 ? 'B' : 'NIR'))), index); };
^
E:/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASlib/src/lastransform.cpp:1083:149: warning: multi-character character constant [-Wmultichar]
inline I32 get_command(CHAR* string) const { return sprintf(string, "-%s%c %u ", name(), (rgbi == 0 ? 'R' : (rgbi == 1 ? 'G' : (rgbi == 2 ? 'B' : 'NIR'))), index); };
^
2 warnings generated.
[72/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/arithmeticencoder.cpp.o
[73/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/laswriteitemcompressed_v4.cpp.o
[74/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/arithmeticmodel.cpp.o
[75/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/mydefs.cpp.o
[76/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/laszip.cpp.o
[77/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/lasindex.cpp.o
[78/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/lasquadtree.cpp.o
[79/82] Building CXX object lidarapp/LASlib_output_dir/CMakeFiles/LASlib.dir/E_/work/projects/LivoxLiDAR/lastools/src/main/cpp/LASzip/src/lasinterval.cpp.o
[80/82] Linking CXX shared library E:\work\projects\LivoxLiDAR\livoxsdk\build\intermediates\cmake\debug\obj\armeabi-v7a\libLASlib.so
[81/82] Linking CXX shared library E:\work\projects\LivoxLiDAR\livoxsdk\build\intermediates\cmake\debug\obj\armeabi-v7a\libLidarApp.so
FAILED: E:/work/projects/LivoxLiDAR/livoxsdk/build/intermediates/cmake/debug/obj/armeabi-v7a/libLidarApp.so
cmd.exe /C "cd . && D:\Android\AndroidSdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi24 --gcc-toolchain=D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -std=c++11 -fPIC -pthread -fPIC -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libLidarApp.so -o E:\work\projects\LivoxLiDAR\livoxsdk\build\intermediates\cmake\debug\obj\armeabi-v7a\libLidarApp.so lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o E:/work/projects/LivoxLiDAR/livoxsdk/build/intermediates/cmake/debug/obj/armeabi-v7a/liblivoxsdk.so E:/work/projects/LivoxLiDAR/livoxsdk/build/intermediates/cmake/debug/obj/armeabi-v7a/libLASlib.so -landroid -llog -latomic -lm && cd ."
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
D:/Android/AndroidSdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: warning: shared library text segment is not shareable
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[82/82] Linking CXX executable lidarapp\lidarapp
ninja: build stopped: subcommand failed.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.org
BUILD FAILED in 14s
34 actionable tasks: 32 executed, 2 up-to-date
按照提示,试了所有的加-fPIC编译选项的方法,还是不行,包括在build.gradle中加cppFlags,在CMakeLists.txt中设置:
set_property(TARGET ${MY_LIBRARY} PROPERTY POSITION_INDEPENDENT_CODE ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
最后证明都不行。
CMakeLists.txt是这样的:
- cmake_minimum_required(VERSION 3.0)
-
- set(DEMO_NAME lidarapp)
-
- set(TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../..)
- add_subdirectory(
- ${TOP_DIR}/lastools/src/main/cpp/LASlib/src
- LASlib_output_dir
- )
-
- add_executable(${DEMO_NAME} main.cpp lds_lidar.cpp)
-
- # 引用LASlib文件头
- include_directories(
- ${TOP_DIR}/lastools/src/main/cpp/LASzip/src
- ${TOP_DIR}/lastools/src/main/cpp/LASlib/inc
- )
- #target_include_directories(${DEMO_NAME}
- # PUBLIC
- # ${TOP_DIR}/lastools/src/main/cpp/LASzip/src
- # ${TOP_DIR}/lastools/src/main/cpp/LASlib/inc
- # )
-
-
- target_link_libraries(${DEMO_NAME}
- PRIVATE
- livoxsdk #${PROJECT_NAME} # livoxsdk
- LASlib
- android
- log
- )
-
- # 开始定义动态库libLidarApp.so
- set(MY_LIBRARY LidarApp)
- # 调试输出详细信息
- set(CMAKE_VERBOSE_MAKEFILE ON)
-
- # 动态库和可执行程序的差别就在于少了一个main.cpp
- add_library(${MY_LIBRARY} SHARED lds_lidar.cpp)
- set_property(TARGET ${MY_LIBRARY} PROPERTY POSITION_INDEPENDENT_CODE ON)
-
- set(CMAKE_CXX_STANDARD 11)
- # arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
-
- target_include_directories(${MY_LIBRARY}
- PUBLIC
- ${TOP_DIR}/lastools/src/main/cpp/LASzip/src
- ${TOP_DIR}/lastools/src/main/cpp/LASlib/inc
- )
-
- # 这个库架构于livoxsdk和LASlib两个库之上
- target_link_libraries(${MY_LIBRARY}
- PRIVATE
- livoxsdk
- LASlib
- android
- log
- )
最后经同事提示,在编译so的时候另起一个小文件hello.cpp试试,开始是lds_lidar.cpp只保留了头文件引用和变量声明,结果发现可以编译了,然后一点点加代码,加到最后全部相同了,还是可以。怀疑是文件命名的原因,遂把文件名改了,后来发现又不行了。然后恍悟,应该是同时编译可执行文件和动态链接库的原因,遂注掉上面可执行程序部分,单独编译so库,发现可以了!
加了个条件编译,CMakeLists.txt变这样了:
- cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
-
- set(BUILD_EXECUTABLE OFF)
- message(编译选项 BUILD_EXECUTABLE=${BUILD_EXECUTABLE})
-
- set(TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../..)
- add_subdirectory(
- ${TOP_DIR}/lastools/src/main/cpp/LASlib/src
- LASlib_output_dir
- )
-
- if (${BUILD_EXECUTABLE})
-
- set(DEMO_NAME lidarapp)
-
- add_executable(${DEMO_NAME} main.cpp lds_lidar.cpp)
-
- # 引用LASlib文件头
- include_directories(
- ${TOP_DIR}/lastools/src/main/cpp/LASzip/src
- ${TOP_DIR}/lastools/src/main/cpp/LASlib/inc
- )
- #target_include_directories(${DEMO_NAME}
- # PUBLIC
- # ${TOP_DIR}/lastools/src/main/cpp/LASzip/src
- # ${TOP_DIR}/lastools/src/main/cpp/LASlib/inc
- # )
-
-
- target_link_libraries(${DEMO_NAME}
- PRIVATE
- livoxsdk #${PROJECT_NAME} # livoxsdk
- LASlib
- android
- log
- )
-
- else ()
-
- # so不能和上面的可执行程序同时编译,否则编译so时会报错如下:
- # arm-linux-androideabi/bin\ld: error: lidarapp/CMakeFiles/LidarApp.dir/lds_lidar.cpp.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
- # 开始定义动态库libLidarApp.so
- set(MY_LIBRARY LidarApp)
- # 调试输出详细信息
- set(CMAKE_VERBOSE_MAKEFILE ON)
-
- # 动态库和可执行程序的差别就在于少了一个main.cpp
- add_library(${MY_LIBRARY} SHARED lds_lidar.cpp)
- #set_property(TARGET ${MY_LIBRARY} PROPERTY POSITION_INDEPENDENT_CODE ON)
-
- set(CMAKE_CXX_STANDARD 11)
-
- target_include_directories(${MY_LIBRARY}
- PUBLIC
- ${TOP_DIR}/lastools/src/main/cpp/LASzip/src
- ${TOP_DIR}/lastools/src/main/cpp/LASlib/inc
- )
-
- # 这个库架构于livoxsdk和LASlib两个库之上
- target_link_libraries(${MY_LIBRARY}
- PRIVATE
- livoxsdk
- LASlib
- android
- log
- )
-
- endif ()
知道的能说说这是CMake的bug还是NDK的bug,还是我用得不对?
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。