Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.46k stars 3.42k forks source link

make fails on "Linking CXX static library libOSRM.a" #1253

Closed awakse closed 9 years ago

awakse commented 10 years ago

Hi, the make script fails when linking CXX static library libOSRM.a

This is on a 64-bit CentOS 6 system. I recently updated to c/c++ 4.9.2, compiled from source. I have made successful OSRM builds on this machine before with 4.7.2. Any idea on what might be wrong?

Below is the output from my cmake and make commands.

[root@search188 build]# cmake ..
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/local/bin/gcc
-- Check for working C compiler: /usr/local/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/local/bin/c++
-- Check for working CXX compiler: /usr/local/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Building on a 64 bit system
-- Configuring OSRM in release mode
-- Performing Test HAS_LTO_FLAG
-- Performing Test HAS_LTO_FLAG - Success
-- Using gcc specific binutils for LTO.
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   date_time
--   filesystem
--   iostreams
--   program_options
--   regex
--   system
--   thread
--   unit_test_framework
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found Intel TBB
-- Looking for Luabind...
-- Found Luabind: /usr/local/lib/libluabind.so  
-- Found Luabind: /usr/local/lib/libluabind.so
-- Luabind debug library availible: /usr/local/lib/libluabindd.so
-- Found Lua52: /usr/lib64/liblua.so;/usr/lib64/libm.so (found version "5.1.4") 
-- Looking for LuaJIT 5.2
-- Could NOT find LUAJIT (missing:  LUAJIT_LIBRARIES) 
-- Performing Test LUABIND_WORKS
-- Performing Test LUABIND_WORKS - Success
-- Luabind/Lua5.2 combination working with /usr/lib64/liblua.so
-- Found LibXml2: /usr/lib64/libxml2.so (found version "2.7.6") 
-- Looking for STXXL...
-- Found STXXL: /usr/lib64/libstxxl.so  
-- Found STXXL: /usr/lib64/libstxxl.so
-- Looking for OSMPBF...
-- Found OSMPBF: /usr/local/lib/libosmpbf.a  
-- Found OSMPBF: /usr/local/lib/libosmpbf.a
-- Found PROTOBUF: /usr/lib64/libprotobuf.so  
-- Found BZip2: /usr/lib64/libbz2.so (found version "1.0.5") 
-- Looking for BZ2_bzCompressInit in /usr/lib64/libbz2.so
-- Looking for BZ2_bzCompressInit in /usr/lib64/libbz2.so - found
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.3") 
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/osrm-backend/build
[root@search188 build]# make
Scanning dependencies of target COORDINATE
[  2%] Building CXX object CMakeFiles/COORDINATE.dir/DataStructures/Coordinate.cpp.o
[  2%] Built target COORDINATE
Scanning dependencies of target FingerPrintConfigure
[  5%] Configuring FingerPrint.cpp
[  5%] Built target FingerPrintConfigure
Scanning dependencies of target FINGERPRINT
[  8%] Configuring FingerPrint.cpp
[ 11%] Building CXX object CMakeFiles/FINGERPRINT.dir/Util/FingerPrint.cpp.o
[ 11%] Built target FINGERPRINT
Scanning dependencies of target GITDESCRIPTION
[ 13%] Building CXX object CMakeFiles/GITDESCRIPTION.dir/Util/GitDescription.cpp.o
[ 13%] Built target GITDESCRIPTION
Scanning dependencies of target IMPORT
[ 16%] Building CXX object CMakeFiles/IMPORT.dir/DataStructures/ImportNode.cpp.o
[ 19%] Building CXX object CMakeFiles/IMPORT.dir/DataStructures/ImportEdge.cpp.o
[ 19%] Built target IMPORT
Scanning dependencies of target LOGGER
[ 22%] Building CXX object CMakeFiles/LOGGER.dir/Util/simple_logger.cpp.o
[ 22%] Built target LOGGER
Scanning dependencies of target OSRM
[ 25%] Building CXX object CMakeFiles/OSRM.dir/Library/OSRM_impl.cpp.o
[ 27%] Building CXX object CMakeFiles/OSRM.dir/Descriptors/DescriptionFactory.cpp.o
[ 30%] Building CXX object CMakeFiles/OSRM.dir/DataStructures/SearchEngineData.cpp.o
[ 33%] Building CXX object CMakeFiles/OSRM.dir/DataStructures/RouteParameters.cpp.o
[ 36%] Building CXX object CMakeFiles/OSRM.dir/DataStructures/Coordinate.cpp.o
[ 38%] Building CXX object CMakeFiles/OSRM.dir/Algorithms/PolylineCompressor.cpp.o
[ 41%] Building CXX object CMakeFiles/OSRM.dir/Algorithms/DouglasPeucker.cpp.o
[ 44%] Building CXX object CMakeFiles/OSRM.dir/Server/Http/Reply.cpp.o
Linking CXX static library libOSRM.a
Error running link command: No such file or directory
make[2]: *** [libOSRM.a] Error 2
make[1]: *** [CMakeFiles/OSRM.dir/all] Error 2
make: *** [all] Error 2
[root@search188 build]#
DennisOSRM commented 10 years ago

