c - CMAKE cross compile libraries are not found -


i'm having strange problems cmake cross-compiler projects.

my own libraries found not (system) libraries toolchain.

previously using kdevelop on debian squeeze machine. on new machine debian wheezy configuring fails. not find system libraries m or pthread.

on old machine following working perfectly, not remember did special make work.

here 1 of cmakelists.txt files

cmake_minimum_required(version 2.8) set(cmake_system_name linux) set(cmake_system_version 2.6.36.4) set(cmake_c_compiler arm-angstrom-linux-gnueabi-gcc) set(cmake_cxx_compiler arm-angstrom-linux-gnueabi-g++) include_directories(../include   ../../../sample/include)  project(testmain)  add_executable(testmain    some_c-source-file.c)  set(cmake_library_path ../lib/arm-26/lib   ../../../sample/lib/arm-26/lib) find_library(libs_test names akku) find_library(libs_m names m) find_library(libs_pthread names pthread ) target_link_libraries(akkumain   ${libs_test}   ${libs_m}   ${libs_pthread})  set(cmake_c_flags "-wall -werror") set(cmake_c_flags_debug "-g3 -o2 -rdynamic") set(cmake_c_flags_release "-g0 -o0") set(cmake_cxx_flags "-wall -werror") set(cmake_cxx_flags_debug "-g3 -o2 -rdynamic") set(cmake_cxx_flags_release "-g0 -o0") 

this message displayed when trying compile using kdevelop: (to repeat myself: working on old machine)

/home/user/testmain/build> /usr/bin/cmake -dcmake_build_type=debug /home/user/testmain/ -- c compiler identification gnu 4.3.3 -- cxx compiler identification gnu 4.3.3 -- check working c compiler: /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc -- check working c compiler: /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc -- works -- detecting c compiler abi info -- detecting c compiler abi info - done -- check working cxx compiler: /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-g++ -- check working cxx compiler: /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-g++ -- works -- detecting cxx compiler abi info -- detecting cxx compiler abi info - done  cmake error: following variables used in project, set notfound. please set them or make sure set , tested correctly in cmake files: libs_m     linked target "akkumain" in directory /home/user/testmain libs_pthread     linked target "akkumain" in directory /home/user/testmain 

so libs_test found. not libm or libpthread. tried different projects: of libraries found, none of "system" libraries.

i tried different things

set(cmake_find_library_prefixes lib ) set(cmake_find_library_suffixes .a ) 

and more things not remember.

the thing working when specify directory manually:

find_library(astlibs_m names m paths /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib) 

after specifying cmakelists.txt library found , can compile project without errors.

but: not want, because have lot of projects , many libraries , don't want edit cmakelists.txt... :(

does know made old machine find system-libs without specifying special inside ide/cmake files?

edit: i noticed 1 of executables on linker stage throws errors cannot find symbols glibc - seems there more wrong debian wheezy system. - hope can figure out...

edit:

maybe should give short summary: code compiles well, libraries toolchain not found, if add path libs of toolchain manually compiles fails on linker stage.

there default paths cmake's find_library module searches. if system libs on old machine happen located in 1 such place, found without additional work needing done.

however, new machine's path these libs seems "/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib", you'll need tell cmake this.

one such way, have shown (adding path explicitly). in case, path specific machine - you'd better set path when invoke cmake on machine. can add cmake_prefix_path example:

cmake . -dcmake_prefix_path=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr 

(note: path in case "lib" appended when find_library called).

or if want affect find_library search paths, , not all find_xxx modules, set cmake_library_path

cmake . -dcmake_library_path=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -