I have these files in the directory:
CMakeLists.txt datalink.c datalink.h protocol.a protocol.h
All these files were got from my teacher except CMakeLists.txt.
#CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(DataLinkSimulator)
INCLUDE_DIRECTORIES(.)
set(SOURCE_FILES datalink.c protocol.a datalink.h protocol.h)
add_executable(DataLinkSimulator ${SOURCE_FILES})
target_link_libraries(DataLinkSimulator protocol.a)
I run 'cmake .' in this directory, and it works.
However, when I run 'make' , it gives me these errors.
Scanning dependencies of target DataLinkSimulator
[ 50%] Building C object CMakeFiles/DataLinkSimulator.dir/datalink.c.o
[100%] Linking C executable DataLinkSimulator
/usr/bin/ld: cannot find -lprotocol
collect2: 错误:ld 返回 1 #(means "error: ld return 1")
CMakeFiles/DataLinkSimulator.dir/build.make:94: recipe for target 'DataLinkSimulator' failed
make[2]: *** [DataLinkSimulator] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DataLinkSimulator.dir/all' failed
make[1]: *** [CMakeFiles/DataLinkSimulator.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
The error "cannot find -lprotocol" must caused by ld's mistaking protocol as a shared lib. But my protocol is a static lib. So I am confused.
If I edit makefile by myself instead of using cmake, it works correctly.
datalink: datalink.c datalink.h
gcc datalink.c protocol.a -o datalink -lm -lstdc++ -m32
clean:
${RM} datalink
${RM} *.o
I used a "make VERBOSE=1":
/usr/local/bin/cmake -H/home/shantom/Desktop/FileRecv/Lab1-linux -B/home/shantom/Desktop/FileRecv/Lab1-linux --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /home/shantom/Desktop/FileRecv/Lab1-linux/CMakeFiles /home/shantom/Desktop/FileRecv/Lab1-linux/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
make -f CMakeFiles/DataLinkSimulator.dir/build.make CMakeFiles/DataLinkSimulator.dir/depend
make[2]: Entering directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
cd /home/shantom/Desktop/FileRecv/Lab1-linux && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /home/shantom/Desktop/FileRecv/Lab1-linux /home/shantom/Desktop/FileRecv/Lab1-linux /home/shantom/Desktop/FileRecv/Lab1-linux /home/shantom/Desktop/FileRecv/Lab1-linux /home/shantom/Desktop/FileRecv/Lab1-linux/CMakeFiles/DataLinkSimulator.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
make -f CMakeFiles/DataLinkSimulator.dir/build.make CMakeFiles/DataLinkSimulator.dir/build
make[2]: Entering directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
[ 50%] Linking C executable DataLinkSimulator
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/DataLinkSimulator.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/DataLinkSimulator.dir/datalink.c.o -o DataLinkSimulator -Wl,-Bstatic -lprotocol -Wl,-Bdynamic
/usr/bin/ld: cannot find -lprotocol
collect2: 错误:ld 返回 1
CMakeFiles/DataLinkSimulator.dir/build.make:94: recipe for target 'DataLinkSimulator' failed
make[2]: *** [DataLinkSimulator] Error 1
make[2]: Leaving directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DataLinkSimulator.dir/all' failed
make[1]: *** [CMakeFiles/DataLinkSimulator.dir/all] Error 2
make[1]: Leaving directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
In order to understand the error you need to launch make command from the command line using verbose mode; on Linux paltform it means launching:
make VERBOSE=1
In this manner you will have the entire command line used to compile the code.
In order to resolve your error you could:
add a link_directories(directory_where_you_have_library) CMake line adding the directory where you have protocol.a before target_link_libraries line
add protocol.a with absolute path.
Your modified Makefile works because probably you have it in the same directory of all the files while CMake creates many Makefiles in various directories starting from build root directory so it needs -L gcc flags (obtainable through link_directories) or -l with absolute path (obtainable adding protocol.a with absolute path).
Related
I create a static library following an Nvidia example
Here is my CMakeLists.txt file
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
set(CMAKE_VERBOSE_MAKEFILE TRUE CACHE BOOL "")
set(CMAKE_CUDA_COMPILER "/usr/local/cuda/bin/nvcc" CACHE FILEPATH "")
set(CMAKE_CUDA_HOST_COMPILER "/opt/qos2.1.1-build4288/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc" CACHE FILEPATH "")
project(cmake_and_cuda LANGUAGES CUDA CXX)
add_library(particles STATIC
randomize.cpp
randomize.h
particle.cu
particle.h
v3.cu
v3.h
calc.h
calc.cu
)
target_link_libraries(particles PRIVATE stdc++)
set_target_properties(particles PROPERTIES LANGUAGE CUDA)
set_target_properties(particles PROPERTIES LINKER_LANGUAGE CUDA)
target_compile_options(particles PRIVATE $<$<COMPILE_LANGUAGE:CUDA>: "--std=c++11" >)
set_target_properties(particles PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
# build executable
add_executable(particle_test main.cpp)
set_target_properties(particle_test PROPERTIES LANGUAGE CXX)
set_target_properties(particle_test PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(particle_test PRIVATE particles)
The build is successful. Here is the build log:
jenkins#ubuntu:~/git_repos/test/test_gpu/build$ make
/usr/bin/cmake -H/home/jenkins/git_repos/test/test_gpu -B/home/jenkins/git_repos/test/test_gpu/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/jenkins/git_repos/test/test_gpu/build/CMakeFiles /home/jenkins/git_repos/test/test_gpu/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/jenkins/git_repos/test/test_gpu/build'
make -f CMakeFiles/particles.dir/build.make CMakeFiles/particles.dir/depend
make[2]: Entering directory '/home/jenkins/git_repos/test/test_gpu/build'
cd /home/jenkins/git_repos/test/test_gpu/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jenkins/git_repos/test/test_gpu /home/jenkins/git_repos/test/test_gpu /home/jenkins/git_repos/test/test_gpu/build /home/jenkins/git_repos/test/test_gpu/build /home/jenkins/git_repos/test/test_gpu/build/CMakeFiles/particles.dir/DependInfo.cmake --color=
Scanning dependencies of target particles
make[2]: Leaving directory '/home/jenkins/git_repos/test/test_gpu/build'
make -f CMakeFiles/particles.dir/build.make CMakeFiles/particles.dir/build
make[2]: Entering directory '/home/jenkins/git_repos/test/test_gpu/build'
[ 12%] Building CXX object CMakeFiles/particles.dir/randomize.cpp.o
/opt/qos2.1.1-build4288/host/linux/x86_64/usr/bin/ntoaarch64-g++ -o CMakeFiles/particles.dir/randomize.cpp.o -c /home/jenkins/git_repos/test/test_gpu/randomize.cpp
[ 25%] Building CUDA object CMakeFiles/particles.dir/particle.cu.o
/usr/local/cuda/bin/nvcc -ccbin=/opt/qos2.1.1-build4288/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc --std=c++11 -x cu -dc /home/jenkins/git_repos/test/test_gpu/particle.cu -o CMakeFiles/particles.dir/particle.cu.o
[ 37%] Building CUDA object CMakeFiles/particles.dir/v3.cu.o
/usr/local/cuda/bin/nvcc -ccbin=/opt/qos2.1.1-build4288/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc --std=c++11 -x cu -dc /home/jenkins/git_repos/test/test_gpu/v3.cu -o CMakeFiles/particles.dir/v3.cu.o
[ 50%] Building CUDA object CMakeFiles/particles.dir/calc.cu.o
/usr/local/cuda/bin/nvcc -ccbin=/opt/qos2.1.1-build4288/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc --std=c++11 -x cu -dc /home/jenkins/git_repos/test/test_gpu/calc.cu -o CMakeFiles/particles.dir/calc.cu.o
[ 62%] Linking CUDA static library libparticles.a
/usr/bin/cmake -P CMakeFiles/particles.dir/cmake_clean_target.cmake
/usr/bin/cmake -E cmake_link_script CMakeFiles/particles.dir/link.txt --verbose=1
/usr/bin/ar qc libparticles.a CMakeFiles/particles.dir/randomize.cpp.o CMakeFiles/particles.dir/particle.cu.o CMakeFiles/particles.dir/v3.cu.o CMakeFiles/particles.dir/calc.cu.o
/usr/bin/ranlib libparticles.a
make[2]: Leaving directory '/home/jenkins/git_repos/test/test_gpu/build'
[ 62%] Built target particles
make -f CMakeFiles/particle_test.dir/build.make CMakeFiles/particle_test.dir/depend
make[2]: Entering directory '/home/jenkins/git_repos/test/test_gpu/build'
cd /home/jenkins/git_repos/test/test_gpu/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jenkins/git_repos/test/test_gpu /home/jenkins/git_repos/test/test_gpu /home/jenkins/git_repos/test/test_gpu/build /home/jenkins/git_repos/test/test_gpu/build /home/jenkins/git_repos/test/test_gpu/build/CMakeFiles/particle_test.dir/DependInfo.cmake --color=
Scanning dependencies of target particle_test
make[2]: Leaving directory '/home/jenkins/git_repos/test/test_gpu/build'
make -f CMakeFiles/particle_test.dir/build.make CMakeFiles/particle_test.dir/build
make[2]: Entering directory '/home/jenkins/git_repos/test/test_gpu/build'
[ 75%] Building CXX object CMakeFiles/particle_test.dir/main.cpp.o
/opt/qos2.1.1-build4288/host/linux/x86_64/usr/bin/ntoaarch64-g++ -o CMakeFiles/particle_test.dir/main.cpp.o -c /home/jenkins/git_repos/test/test_gpu/main.cpp
[ 87%] Linking CUDA device code CMakeFiles/particle_test.dir/cmake_device_link.o
/usr/bin/cmake -E cmake_link_script CMakeFiles/particle_test.dir/dlink.txt --verbose=1
/usr/local/cuda/bin/nvcc -ccbin=/opt/qos2.1.1-build4288/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc -Xcompiler=-fPIC -Wno-deprecated-gpu-targets -shared -dlink CMakeFiles/particle_test.dir/main.cpp.o -o CMakeFiles/particle_test.dir/cmake_device_link.o -L/usr/local/cuda/targets/aarch64-qnx/lib/stubs -L/usr/local/cuda/targets/aarch64-qnx/lib libparticles.a
[100%] Linking CXX executable particle_test
/usr/bin/cmake -E cmake_link_script CMakeFiles/particle_test.dir/link.txt --verbose=1
/opt/qos2.1.1-build4288/host/linux/x86_64/usr/bin/ntoaarch64-g++ CMakeFiles/particle_test.dir/main.cpp.o CMakeFiles/particle_test.dir/cmake_device_link.o -o particle_test -L/usr/local/cuda/targets/aarch64-qnx/lib/stubs -L/usr/local/cuda/targets/aarch64-qnx/lib libparticles.a -lstdc++ -lcudadevrt -lcudart_static
make[2]: Leaving directory '/home/jenkins/git_repos/test/test_gpu/build'
[100%] Built target particle_test
However, if I want to export libparticles.a and uses it in another project, it does not work.
target_link_libraries(another_project PRIVATE ${CMAKE_SOURCE_DIR}/libparticles.a)
The error log:
jenkins#ubuntu:~/git_repos/test/test_gpu/build$ make
/usr/bin/cmake -H/home/jenkins/git_repos/test/test_gpu -B/home/jenkins/git_repos/test/test_gpu/build --check-build-system CMakeFiles/Makefile.cmake 0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jenkins/git_repos/test/test_gpu/build
/usr/bin/cmake -E cmake_progress_start /home/jenkins/git_repos/test/test_gpu/build/CMakeFiles /home/jenkins/git_repos/test/test_gpu/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/jenkins/git_repos/test/test_gpu/build'
make -f CMakeFiles/another_project.dir/build.make CMakeFiles/another_project.dir/depend
make[2]: Entering directory '/home/jenkins/git_repos/test/test_gpu/build'
cd /home/jenkins/git_repos/test/test_gpu/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jenkins/git_repos/test/test_gpu /home/jenkins/git_repos/test/test_gpu /home/jenkins/git_repos/test/test_gpu/build /home/jenkins/git_repos/test/test_gpu/build /home/jenkins/git_repos/test/test_gpu/build/CMakeFiles/another_project.dir/DependInfo.cmake --color=
Scanning dependencies of target another_project
make[2]: Leaving directory '/home/jenkins/git_repos/test/test_gpu/build'
make -f CMakeFiles/particle_test.dir/build.make CMakeFiles/another_project.dir/build
make[2]: Entering directory '/home/jenkins/git_repos/test/test_gpu/build'
[ 50%] Linking CXX executable particle_test
/usr/bin/cmake -E cmake_link_script CMakeFiles/another_project.dir/link.txt --verbose=1
/opt/qos2.1.1-build4288/host/linux/x86_64/usr/bin/ntoaarch64-g++ CMakeFiles/another_project.dir/main.cpp.o -o another_project ../libparticles.a
../libparticles.a(calc.cu.o): In function `calc::calc_func()':
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x58): undefined reference to `cudaGetLastError'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x70): undefined reference to `cudaGetErrorString'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x104): undefined reference to `cudaDeviceSynchronize'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x108): undefined reference to `cudaGetLastError'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x120): undefined reference to `cudaGetErrorString'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x15c): undefined reference to `cudaMemcpy'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x160): undefined reference to `cudaDeviceSynchronize'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x164): undefined reference to `cudaGetLastError'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x17c): undefined reference to `cudaGetErrorString'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x210): undefined reference to `__cudaPushCallConfiguration'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x22c): undefined reference to `cudaGetLastError'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x244): undefined reference to `cudaGetErrorString'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x25c): undefined reference to `cudaDeviceSynchronize'
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x294): undefined reference to `cudaMemcpy'
../libparticles.a(calc.cu.o): In function `__cudaUnregisterBinaryUtil()':
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x480): undefined reference to `__cudaUnregisterFatBinary'
../libparticles.a(calc.cu.o): In function `__nv_init_managed_rt_with_module(void**)':
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x4a0): undefined reference to `__cudaInitModule'
../libparticles.a(calc.cu.o): In function `__device_stub__Z16advanceParticlesfP8particlei(float, particle*, int)':
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x5bc): undefined reference to `__cudaPopCallConfiguration'
../libparticles.a(calc.cu.o): In function `__nv_cudaEntityRegisterCallback(void**)':
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x708): undefined reference to `__cudaRegisterFunction'
../libparticles.a(calc.cu.o): In function `__sti____cudaRegisterAll()':
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x744): undefined reference to `__cudaRegisterLinkedBinary_39_tmpxft_00036041_00000000_6_calc_cpp1_ii_78a77cc9'
../libparticles.a(calc.cu.o): In function `cudaError cudaMalloc<particle>(particle**, unsigned long)':
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x76c): undefined reference to `cudaMalloc'
../libparticles.a(calc.cu.o): In function `cudaError cudaLaunchKernel<char>(char const*, dim3, dim3, void**, unsigned long, CUstream_st*)':
tmpxft_00036041_00000000-5_calc.cudafe1.cpp:(.text+0x7e8): undefined reference to `cudaLaunchKernel'
../libparticles.a(particle.cu.o): In function `__cudaUnregisterBinaryUtil()':
tmpxft_00035ff9_00000000-5_particle.cudafe1.cpp:(.text+0x1c4): undefined reference to `__cudaUnregisterFatBinary'
../libparticles.a(particle.cu.o): In function `__nv_init_managed_rt_with_module(void**)':
tmpxft_00035ff9_00000000-5_particle.cudafe1.cpp:(.text+0x1e4): undefined reference to `__cudaInitModule'
../libparticles.a(particle.cu.o): In function `__sti____cudaRegisterAll()':
tmpxft_00035ff9_00000000-5_particle.cudafe1.cpp:(.text+0x24c): undefined reference to `__cudaRegisterLinkedBinary_43_tmpxft_00035ff9_00000000_6_particle_cpp1_ii_bd5b23a5'
../libparticles.a(v3.cu.o): In function `__cudaUnregisterBinaryUtil()':
tmpxft_00036017_00000000-5_v3.cudafe1.cpp:(.text+0x3ac): undefined reference to `__cudaUnregisterFatBinary'
../libparticles.a(v3.cu.o): In function `__nv_init_managed_rt_with_module(void**)':
tmpxft_00036017_00000000-5_v3.cudafe1.cpp:(.text+0x3cc): undefined reference to `__cudaInitModule'
../libparticles.a(v3.cu.o): In function `__sti____cudaRegisterAll()':
tmpxft_00036017_00000000-5_v3.cudafe1.cpp:(.text+0x434): undefined reference to `__cudaRegisterLinkedBinary_37_tmpxft_00036017_00000000_6_v3_cpp1_ii_ec982148'
collect2: error: ld returned 1 exit status
CMakeFiles/particle_test.dir/build.make:98: recipe for target 'another_project' failed
make[2]: *** [particle_test] Error 1
make[2]: Leaving directory '/home/jenkins/git_repos/test/test_gpu/build'
CMakeFiles/Makefile2:70: recipe for target 'CMakeFiles/another_project.dir/all' failed
make[1]: *** [CMakeFiles/another_project.dir/all] Error 2
make[1]: Leaving directory '/home/jenkins/git_repos/test/test_gpu/build'
Makefile:86: recipe for target 'all' failed
make: *** [all] Error 2
I cannot understand the reason. In the end, I want to send libparticles.a to another developer and let him use it. Any help is really appreciated since I stuck at this problem for a while now.
Its about how GCC links library, if the name of lib is particles try this
target_link_directories(another_project PRIVATE /home/path_to_dir_containing_lib_a_file)
target_link_libraries(another_project PRIVATE particles)
Please see this manual:
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
-l library
Search the library named library when linking. (The second alternative with the library as a separate argument is only for POSIX compliance and is not recommended.)
The -l option is passed directly to the linker by GCC. Refer to your linker documentation for exact details. The general description below applies to the GNU linker.
The linker searches a standard list of directories for the library. The directories searched include several standard system directories plus any that you specify with -L.
It means that dirs containing libraries are passed separatly (under another flag) from library name
I am facing an issue while cross-compiling an awsclient application. My build environment is Ubuntu 20.04 and Buildroot running from Docker Desktop for Windows. I am using cmake tool. But when I do make I am getting below erros:
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glib-2.0/gobject/gbinding.h:28,
from /usr/include/glib-2.0/glib-object.h:22,
from /usr/include/glib-2.0/gio/gioenums.h:28,
from /usr/include/glib-2.0/gio/giotypes.h:28,
from /usr/include/glib-2.0/gio/gio.h:26,
from /root/br-tcg4/libs/br_pjt/aws-iot-client/src/rauc-installer-gen.h:12,
from /root/br-tcg4/libs/br_pjt/aws-iot-client/src/rauc-installer-gen.c:13:
/usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
/usr/include/glib-2.0/glib/gmacros.h:738:31: error: static assertion failed: "Expression evaluates to false"
#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
^
/usr/include/glib-2.0/glib/gtypes.h:463:3: note: in expansion of macro 'G_STATIC_ASSERT'
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^~~~~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/awsclient.dir/build.make:150: src/CMakeFiles/awsclient.dir /rauc-installer-gen.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:554: src/CMakeFiles/awsclient.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
One thing I noticed while doing cmake before make is cmake generated some warnings about linker.
CMake Warning at src/CMakeLists.txt:17 (add_executable):
Cannot generate a safe linker search path for target awsclient because
files in some directories may conflict with libraries in implicit
directories:
link library [libcurl.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/root/br-tcg4/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/arm-linux- gnueabihf/libc/usr/lib
link library [libssl.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/root/br-tcg4/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/arm-linux- gnueabihf/libc/usr/lib
link library [libcrypto.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/root/br-tcg4/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/arm-linux- gnueabihf/libc/usr/lib
Some of these libraries may not be found correctly.
The dir /root/br-tcg4/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf is the location of the toolchain I am using. I am not sure if these warnings are reason for above issue.
Update I
The output of make VERBOSE=1 is:
/usr/bin/cmake -S/root/br-tcg4/libs/br_pjt/aws-iot-client -B/root/br-tcg4/libs/br_pjt/aws-iot-client/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /root/br-tcg4/libs/br_pjt/aws-iot-client/build/CMakeFiles /root/br-tcg4/libs/br_pjt/aws-iot-client/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build.make lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build.make lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[2]: Nothing to be done for 'lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build'.
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 36%] Built target aws-iot-sdk-cpp
make -f lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/samples/PubSub /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/PubSub /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[2]: Nothing to be done for 'lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/build'.
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 42%] Built target pub-sub-sample
make -f lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/samples/ShadowDelta /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/ShadowDelta /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[2]: Nothing to be done for 'lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/build'.
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 47%] Built target shadow-delta-sample
make -f lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/samples/Jobs /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/Jobs /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[2]: Nothing to be done for 'lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/build'.
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 53%] Built target jobs-sample
make -f lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/build.make lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/samples/JobsAgent /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/JobsAgent /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/build.make lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[2]: Nothing to be done for 'lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/build'.
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 60%] Built target jobs-agent
make -f src/CMakeFiles/awsclient.dir/build.make src/CMakeFiles/awsclient.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/src /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/src /root/br-tcg4/libs/br_pjt/aws-iot-client/build/src/CMakeFiles/awsclient.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f src/CMakeFiles/awsclient.dir/build.make src/CMakeFiles/awsclient.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 61%] Building C object src/CMakeFiles/awsclient.dir/rauc-installer-gen.c.o
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build/src && /root/br-tcg4/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -DOPENSSL_LOAD_CONF -I/root/br-tcg4/libs/br_pjt/aws-iot-client/build/third_party/rapidjson/src/include -I/root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/json-glib-1.0 -I/root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/network/OpenSSL -pthread -o CMakeFiles/awsclient.dir/rauc-installer-gen.c.o -c /root/br-tcg4/libs/br_pjt/aws-iot-client/src/rauc-installer-gen.c
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glib-2.0/gobject/gbinding.h:28,
from /usr/include/glib-2.0/glib-object.h:22,
from /usr/include/glib-2.0/gio/gioenums.h:28,
from /usr/include/glib-2.0/gio/giotypes.h:28,
from /usr/include/glib-2.0/gio/gio.h:26,
from /root/br-tcg4/libs/br_pjt/aws-iot-client/src/rauc-installer-gen.h:12,
from /root/br-tcg4/libs/br_pjt/aws-iot-client/src/rauc-installer-gen.c:13:
/usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
/usr/include/glib-2.0/glib/gmacros.h:738:31: error: static assertion failed: "Expression evaluates to false"
#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
^
/usr/include/glib-2.0/glib/gtypes.h:463:3: note: in expansion of macro 'G_STATIC_ASSERT'
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^~~~~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/awsclient.dir/build.make:150: src/CMakeFiles/awsclient.dir/rauc-installer-gen.c.o] Error 1
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[1]: *** [CMakeFiles/Makefile2:554: src/CMakeFiles/awsclient.dir/all] Error 2
make[1]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make: *** [Makefile:130: all] Error 2
Here is the Toolchain File:
# The OpenSSL paths in the network/CMakeLists.txt needs to be replaced with the path to the cross-compiled OpenSSL library for
# the required paltform
# General CMAKE cross compile settings
SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_SYSTEM_VERSION 1)
# Specify toolchain directory
SET(TOOLCHAIN_DIR /home/toolchain/dir/here/bin)
# Specify cross compilation target
SET(TARGET_CROSS target-here)
# Set compilers
SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/${TARGET_CROSS}g++)
# Set linker
SET(CMAKE_LINKER ${TOOLCHAIN_DIR}/${TARGET_CROSS}ld)
# Set compiler flags
SET(CMAKE_CXX_FLAGS ${COMMON_FLAGS} -std=c++11)
# Set archiving tool
SET(CMAKE_AR ${TOOLCHAIN_DIR}/${TARGET_CROSS}ar CACHE FILEPATH "Archiver")
# Set randomizing tool for static libraries
SET(CMAKE_RANLIB ${TOOLCHAIN_DIR}/${TARGET_CROSS}ranlib)
# Set strip tool
SET(CMAKE_STRIP ${TOOLCHAIN_DIR}/${TARGET_CROSS}strip)
# Set objdump tool
SET(CMAKE_OBJDUMP ${TOOLCHAIN_DIR}/${TARGET_CROSS}objdump)
# Set objcopy tool
SET(CMAKE_OBJCOPY ${TOOLCHAIN_DIR}/${TARGET_CROSS}objcopy)
# Set nm tool
SET(CMAKE_NM ${TOOLCHAIN_DIR}/${TARGET_CROSS}nm)
# Set THREADS_PTHREAD_ARG for testing threading
SET(THREADS_PTHREAD_ARG "2" CACHE STRING "Forcibly set by ToolchainFile.cmake." FORCE)
Update II
After following input from #Tsyvarev and #KamilCuk comment, I updated the Toolchain file to fetch binaries and headers from target system(arm) instead of host machine(x86_64). Now cmakeis building files successfully and no warnings are shown. But when I do make I get below errors:
/opt/poky/3.1.12/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -S/root/sources/aws-iot-client -B/root/sources/aws-iot-client/build --check-build-system CMakeFiles/Makefile.cmake 0
/opt/poky/3.1.12/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_progress_start /root/sources/aws-iot-client/build/CMakeFiles /root/sources/aws-iot-client/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/root/sources/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build.make lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/depend
make[2]: Entering directory '/root/sources/aws-iot-client/build'
cd /root/sources/aws-iot-client/build && /opt/poky/3.1.12/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/sources/aws-iot-client /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp /root/sources/aws-iot-client/build /root/sources/aws-iot-client/build/lib/aws-iot-device-sdk-cpp /root/sources/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/sources/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build.make lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build
make[2]: Entering directory '/root/sources/aws-iot-client/build'
[ 1%] Building CXX object lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/src/Action.cpp.o
cd /root/sources/aws-iot-client/build/lib/aws-iot-device-sdk-cpp && /opt/poky/3.1.12/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi --sysroot=/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi -DOPENSSL_LOAD_CONF -DSDK_VERSION_STRING=\"1.4.0\" -I/root/sources/aws-iot-client/build/third_party/rapidjson/src/include -I/root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/include -O2 -pipe -g -feliminate-unused-debug-types -fPIC -pthread -std=c++11 -o CMakeFiles/aws-iot-sdk-cpp.dir/src/Action.cpp.o -c /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/src/Action.cpp
cc1plus: warning: include location "/usr/include/x86_64-linux-gnu" is unsafe for cross-compilation [-Wpoison-system-directories]
In file included from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/wchar.h:30,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/cwchar:44,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/bits/postypes.h:40,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/bits/char_traits.h:40,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/string:40,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/include/Action.hpp:27,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/src/Action.cpp:26:
/usr/include/x86_64-linux-gnu/bits/floatn.h:75:70: error: unknown machine mode '__TC__'
75 | typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
| ^
/usr/include/x86_64-linux-gnu/bits/floatn.h:87:9: error: '__float128' does not name a type; did you mean '__cfloat128'?
87 | typedef __float128 _Float128;
| ^~~~~~~~~~
| __cfloat128
In file included from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/cwchar:44,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/bits/postypes.h:40,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/bits/char_traits.h:40,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/string:40,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/include/Action.hpp:27,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/src/Action.cpp:26:
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/wchar.h:406:8: error: '_Float128' does not name a type; did you mean '_Float32x'?
406 | extern _Float128 wcstof128 (const wchar_t *__restrict __nptr,
| ^~~~~~~~~
| _Float32x
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/wchar.h:523:8: error: '_Float128' does not name a type; did you mean '_Float32x'?
523 | extern _Float128 wcstof128_l (const wchar_t *__restrict __nptr,
| ^~~~~~~~~
| _Float32x
In file included from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/cstdlib:75,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/ext/string_conversions.h:41,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/bits/basic_string.h:6493,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/string:55,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/include/Action.hpp:27,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/src/Action.cpp:26:
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/stdlib.h:152:8: error: '_Float128' does not name a type; did you mean '_Float32x'?
152 | extern _Float128 strtof128 (const char *__restrict __nptr,
| ^~~~~~~~~
| _Float32x
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/stdlib.h:245:4: error: '_Float128' has not been declared
245 | _Float128 __f)
| ^~~~~~~~~
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/stdlib.h:330:8: error: '_Float128' does not name a type; did you mean '_Float32x'?
330 | extern _Float128 strtof128_l (const char *__restrict __nptr,
| ^~~~~~~~~
| _Float32x
make[2]: *** [lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build.make:63: lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/src/Action.cpp.o] Error 1
make[2]: Leaving directory '/root/sources/aws-iot-client/build'
make[1]: *** [CMakeFiles/Makefile2:338: lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/all] Error 2
make[1]: Leaving directory '/root/sources/aws-iot-client/build'
make: *** [Makefile:130: all] Error 2
I am not sure why I still get this warning
cc1plus: warning: include location "/usr/include/x86_64-linux-gnu" is unsafe for cross-compilation [-Wpoison-system-directories]
Update III
After spending some time exploring the project, I understood that Toolchain file used here is OEToolchainConfig.cmake.
set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE )
set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE )
set( CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "" FORCE )
set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE )
set( CMAKE_SYSROOT $ENV{OECORE_TARGET_SYSROOT} )
set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX "$ENV{OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}")
# Set CMAKE_SYSTEM_PROCESSOR from the sysroot name (assuming processor-distro-os).
if ($ENV{SDKTARGETSYSROOT} MATCHES "/sysroots/([a-zA-Z0-9_-]+)-.+-.+")
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_MATCH_1})
endif()
# Include the toolchain configuration subscripts
file( GLOB toolchain_config_files "${CMAKE_TOOLCHAIN_FILE}.d/*.cmake" )
foreach(config ${toolchain_config_files})
include(${config})
endforeach()
OECORE_TARGET_SYSROOT is set to echo $OECORE_TARGET_SYSROOT:
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi
I am not sure why we need to use this file which is genearted from populate_sdk by yocto.
Can someone please let me know how to resolve this?
Thanks in advance.
P.S: I am new to Cmake and please let me know if there are any missing info.
I am using vcpkg for the first time with amqpcpp. I am testing it out with cmake to get a project setup using a library. vcpkg installs the package correctly and cmake has no trouble finding the target amqpcpp. There is some issue with the linker that I cannot solve. Below is my CMakeLists.txt.
cmake_minimum_required(VERSION 3.15)
set(VCPKG_TARGET_TRIPLET x86-windows )
set(CMAKE_TOOLCHAIN_FILE "C:/Users/reine/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
project(amqp_test)
set(CMAKE_CXX_STANDARD 11)
find_package(amqpcpp CONFIG REQUIRED)
include_directories(${amqpcpp_INCLUDE_DIR})
add_executable(amqp_test main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE amqpcpp)
And below is the linker error that I am experiencing. The ConnectionImpl does indeed exist. Why are the file names so crazy? I imagine this is something that is done to prevent double referencing of an object. I am thinking this is where my problem is.
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: CMakeFiles\amqp_test.dir/objects.a(main.cpp.obj): in function `ZN4AMQP10ConnectionD1Ev':
C:/Users/reine/vcpkg/installed/x86-windows/include/amqpcpp/connection.h:70: undefined reference to `AMQP::ConnectionImpl::~ConnectionImpl()'
I have done my due diligence searching this type of linker error and am completely stuck.
Verbose Make Output
Clean finished
====================[ Build | all | Debug ]=====================================
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" --build C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug --target all -- -j 4
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -SC:\Users\reine\CLionProjects\amqp-test -BC:\Users\reine\CLionProjects\amqp-test\cmake-build-debug --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E cmake_progress_start C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug\CMakeFiles C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug\CMakeFiles\progress.marks
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 all
mingw32-make.exe[1]: Entering directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\amqp_test.dir\build.make CMakeFiles/amqp_test.dir/depend
mingw32-make.exe[2]: Entering directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\Users\reine\CLionProjects\amqp-test C:\Users\reine\CLionProjects\amqp-test C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug\CMakeFiles\amqp_test.dir\DependInfo.cmake --color=
mingw32-make.exe[2]: Leaving directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\amqp_test.dir\build.make CMakeFiles/amqp_test.dir/build
mingw32-make.exe[2]: Entering directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
[ 50%] Building CXX object CMakeFiles/amqp_test.dir/main.cpp.obj
C:\MinGW\bin\g++.exe #CMakeFiles/amqp_test.dir/includes_CXX.rsp -g -std=gnu++11 -o CMakeFiles\amqp_test.dir\main.cpp.obj -c C:\Users\reine\CLionProjects\amqp-test\main.cpp
[100%] Linking CXX executable amqp_test.exe
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E cmake_link_script CMakeFiles\amqp_test.dir\link.txt --verbose=1
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E remove -f CMakeFiles\amqp_test.dir/objects.a
C:\MinGW\bin\ar.exe cr CMakeFiles\amqp_test.dir/objects.a #CMakeFiles\amqp_test.dir\objects1.rsp
C:\MinGW\bin\g++.exe -g -Wl,--whole-archive CMakeFiles\amqp_test.dir/objects.a -Wl,--no-whole-archive -o amqp_test.exe -Wl,--out-implib,libamqp_test.dll.a -Wl,--major-image-version,0,--minor-image-version,0 #CMakeFiles\amqp_test.dir\linklibs.rsp
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: CMakeFiles\amqp_test.dir/objects.a(main.cpp.obj): in function `ZN4AMQP10ConnectionC1EPNS_17ConnectionHandlerERKNS_5LoginERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE':
C:/Users/reine/vcpkg/installed/x86-windows/include/amqpcpp/connection.h:40: undefined reference to `AMQP::ConnectionImpl::ConnectionImpl(AMQP::Connection*, AMQP::ConnectionHandler*, AMQP::Login const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: CMakeFiles\amqp_test.dir/objects.a(main.cpp.obj): in function `ZN4AMQP10ConnectionD1Ev':
C:/Users/reine/vcpkg/installed/x86-windows/include/amqpcpp/connection.h:70: undefined reference to `AMQP::ConnectionImpl::~ConnectionImpl()'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\amqp_test.dir\build.make:89: recipe for target 'amqp_test.exe' failed
mingw32-make.exe[2]: Leaving directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
mingw32-make.exe[2]: *** [amqp_test.exe] Error 1
mingw32-make.exe[1]: *** [CMakeFiles/amqp_test.dir/all] Error 2
CMakeFiles\Makefile2:77: recipe for target 'CMakeFiles/amqp_test.dir/all' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
Makefile:85: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
I have a problem with CMake: A static library and an executable are made but the build process is out of order. Thus, the library does not exist when the executable tries to link. I have read similar questions but did not find a solution. My project uses one root-CMakelists.txt that includes the other two:
Root: dev/CMakeLists.txt:
# Library project
include(${CMAKE_CURRENT_SOURCE_DIR}/src_lib/CMakeLists.txt)
# Client project
include(${CMAKE_CURRENT_SOURCE_DIR}/src_client/CMakeLists.txt)
Library: dev/src_lib/CMakeLists.txt
add_library(wof_static STATIC ${LIB_SRC})
TARGET_LINK_LIBRARIES(wof_static ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/lex/libs/amd64/libLexActivator.a pthread libnss3.so /usr/lib/x86_64-linux-gnu/libssl3.so /usr/lib/x86_64-linux-gnu/libnspr4.so )
Executable: dev/src_client/CMakeLists.txt
add_executable(wof ${CLIENT_SRC})
TARGET_LINK_LIBRARIES( wof
${CMAKE_CURRENT_SOURCE_DIR}/build/libwof_static.a
${CMAKE_CURRENT_SOURCE_DIR}/src_lib/3rdParty/lex/libs/amd64/libLexActivator.a
gmp
pthread
libnss3.so
/usr/lib/x86_64-linux-gnu/libssl3.so
/usr/lib/x86_64-linux-gnu/libnspr4.so
)
The above TARGET_LINK_LIBRARIES command uses the filename libwof_static.a, and thus, the build is out of order (i.e., it works only when I call make twice). Thus, I need to let CMake know that the executable depends on the library-target wof_static, right? I tried to do so:
Executable: dev/src_client/CMakeLists.txt (variant)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/build/ ${CMAKE_CURRENT_SOURCE_DIR}/src_lib/3rdParty/lex/libs/amd64/)
add_executable(wof ${CLIENT_SRC})
TARGET_LINK_LIBRARIES( wof
wof_static
${CMAKE_CURRENT_SOURCE_DIR}/src_lib/3rdParty/lex/libs/amd64/libLexActivator.a
gmp
pthread
libnss3.so
/usr/lib/x86_64-linux-gnu/libssl3.so
/usr/lib/x86_64-linux-gnu/libnspr4.so
)
The intention of the above is to let CMake know the target name wof_static. That seems to work because the compilation of the executable wof starts when the library is ready. But I assumed that CMake would know and use the output file libwof_static.a of the target wof_static. This does not seem to be true. The error I get is:
[ 94%] Linking CXX static library libwof_static.a
/usr/local/bin/cmake -P CMakeFiles/wof_static.dir/cmake_clean_target.cmake
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/wof_static.dir/link.txt --verbose=1
/usr/bin/ar qc libwof_static.a CMakeFiles/wof_static.dir/src_lib/AngleEntry.cpp.o CMakeFiles/wof_static.dir/src_lib/CEdge.cpp.o CMakeFiles/wof_static.dir/src_lib/CMesh.cpp.o CMakeFiles/wof_static.dir/src_lib/CPatch.cpp.o CMakeFiles/wof_static.dir/src_lib/CTriangle.cpp.o CMakeFiles/wof_static.dir/src_lib/Calc.cpp.o CMakeFiles/wof_static.dir/src_lib/Casx.cpp.o CMakeFiles/wof_static.dir/src_lib/Chain.cpp.o CMakeFiles/wof_static.dir/src_lib/ChainMgr.cpp.o CMakeFiles/wof_static.dir/src_lib/Cloud.cpp.o CMakeFiles/wof_static.dir/src_lib/CloudMgr.cpp.o CMakeFiles/wof_static.dir/src_lib/Hal.cpp.o CMakeFiles/wof_static.dir/src_lib/Histogram.cpp.o CMakeFiles/wof_static.dir/src_lib/HoleFiller.cpp.o CMakeFiles/wof_static.dir/src_lib/HoleToCCD.cpp.o CMakeFiles/wof_static.dir/src_lib/Inspector.cpp.o CMakeFiles/wof_static.dir/src_lib/Iso.cpp.o CMakeFiles/wof_static.dir/src_lib/IsoStore.cpp.o CMakeFiles/wof_static.dir/src_lib/LexSample.cpp.o CMakeFiles/wof_static.dir/src_lib/Loop.cpp.o CMakeFiles/wof_static.dir/src_lib/Performance.cpp.o CMakeFiles/wof_static.dir/src_lib/Pixel.cpp.o CMakeFiles/wof_static.dir/src_lib/Plane.cpp.o CMakeFiles/wof_static.dir/src_lib/Posix.cpp.o CMakeFiles/wof_static.dir/src_lib/Rotx.cpp.o CMakeFiles/wof_static.dir/src_lib/Segment3.cpp.o CMakeFiles/wof_static.dir/src_lib/Smooth.cpp.o CMakeFiles/wof_static.dir/src_lib/Surve.cpp.o CMakeFiles/wof_static.dir/src_lib/Top.cpp.o CMakeFiles/wof_static.dir/src_lib/TopMelt.cpp.o CMakeFiles/wof_static.dir/src_lib/Vector3.cpp.o CMakeFiles/wof_static.dir/src_lib/Visualizer3.cpp.o CMakeFiles/wof_static.dir/src_lib/Voro.cpp.o CMakeFiles/wof_static.dir/src_lib/Wof.cpp.o CMakeFiles/wof_static.dir/src_lib/WofMesh.cpp.o CMakeFiles/wof_static.dir/src_lib/api.cpp.o CMakeFiles/wof_static.dir/src_lib/api_io.cpp.o CMakeFiles/wof_static.dir/src_lib/devStuff.cpp.o CMakeFiles/wof_static.dir/src_lib/freeFunctions.cpp.o CMakeFiles/wof_static.dir/src_lib/geom_locate3/Node.cpp.o CMakeFiles/wof_static.dir/src_lib/geom_locate3/RTree.cpp.o CMakeFiles/wof_static.dir/src_lib/geom_octree/OctNode.cpp.o CMakeFiles/wof_static.dir/src_lib/geom_octree/Octree.cpp.o CMakeFiles/wof_static.dir/src_lib/geom_tools/GSS_HC2.cpp.o CMakeFiles/wof_static.dir/src_lib/geom_tools/GSS_HC3.cpp.o CMakeFiles/wof_static.dir/src_lib/testDataGenerators.cpp.o CMakeFiles/wof_static.dir/src_lib/tinyply.cpp.o CMakeFiles/wof_static.dir/src_lib/tools.cpp.o
/usr/bin/ranlib libwof_static.a
make[2]: Leaving directory '/home/geom/repoWOF/dev/build'
[ 94%] Built target wof_static
make -f CMakeFiles/wof.dir/build.make CMakeFiles/wof.dir/depend
make[2]: Entering directory '/home/geom/repoWOF/dev/build'
cd /home/geom/repoWOF/dev/build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /home/geom/repoWOF/dev /home/geom/repoWOF/dev /home/geom/repoWOF/dev/build /home/geom/repoWOF/dev/build /home/geom/repoWOF/dev/build/CMakeFiles/wof.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/geom/repoWOF/dev/build'
make -f CMakeFiles/wof.dir/build.make CMakeFiles/wof.dir/build
make[2]: Entering directory '/home/geom/repoWOF/dev/build'
[ 96%] Building CXX object CMakeFiles/wof.dir/src_client/Params.cpp.o
[ 98%] Building CXX object CMakeFiles/wof.dir/src_client/main.cpp.o
make[2]: *** No rule to make target '../3rdParty/lex/libs/amd64/libLexActivator.a', needed by 'wof'. Stop.
make[2]: *** Waiting for unfinished jobs....
/usr/bin/c++ -I/home/geom/repoWOF/dev/include -O3 -DNDEBUG -std=c++11 -fstrict-aliasing -Wno-unused-local-typedefs -Wno-long-long -O3 -Wextra -Wunused -Wall -pedantic-errors -frounding-math -funroll-loops -Wl,-s -o CMakeFiles/wof.dir/src_client/Params.cpp.o -c /home/geom/repoWOF/dev/src_client/Params.cpp
/usr/bin/c++ -I/home/geom/repoWOF/dev/include -O3 -DNDEBUG -std=c++11 -fstrict-aliasing -Wno-unused-local-typedefs -Wno-long-long -O3 -Wextra -Wunused -Wall -pedantic-errors -frounding-math -funroll-loops -Wl,-s -o CMakeFiles/wof.dir/src_client/main.cpp.o -c /home/geom/repoWOF/dev/src_client/main.cpp
make[2]: Leaving directory '/home/geom/repoWOF/dev/build'
CMakeFiles/Makefile2:112: recipe for target 'CMakeFiles/wof.dir/all' failed
make[1]: *** [CMakeFiles/wof.dir/all] Error 2
make[1]: Leaving directory '/home/geom/repoWOF/dev/build'
Makefile:86: recipe for target 'all' failed
make: *** [all] Error 2
In your file dev/src_client/CMakeLists.txt, this line:
${CMAKE_CURRENT_SOURCE_DIR}/src_lib/3rdParty/lex/libs/amd64/libLexActivator.a
evaluates to the path:
dev/src_client/src_lib/3rdParty/lex/libs/amd64/libLexActivator.a
I don't think that is what you intend, as this path is different from the path you use in the dev/src_lib/CMakeLists.txt file.
Instead of CMAKE_CURRENT_SOURCE_DIR, use the CMake variable that points to the root source directory: CMAKE_SOURCE_DIR. Try something like this:
TARGET_LINK_LIBRARIES( wof
wof_static
${CMAKE_SOURCE_DIR}/src_lib/3rdParty/lex/libs/amd64/libLexActivator.a
gmp
pthread
libnss3.so
/usr/lib/x86_64-linux-gnu/libssl3.so
/usr/lib/x86_64-linux-gnu/libnspr4.so
)
My CMakeLists.txt looks something like :
cmake_minimum_required(VERSION 2.8)
if(CMAKE_BUILD_TYPE STREQUAL Release)
SET(CMAKE_BUILD_TYPE Release)
SET (PROJECT_NAME location_recognition)
message("Release mode")
else()
SET(CMAKE_BUILD_TYPE Debug)
SET (PROJECT_NAME location_recognition)
SET(CMAKE_CXX_FILES "-g -Wall")
message("Debug mode")
endif()
#find QT libraries
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(Boost REQUIRED)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# As moc files are generated in the binary dir, tell CMake
# to always look for includes there:
set(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
# We need add -DQT_WIDGETS_LIB when using QtWidgets in Qt 5.
add_definitions(${Qt5Widgets_DEFINITIONS})
SET(SRC
src/voting_classifier.cpp
src/voting_classifier_helper.cpp
src/results_scene.cpp
src/image_window_widget.cpp
src/image_result_matrix.cpp
src/location_recognition.cpp
src/main.cpp
)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
FIND_PROGRAM(QT_UIC_EXECUTABLE uic
$ENV{QTDIR}/bin
)
IF (QT_UIC_EXECUTABLE)
# SET ( QT_WRAP_UI "YES")
message("WOW")
ENDIF (QT_UIC_EXECUTABLE)
QT5_WRAP_UI(image_result_matrix.h ui_forms/image_result_matrix.ui -o ui_forms/image_result_matrix.h)
QT5_WRAP_UI(image_window_widget.h ui_forms/image_window_widget.ui -o ui_forms/image_window_widget.h)
QT5_WRAP_UI(location_recognition.h ui_forms/location_recognition.ui -o ui_forms/location_recognition.h)
QT5_WRAP_UI(ui_results_view.h ui_forms/result_view.ui -o ui_forms/ui_results_view.h)
include_directories(${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/ui_forms
${PROJECT_SOURCE_DIR}
${Qt5Widgets_INCLUDE_DIRS} ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/../perception_kit/utilities/include
${PROJECT_SOURCE_DIR}/../perception_kit/visual_categorization/include
${OpenCV_INCLUDE_DIRS})
FIND_LIBRARY(utilities NAMES libperception_kitutilities.so PATHS "/other/workspace/perception/perception_kit/utilities/lib")
FIND_LIBRARY(utilitiesd NAMES libperception_kitutilitiesd.so PATHS "/other/workspace/perception/perception_kit/utilities/lib")
message("Utilites Libs :${utilities}")
FIND_LIBRARY(visual_categorization NAMES libperception_kitvisual_categorization.so PATHS "/other/workspace/perception/perception_kit/visual_categorization/lib")
FIND_LIBRARY(visual_categorizationd NAMES libperception_kitvisual_categorizationd.so PATHS "/other/workspace/perception/perception_kit/visual_categorization/lib")
message("Visual_categorization Libs :${visual_categorization}")
SET(LINK_LIBRARY optimized ${utilities} ${visual_categorization} debug ${utilities} ${visual_categorizationd})
# set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${perception_kit_VERSION} )
add_executable(location_recognition ${SRC})
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARY}
${OpenCV_LIBS} ${Boost_LIBS})
qt5_use_modules(location_recognition Core Gui Widgets)
when i do
cmake .
it does fine. But when I try make it still says that the ui_forms/*.h header not found and it fails.
In file included from
/other/workspace/perception/location_recognition/src/results_scene.cpp:4:0:
/other/workspace/perception/location_recognition/include/perception_kit/location_recognition/results_scene.h:6:29:
fatal error: ui_results_view.h: No such file or directory compilation
terminated. make[2]: *
[CMakeFiles/location_recognition.dir/src/results_scene.cpp.o] Error 1
make[1]: * [CMakeFiles/location_recognition.dir/all] Error 2 make:
* [all] Error 2
when i do `make VERBOSE=1'
I get
/usr/local/bin/cmake -H/other/workspace/perception/location_recognition -B/other/workspace/perception/location_recognition --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /other/workspace/perception/location_recognition/CMakeFiles /other/workspace/perception/location_recognition/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/other/workspace/perception/location_recognition'
make -f CMakeFiles/location_recognition_automoc.dir/build.make CMakeFiles/location_recognition_automoc.dir/depend
make[2]: Entering directory `/other/workspace/perception/location_recognition'
cd /other/workspace/perception/location_recognition && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /other/workspace/perception/location_recognition /other/workspace/perception/location_recognition /other/workspace/perception/location_recognition /other/workspace/perception/location_recognition /other/workspace/perception/location_recognition/CMakeFiles/location_recognition_automoc.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/other/workspace/perception/location_recognition'
make -f CMakeFiles/location_recognition_automoc.dir/build.make CMakeFiles/location_recognition_automoc.dir/build
make[2]: Entering directory `/other/workspace/perception/location_recognition'
/usr/local/bin/cmake -E cmake_progress_report /other/workspace/perception/location_recognition/CMakeFiles 9
[ 11%] Automoc for target location_recognition
/usr/local/bin/cmake -E cmake_automoc /other/workspace/perception/location_recognition/CMakeFiles/location_recognition_automoc.dir/
AUTOMOC: Checking /other/workspace/perception/location_recognition/src/voting_classifier.cpp
AUTOMOC: Checking /other/workspace/perception/location_recognition/src/voting_classifier_helper.cpp
AUTOMOC: Checking /other/workspace/perception/location_recognition/src/results_scene.cpp
AUTOMOC: Checking /other/workspace/perception/location_recognition/src/image_window_widget.cpp
AUTOMOC: Checking /other/workspace/perception/location_recognition/src/image_result_matrix.cpp
AUTOMOC: Checking /other/workspace/perception/location_recognition/src/location_recognition.cpp
AUTOMOC: Checking /other/workspace/perception/location_recognition/src/main.cpp
make[2]: Leaving directory `/other/workspace/perception/location_recognition'
/usr/local/bin/cmake -E cmake_progress_report /other/workspace/perception/location_recognition/CMakeFiles 9
[ 11%] Built target location_recognition_automoc
make -f CMakeFiles/location_recognition.dir/build.make CMakeFiles/location_recognition.dir/depend
make[2]: Entering directory `/other/workspace/perception/location_recognition'
cd /other/workspace/perception/location_recognition && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /other/workspace/perception/location_recognition /other/workspace/perception/location_recognition /other/workspace/perception/location_recognition /other/workspace/perception/location_recognition /other/workspace/perception/location_recognition/CMakeFiles/location_recognition.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/other/workspace/perception/location_recognition'
make -f CMakeFiles/location_recognition.dir/build.make CMakeFiles/location_recognition.dir/build
make[2]: Entering directory `/other/workspace/perception/location_recognition'
/usr/local/bin/cmake -E cmake_progress_report /other/workspace/perception/location_recognition/CMakeFiles 3
[ 22%] Building CXX object CMakeFiles/location_recognition.dir/src/results_scene.cpp.o
/usr/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -O3 -DNDEBUG -fPIE -I/other/workspace/perception/location_recognition -I/opt/ros/fuerte/include/opencv -I/opt/ros/fuerte/include -I/other/workspace/perception/location_recognition/include -I/other/workspace/perception/location_recognition/ui_forms -I/other/Qt5.0.1/5.0.1/gcc_64/include -I/other/Qt5.0.1/5.0.1/gcc_64/include/QtWidgets -I/other/Qt5.0.1/5.0.1/gcc_64/include/QtGui -I/other/Qt5.0.1/5.0.1/gcc_64/include/QtCore -I/other/Qt5.0.1/5.0.1/gcc_64/mkspecs/linux-g++-64 -I/other/workspace/perception/location_recognition/../perception_kit/utilities/include -I/other/workspace/perception/location_recognition/../perception_kit/visual_categorization/include -o CMakeFiles/location_recognition.dir/src/results_scene.cpp.o -c /other/workspace/perception/location_recognition/src/results_scene.cpp
In file included from /other/workspace/perception/location_recognition/src/results_scene.cpp:4:0:
/other/workspace/perception/location_recognition/include/perception_kit/location_recognition/results_scene.h:6:29: fatal error: ui_results_view.h: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/location_recognition.dir/src/results_scene.cpp.o] Error 1
make[2]: Leaving directory `/other/workspace/perception/location_recognition'
make[1]: *** [CMakeFiles/location_recognition.dir/all] Error 2
make[1]: Leaving directory `/other/workspace/perception/location_recognition'
make: *** [all] Error 2
So, somehow it is either able to create the ui_form header or its not linking properly.
I spent quite sometime experimenting with QT_WRAP_UI and QT5_WRAP_UI but couldn't solve the issue.
What should change in my CMakeLists.txt to get the ui_form headers included correctly ?
You misused qt5_wrap_ui macro. According to the documentation, it has the following parameters
qt5_wrap_ui(outfiles inputfile ... OPTIONS ...)
In your example, this become:
qt5_wrap_ui(UIS_HDRS
ui_forms/image_result_matrix.ui
ui_forms/image_window_widget.ui
ui_forms/location_recognition.ui
ui_forms/ui_results_view.ui
)
The command will configure your project to process *.ui files into valid C++ ui_XXXX.h and save their path to the list named UIS_HDRS. This allows you to use them as input of a target declared later:
add_executable(location_recognition ${SRC} ${UIS_HDRS})
Note: ui_XXXX.h files are generated in the build directory ${CMAKE_CURRENT_BINARY_DIR}.