did you clear the build directory after upgrading?

awakse commented 10 years ago

Yes, this is in a fresh clone of the master branch.

awakse commented 10 years ago

Do I need to rebuild any other libraries with the new compiler?

DennisOSRM commented 10 years ago

It should work without rebuilding. The error message Error running link command: No such file or directory is a bit puzzling. Looks like it doesn't find the linker tool.

TheMarex commented 10 years ago

Is this still an issue? Try running "make VERBOSE=1" and post the output here.

awakse commented 10 years ago

It compiled alright on a different machine, but it's still an issue on this machine. I made small progress by watching the output from "make VERBOSE=1", it said that it couldn't find gcc-ar, so I fixed a symbolic link for that. Now the output is

Linking CXX static library libOSRM.a
/usr/bin/cmake -P CMakeFiles/OSRM.dir/cmake_clean_target.cmake
/usr/bin/cmake -E cmake_link_script CMakeFiles/OSRM.dir/link.txt --verbose=1
/usr/bin/gcc-ar cr libOSRM.a  CMakeFiles/OSRM.dir/Library/OSRM_impl.cpp.o CMakeFiles/OSRM.dir/Descriptors/DescriptionFactory.cpp.o CMakeFiles/OSRM.dir/DataStructures/SearchEngineData.cpp.o CMakeFiles/OSRM.dir/DataStructures/RouteParameters.cpp.o CMakeFiles/OSRM.dir/DataStructures/Coordinate.cpp.o CMakeFiles/OSRM.dir/Algorithms/PolylineCompressor.cpp.o CMakeFiles/OSRM.dir/Algorithms/DouglasPeucker.cpp.o CMakeFiles/OSRM.dir/Server/Http/Reply.cpp.o CMakeFiles/GITDESCRIPTION.dir/Util/GitDescription.cpp.o CMakeFiles/FINGERPRINT.dir/Util/FingerPrint.cpp.o CMakeFiles/COORDINATE.dir/DataStructures/Coordinate.cpp.o CMakeFiles/LOGGER.dir/Util/simple_logger.cpp.o
sorry - this program has been built without plugin support
make[2]: *** [libOSRM.a] Error 1
make[2]: Leaving directory `/opt/osrm-backend/build'
make[1]: *** [CMakeFiles/OSRM.dir/all] Error 2
make[1]: Leaving directory `/opt/osrm-backend/build'
make: *** [all] Error 2

Looks like my version of gcc-ar is the problem. When just doing gcc-ar --version I get the same output "sorry - this program has been built without plugin support". Any ideas on how to proceed?

TheMarex commented 10 years ago

Might be that you also need a recent version of binutils (which should contain ar and ld). As far as I know, gcc-ar uses ar but tries to insert a plug-in. Hence the error. Maybe try to disable LTO in CMakeLists.txt, then it should also work for older linker versions.

awakse commented 9 years ago

Back at it again... It was my old version of gcc-ar that was the problem. Thanks for the help!

This led me to another problem, but that's another thread.

DennisOSRM commented 9 years ago

Thanks for the feedback.

zgz757183190 commented 8 years ago

Linking CXX static library libinnobase_embedded.a [ 40%] Built target innobase_embedded Scanning dependencies of target blackhole [ 40%] Building CXX object storage/blackhole/CMakeFiles/blackhole.dir/ha_blackhole.cc.o In file included from /usr/local/mysql-5.6.12/sql/sql_plugin.h:34:0, from /usr/local/mysql-5.6.12/sql/structs.h:23, from /usr/local/mysql-5.6.12/sql/unireg.h:170, from /usr/local/mysql-5.6.12/storage/blackhole/ha_blackhole.cc:19: /usr/local/mysql-5.6.12/sql/field.h: 在成员函数‘void Field_blob::store_ptr_andlength(const char, uint32)’中: /usr/local/mysql-5.6.12/sql/field.h:3268:50: 警告:argument to ‘sizeof’ in ‘void memmove(void, const void_, sizet)’ call is the same pointer type ‘char’ as the source; expected ‘char’ or an explicit length [-Wsizeof-pointer-memaccess] bmove(ptr + packlength, (char) &from, sizeof(char )); ^ /usr/local/mysql-5.6.12/include/m_string.h:52:45: 附注:in definition of macro ‘bmove’

define bmove(d, s, n) memmove((d), (s), (n))

                                         ^

Linking CXX static library libblackhole.a [ 40%] Built target blackhole Scanning dependencies of target blackhole_embedded [ 40%] Building CXX object storage/blackhole/CMakeFiles/blackhole_embedded.dir/ha_blackhole.cc.o In file included from /usr/local/mysql-5.6.12/sql/sql_plugin.h:34:0, from /usr/local/mysql-5.6.12/sql/structs.h:23, from /usr/local/mysql-5.6.12/sql/unireg.h:170, from /usr/local/mysql-5.6.12/storage/blackhole/ha_blackhole.cc:19: /usr/local/mysql-5.6.12/sql/field.h: 在成员函数‘void Field_blob::store_ptr_andlength(const char, uint32)’中: /usr/local/mysql-5.6.12/sql/field.h:3268:50: 警告:argument to ‘sizeof’ in ‘void* memmove(void, const void, sizet)’ call is the same pointer type ‘char’ as the source; expected ‘char’ or an explicit length [-Wsizeof-pointer-memaccess] bmove(ptr + packlength, (char) &from, sizeof(char )); ^ /usr/local/mysql-5.6.12/include/m_string.h:52:45: 附注:in definition of macro ‘bmove’

define bmove(d, s, n) memmove((d), (s), (n))

                                         ^

Linking CXX static library libblackhole_embedded.a [ 40%] Built target blackhole_embedded Scanning dependencies of target gen_lex_hash [ 40%] Building CXX object sql/CMakeFiles/gen_lex_hash.dir/gen_lex_hash.cc.o Linking CXX executable gen_lex_hash [ 40%] Built target gen_lex_hash Scanning dependencies of target GenServerSource [ 40%] Generating lex_hash.h [ 40%] Built target GenServerSource Scanning dependencies of target gen_pfs_lex_token [ 40%] Building CXX object storage/perfschema/CMakeFiles/gen_pfs_lex_token.dir/gen_pfs_lex_token.cc.o Linking CXX executable gen_pfs_lex_token [ 40%] Built target gen_pfs_lex_token [ 40%] Generating pfs_lex_token.h Scanning dependencies of target perfschema [ 40%] Building CXX object storage/perfschema/CMakeFiles/perfschema.dir/cursor_by_account.cc.o In file included from /usr/local/mysql-5.6.12/sql/sql_plugin.h:34:0, from /usr/local/mysql-5.6.12/sql/structs.h:23, from /usr/local/mysql-5.6.12/sql/unireg.h:170, from /usr/local/mysql-5.6.12/sql/sql_class.h:23, from /usr/local/mysql-5.6.12/sql/sql_acl.h:21, from /usr/local/mysql-5.6.12/storage/perfschema/pfs_engine_table.h:19, from /usr/local/mysql-5.6.12/storage/perfschema/cursor_by_account.h:24, from /usr/local/mysql-5.6.12/storage/perfschema/cursor_by_account.cc:22: /usr/local/mysql-5.6.12/sql/field.h: 在成员函数‘void Field_blob::store_ptr_andlength(const char, uint32)’中: /usr/local/mysql-5.6.12/sql/field.h:3268:50: 警告:argument to ‘sizeof’ in ‘void* memmove(void, const void, sizet)’ call is the same pointer type ‘char’ as the source; expected ‘char’ or an explicit length [-Wsizeof-pointer-memaccess] bmove(ptr + packlength, (char_) &from, sizeof(char *)); ^ /usr/local/mysql-5.6.12/include/m_string.h:52:45: 附注:in definition of macro ‘bmove’

define bmove(d, s, n) memmove((d), (s), (n))

zgz757183190 commented 8 years ago

can you help me ? i need you help man !

daniel-j-h commented 8 years ago

I fail to see how this is by any means related to OSRM or libosrm. If you think you're hitting an OSRM issue, please open a separate ticket, post more details and show us how it relates to OSRM.