Cmake_link_script

broken image


So I tuned up verbosity on the make files produced by cmake and shut of cmake rule messages (by adding -DCMAKERULEMESSAGES:BOOL=OFF -DCMAKEVERBOSEMAKEFILE:BOOL=ON to the cmake call). In this chapter we start by installing CMake. Like most open source software the best way to do this depends on your platform and how you usually do things. Once we have CMake installed we create a simple project. Perhaps it's a little fancier than 'hello world' but not much. We finish up with the Continue reading 'CMake Tutorial – Chapter 1: Getting Started'. Ld: building for iOS simulator, but linking against dylib built for OSX, file '/usr/lib/libSystem.dylib' for architecture x8664. When trying to learn CMake I could not find any good introduction. The CMake documentation is quite comprehensive but not suitable for a beginner. There are some useful tutorials linked on the CMake.

The plugin libraries are loaded by the application at run time. 'xcb' is a platform plugin for GNU/Linux. You may need others depending on your application.

CMakeLists.txt
project(foo)
SET(CMAKE_EXE_LINKER_FLAGS -static)
# add ZeroMQ library
add_library(imp_zeromq STATICIMPORTED)
set_property(TARGET imp_zeromq PROPERTY
IMPORTED_LOCATION$ENV{ZEROMQ_HOME}/libzmq.a)
# add C bindings for ZeroMQ library
add_library(imp_zeromq STATICIMPORTED)
set_property(TARGET imp_czmq PROPERTY
IMPORTED_LOCATION$ENV{CZMQ_HOME}/libczmq.a)
add_library(Config ./Config/Config.c ./Config.minIni.c)
add_library(Comm ./Comm/Comm.c)
add_executable(Runtime Runtime.cpp)
target_link_libraries(Runtime imp_zeromq imp_czmq ${CMAKE_THREAD_LIBS_INIT} rt Comm Config)
Cmake libraries
Make output
------------- Failure on Ubuntu 12.04 ----------------
make -f src/CMakeFiles/Runtime.dir/build.make src/CMakeFiles/Runtime.dir/depend
make[2]: Entering directory `/home/davis/git/firmware/build'
cd /home/davis/git/firmware/build && /usr/bin/cmake -E cmake_depends 'Unix Makefiles'
/home/davis/git/firmware /home/davis/git/firmware/src /home/davis/git/firmware/build
/home/davis/git/firmware/build/src /home/davis/git/firmware/build/src/CMakeFiles/Runtime.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/davis/git/firmware/build'
make -f src/CMakeFiles/Runtime.dir/build.make src/CMakeFiles/Runtime.dir/build
make[2]: Entering directory `/home/davis/git/firmware/build'
Linking CXX executable ../bin/Runtime
cd /home/davis/git/firmware/build/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/Runtime.dir/link.txt --verbose=1
/usr/bin/c++ -static CMakeFiles/Runtime.dir/Runtime.cpp.o -o ../bin/Runtime
-rdynamic /usr/local/lib/libzmq.a /usr/local/lib/libczmq.a -lpthread -lrt ../lib/libComm.a ../lib/libConfig.a
../lib/libComm.a(Comm.c.o): In function `Comm_Create':
Comm.c:(.text+0x42): undefined reference to `zctx_new'
Comm.c:(.text+0x5c): undefined reference to `zsocket_new'
collect2: ld returned 1 exit status
make[2]: *** [bin/Runtime] Error 1
make[2]: Leaving directory `/home/davis/git/firmware/build'
make[1]: *** [src/CMakeFiles/Runtime.dir/all] Error 2
make[1]: Leaving directory `/home/davis/git/firmware/build'
make: *** [all] Error 2
------------ Success on Mac OS X ------------------
make -f src/CMakeFiles/Runtime.dir/build.make src/CMakeFiles/Runtime.dir/depend
cd /Users/davis/git/firmware/build && /usr/local/Cellar/cmake/2.8.9/bin/cmake -E cmake_depends 'Unix Makefiles'
/Users/davis/git/firmware /Users/davis/git/firmware/src /Users/davis/git/firmware/build /Users/davis/git/firmware/build/src
/Users/davis/git/firmware/build/src/CMakeFiles/Runtime.dir/DependInfo.cmake --color=
make -f src/CMakeFiles/Runtime.dir/build.make src/CMakeFiles/Runtime.dir/build
/usr/local/Cellar/cmake/2.8.9/bin/cmake -E cmake_progress_report /Users/davis/git/firmware/build/CMakeFiles 7
[ 50%] Building CXX object src/CMakeFiles/Runtime.dir/Runtime.cpp.o
cd /Users/davis/git/firmware/build/src && /usr/bin/c++ -I/Users/davis/git/firmware/src/../include
-I/Users/davis/git/firmware/src/../include/LedDriver -I/usr/local/Cellar/msgpack/0.5.7/include
-o CMakeFiles/Runtime.dir/Runtime.cpp.o -c /Users/davis/git/firmware/src/Runtime.cpp
Linking CXX executable ../bin/Runtime
cd /Users/davis/git/firmware/build/src && /usr/local/Cellar/cmake/2.8.9/bin/cmake -E cmake_link_script CMakeFiles/Runtime.dir/link.txt --verbose=1
/usr/bin/c++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/Runtime.dir/Runtime.cpp.o -o ../bin/Runtime
-L/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64
-L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64
-L/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1
-L/usr/llvm-gcc-4.2/lib/gcc
-L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1
-L/usr/llvm-gcc-4.2/lib -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib
../lib/libComm.a ../lib/libConfig.a /usr/local/lib/libzmq.a /usr/local/lib/libczmq.a
/usr/local/Cellar/cmake/2.8.9/bin/cmake -E cmake_progress_report /Users/davis/git/firmware/build/CMakeFiles 7
[ 50%] Built target Runtime
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Cmake_link_script
Jul 31st, 2016
Never
Not a member of Pastebin yet?Sign Up, it unlocks many cool features!
Cmake_link_script
Make output
------------- Failure on Ubuntu 12.04 ----------------
make -f src/CMakeFiles/Runtime.dir/build.make src/CMakeFiles/Runtime.dir/depend
make[2]: Entering directory `/home/davis/git/firmware/build'
cd /home/davis/git/firmware/build && /usr/bin/cmake -E cmake_depends 'Unix Makefiles'
/home/davis/git/firmware /home/davis/git/firmware/src /home/davis/git/firmware/build
/home/davis/git/firmware/build/src /home/davis/git/firmware/build/src/CMakeFiles/Runtime.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/davis/git/firmware/build'
make -f src/CMakeFiles/Runtime.dir/build.make src/CMakeFiles/Runtime.dir/build
make[2]: Entering directory `/home/davis/git/firmware/build'
Linking CXX executable ../bin/Runtime
cd /home/davis/git/firmware/build/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/Runtime.dir/link.txt --verbose=1
/usr/bin/c++ -static CMakeFiles/Runtime.dir/Runtime.cpp.o -o ../bin/Runtime
-rdynamic /usr/local/lib/libzmq.a /usr/local/lib/libczmq.a -lpthread -lrt ../lib/libComm.a ../lib/libConfig.a
../lib/libComm.a(Comm.c.o): In function `Comm_Create':
Comm.c:(.text+0x42): undefined reference to `zctx_new'
Comm.c:(.text+0x5c): undefined reference to `zsocket_new'
collect2: ld returned 1 exit status
make[2]: *** [bin/Runtime] Error 1
make[2]: Leaving directory `/home/davis/git/firmware/build'
make[1]: *** [src/CMakeFiles/Runtime.dir/all] Error 2
make[1]: Leaving directory `/home/davis/git/firmware/build'
make: *** [all] Error 2
------------ Success on Mac OS X ------------------
make -f src/CMakeFiles/Runtime.dir/build.make src/CMakeFiles/Runtime.dir/depend
cd /Users/davis/git/firmware/build && /usr/local/Cellar/cmake/2.8.9/bin/cmake -E cmake_depends 'Unix Makefiles'
/Users/davis/git/firmware /Users/davis/git/firmware/src /Users/davis/git/firmware/build /Users/davis/git/firmware/build/src
/Users/davis/git/firmware/build/src/CMakeFiles/Runtime.dir/DependInfo.cmake --color=
make -f src/CMakeFiles/Runtime.dir/build.make src/CMakeFiles/Runtime.dir/build
/usr/local/Cellar/cmake/2.8.9/bin/cmake -E cmake_progress_report /Users/davis/git/firmware/build/CMakeFiles 7
[ 50%] Building CXX object src/CMakeFiles/Runtime.dir/Runtime.cpp.o
cd /Users/davis/git/firmware/build/src && /usr/bin/c++ -I/Users/davis/git/firmware/src/../include
-I/Users/davis/git/firmware/src/../include/LedDriver -I/usr/local/Cellar/msgpack/0.5.7/include
-o CMakeFiles/Runtime.dir/Runtime.cpp.o -c /Users/davis/git/firmware/src/Runtime.cpp
Linking CXX executable ../bin/Runtime
cd /Users/davis/git/firmware/build/src && /usr/local/Cellar/cmake/2.8.9/bin/cmake -E cmake_link_script CMakeFiles/Runtime.dir/link.txt --verbose=1
/usr/bin/c++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/Runtime.dir/Runtime.cpp.o -o ../bin/Runtime
-L/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64
-L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64
-L/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1
-L/usr/llvm-gcc-4.2/lib/gcc
-L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1
-L/usr/llvm-gcc-4.2/lib -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib
../lib/libComm.a ../lib/libConfig.a /usr/local/lib/libzmq.a /usr/local/lib/libczmq.a
/usr/local/Cellar/cmake/2.8.9/bin/cmake -E cmake_progress_report /Users/davis/git/firmware/build/CMakeFiles 7
[ 50%] Built target Runtime
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Jul 31st, 2016
Never
Not a member of Pastebin yet?Sign Up, it unlocks many cool features!
  1. CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
  2. The C compiler '/usr/bin/i686-w64-mingw32-gcc' is not able to compile a
  3. Change Dir: /home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp
  4. Run Build Command:'/usr/bin/make' 'cmTC_9b6e7/fast'
  5. /usr/bin/make -f CMakeFiles/cmTC_9b6e7.dir/build.make
  6. '/home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp'
  7. Building C object CMakeFiles/cmTC_9b6e7.dir/testCCompiler.c.o
  8. /usr/bin/i686-w64-mingw32-gcc -o
  9. /home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp/testCCompiler.c
  10. Linking C executable cmTC_9b6e7
  11. /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9b6e7.dir/link.txt
  12. /usr/bin/i686-w64-mingw32-gcc CMakeFiles/cmTC_9b6e7.dir/testCCompiler.c.o
  13. i686-w64-mingw32-gcc: error: unrecognized command line option
  14. CMakeFiles/cmTC_9b6e7.dir/build.make:97: recipe for target 'cmTC_9b6e7'
  15. '/home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp'
  16. Makefile:126: recipe for target 'cmTC_9b6e7/fast' failed
  17. make: *** [cmTC_9b6e7/fast] Error 2
  18. set(CMAKE_SYSTEM_NAME Generic)
  19. set(CMAKE_CROSSCOMPILING 1)
  20. set(CMAKE_C_COMPILER_WORKS 1)
  21. set(TOOLCHAIN_PREFIX i686-w64-mingw32)
  22. # cross compilers to use for C and C++
  23. set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
  24. set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
  25. # target environment on the build host system
  26. # set 1st to dir with the cross compiler's C/C++ headers/libs
  27. set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
  28. # modify default behavior of FIND_XXX() commands to
  29. # search for headers/libs in the target environment and
  30. # search for programs in the build host environment
  31. set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
