Closed khumarahn closed 5 years ago
ld: libi2pd.so: undefined reference to `boost::gregorian::greg_month::as_short_string() const'
ld: libi2pd.so: undefined reference to `boost::gregorian::greg_month::as_long_string() const'
ld: libi2pd.so: undefined reference to `boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()'
We are not using these functions. Can you try find where it come from?
Also, check if boost_date_time.a
is linking and avaliable.
Not sure where they come from either.
$ grep 'greg_month' -R .
Binary file ./i2pd-2.25.0/build/CMakeFiles/i2pd.dir/home/khu/tt/i2pd-2.25.0/daemon/I2PControl.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/NTCPSession.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/Profiling.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/Reseed.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/SSU.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/SSUData.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/SSUSession.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/Streaming.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/Destination.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/Transports.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/Datagram.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/Timestamp.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pd.dir/home/khu/tt/i2pd-2.25.0/libi2pd/NTCP2.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pdclient.dir/home/khu/tt/i2pd-2.25.0/libi2pd_client/ClientContext.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pdclient.dir/home/khu/tt/i2pd-2.25.0/libi2pd_client/AddressBook.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pdclient.dir/home/khu/tt/i2pd-2.25.0/libi2pd_client/MatchedDestination.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pdclient.dir/home/khu/tt/i2pd-2.25.0/libi2pd_client/I2PTunnel.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pdclient.dir/home/khu/tt/i2pd-2.25.0/libi2pd_client/I2PService.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pdclient.dir/home/khu/tt/i2pd-2.25.0/libi2pd_client/SAM.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pdclient.dir/home/khu/tt/i2pd-2.25.0/libi2pd_client/SOCKS.cpp.o matches
Binary file ./i2pd-2.25.0/build/CMakeFiles/libi2pdclient.dir/home/khu/tt/i2pd-2.25.0/libi2pd_client/HTTPProxy.cpp.o matches
Binary file ./i2pd-2.25.0/build/libi2pd.so matches
Binary file ./i2pd-2.25.0/build/libi2pdclient.so matches
The build completes fine if I leave out either --as-needed
or BUILD_SHARED_LIBS=ON
.
I wonder if anyone else can reproduce this on their machines. Just run the three lines in the first post.
Just tried in Ubuntu 18.04 chroot:
[ 98%] Building CXX object CMakeFiles/i2pd.dir/root/tt/i2pd/daemon/UnixDaemon.cpp.o
[100%] Linking CXX executable i2pd
libi2pd.so: undefined reference to `boost::gregorian::greg_month::as_short_string() const'
libi2pd.so: undefined reference to `crc32'
libi2pd.so: undefined reference to `inflateInit2_'
libi2pd.so: undefined reference to `deflateParams'
libi2pd.so: undefined reference to `adler32'
libi2pd.so: undefined reference to `inflate'
libi2pd.so: undefined reference to `deflateReset'
libi2pd.so: undefined reference to `deflateInit2_'
libi2pd.so: undefined reference to `boost::gregorian::greg_month::as_long_string() const'
libi2pd.so: undefined reference to `inflateReset'
libi2pd.so: undefined reference to `deflate'
libi2pd.so: undefined reference to `boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()'
libi2pd.so: undefined reference to `deflateEnd'
libi2pd.so: undefined reference to `inflateEnd'
collect2: error: ld returned 1 exit status
CMakeFiles/i2pd.dir/build.make:233: recipe for target 'i2pd' failed
make[2]: *** [i2pd] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/i2pd.dir/all' failed
make[1]: *** [CMakeFiles/i2pd.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
Так тут zlib нужен
zlib это одно, а вот почему корректно не линкуется date_time?
zlib1g-dev и zlib1g у меня поставлены
Deb8:
[ 98%] Building CXX object CMakeFiles/i2pd.dir/root/dev/PurpleI2P/i2pd/daemon/UPnP.cpp.o
[100%] Building CXX object CMakeFiles/i2pd.dir/root/dev/PurpleI2P/i2pd/daemon/UnixDaemon.cpp.o
Linking CXX executable i2pd
[100%] Built target i2pd
а какая версия компилятора в дебиане 8?
# gcc -v
...
gcc version 4.9.2 (Debian 4.9.2-10+deb8u2)
о, жесть. Там наверное ещё нет as-needed?
возможно
Я поставил дебиан stable c gcc-6.3. Там ошибка воспроизводится как в убунте:
[100%] Linking CXX executable i2pd
libi2pd.so: undefined reference to `boost::gregorian::greg_month::as_short_string() const'
libi2pd.so: undefined reference to `crc32'
libi2pd.so: undefined reference to `inflateInit2_'
libi2pd.so: undefined reference to `deflateParams'
libi2pd.so: undefined reference to `adler32'
libi2pd.so: undefined reference to `inflate'
libi2pd.so: undefined reference to `deflateReset'
libi2pd.so: undefined reference to `deflateInit2_'
libi2pd.so: undefined reference to `boost::gregorian::greg_month::as_long_string() const'
libi2pd.so: undefined reference to `inflateReset'
libi2pd.so: undefined reference to `deflate'
libi2pd.so: undefined reference to `boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()'
libi2pd.so: undefined reference to `deflateEnd'
libi2pd.so: undefined reference to `inflateEnd'
collect2: error: ld returned 1 exit status
A solution might be to link libi2pd against boost and zlib:
diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt
index e50bbc86..949f6a46 100644
--- a/build/CMakeLists.txt
+++ b/build/CMakeLists.txt
@@ -470,6 +470,7 @@ if (WITH_BINARY)
if (WITH_STATIC)
set(DL_LIB ${CMAKE_DL_LIBS})
endif()
+ target_link_libraries(libi2pd ${Boost_LIBRARIES} ${ZLIB_LIBRARY})
target_link_libraries( "${PROJECT_NAME}" libi2pd libi2pdclient ${DL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MINGW_EXTRA} ${DL_LIB} ${CMAKE_REQUIRED_LIBRARIES})
install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime)
по крайней мере, так оно собирается и под гентой, и под дебианом
Так что насчёт включения target_link_libraries(libi2pd ${Boost_LIBRARIES} ${ZLIB_LIBRARY})
в CMakeLists.txt? Я мало понимаю в линковке, но вроде это то что надо, чтобы решить проблему с --as-needed.
Так поправь. Я в cmake-е это мало что понимаю
Отлично, спасибо!
Hi!
fails with
This came up in bumping gentoo ebuild to the new EAPI, https://github.com/gentoo/gentoo/pull/11998