RAW Paste Data

Cmake_link_script

CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler '/usr/bin/i686-w64-mingw32-gcc' is not able to compile a simple test program. It fails with the following output: Change Dir: /home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp Run Build Command:'/usr/bin/make' 'cmTC_9b6e7/fast' /usr/bin/make -f CMakeFiles/cmTC_9b6e7.dir/build.make CMakeFiles/cmTC_9b6e7.dir/build make[1]: Entering directory '/home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_9b6e7.dir/testCCompiler.c.o /usr/bin/i686-w64-mingw32-gcc -o CMakeFiles/cmTC_9b6e7.dir/testCCompiler.c.o -c /home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp/testCCompiler.c Linking C executable cmTC_9b6e7 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9b6e7.dir/link.txt --verbose=1 /usr/bin/i686-w64-mingw32-gcc CMakeFiles/cmTC_9b6e7.dir/testCCompiler.c.o -o cmTC_9b6e7 -rdynamic i686-w64-mingw32-gcc: error: unrecognized command line option ‘-rdynamic' CMakeFiles/cmTC_9b6e7.dir/build.make:97: recipe for target 'cmTC_9b6e7' failed make[1]: *** [cmTC_9b6e7] Error 1 make[1]: Leaving directory '/home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp' Makefile:126: recipe for target 'cmTC_9b6e7/fast' failed make: *** [cmTC_9b6e7/fast] Error 2 set(CMAKE_SYSTEM_NAME Generic)set(CMAKE_SYSTEM_PROCESSOR i686)set(CMAKE_CROSSCOMPILING 1)set(CMAKE_C_COMPILER_WORKS 1)set(TOOLCHAIN_PREFIX i686-w64-mingw32)# cross compilers to use for C and C++set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)# target environment on the build host system# set 1st to dir with the cross compiler's C/C++ headers/libsset(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})# modify default behavior of FIND_XXX() commands to# search for headers/libs in the target environment and# search for programs in the build host environmentset(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)



broken image