Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build on PowerPC breaks at linking stage #285

Closed
kkostyan opened this issue Nov 1, 2015 · 7 comments
Closed

Build on PowerPC breaks at linking stage #285

kkostyan opened this issue Nov 1, 2015 · 7 comments

Comments

@kkostyan
Copy link

kkostyan commented Nov 1, 2015

I try to build i2pd 0.10.0 for powerpc 32bit arch

# lscpu
Architecture:          ppc
CPU op-mode(s):        32-bit
Byte Order:            Big Endian

and it stops at linking stage with following message:

Linking CXX executable ../i2pd
../libi2pd-core.a(Transports.cpp.o): In function `i2p::transport::Transports::UpdateBandwidth()':
Transports.cpp:(.text+0x234): undefined reference to `__atomic_load_8'
Transports.cpp:(.text+0x248): undefined reference to `__atomic_load_8'
Transports.cpp:(.text+0x298): undefined reference to `__atomic_load_8'
Transports.cpp:(.text+0x2dc): undefined reference to `__atomic_load_8'
../libi2pd-core.a(NTCPSession.cpp.o): In function `i2p::transport::NTCPSession::HandleReceived(boost::system::error_code const&, unsigned int)':
NTCPSession.cpp:(.text+0x3d90): undefined reference to `__atomic_fetch_add_8'
../libi2pd-core.a(NTCPSession.cpp.o): In function `i2p::transport::NTCPSession::HandleSent(boost::system::error_code const&, unsigned int, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)':
NTCPSession.cpp:(.text+0x894c): undefined reference to `__atomic_fetch_add_8'
../libi2pd-core.a(SSUSession.cpp.o): In function `i2p::transport::SSUSession::Send(unsigned char const*, unsigned int)':
SSUSession.cpp:(.text+0x344): undefined reference to `__atomic_fetch_add_8'
../libi2pd-core.a(SSUSession.cpp.o): In function `i2p::transport::SSUSession::ProcessNextMessage(unsigned char*, unsigned int, boost::asio::ip::basic_endpoint<boost::asio::ip::udp> const&)':
SSUSession.cpp:(.text+0x6420): undefined reference to `__atomic_fetch_add_8'
collect2: error: ld returned 1 exit status
client/CMakeFiles/i2pd-client.dir/build.make:396: ошибка выполнения рецепта для цели «i2pd»
make[2]: *** [i2pd] Ошибка 1
CMakeFiles/Makefile2:142: ошибка выполнения рецепта для цели «client/CMakeFiles/i2pd-client.dir/all»
make[1]: *** [client/CMakeFiles/i2pd-client.dir/all] Ошибка 2
Makefile:117: ошибка выполнения рецепта для цели «all»
make: *** [all] Ошибка 2

adding -latomic to linker flags solves this problem.

Linking CXX executable ../i2pd
[100%] Built target i2pd-client

Could you add checking if arch supports __atomic_load_8 or __atomic_fetch_add_8 function, and link to libatomic if not.

@orignal
Copy link
Contributor

orignal commented Nov 23, 2015

Linux or Mac OS X?

@mlt
Copy link
Contributor

mlt commented Nov 23, 2015

It might help if you could pastebin your ./CMakeFiles//CMakeCXXCompiler.cmake and post a link here or mail it. I wonder if we can narrow it down to platform and/or compiler maybe just check CMAKE_CXX_COMPILER_ID for (Apple)Clang.

@orignal
Copy link
Contributor

orignal commented Nov 23, 2015

I doubt if there is clang for Mac OS X PPC since last one is 10.4

@kkostyan
Copy link
Author

This is a Linux box running Debian 8.0 / Linux 2.6.32.
The contets of CMakeCXXCompiler.cmake could be found at http://pastebin.com/F3BANaed

@mlt
Copy link
Contributor

mlt commented Nov 24, 2015

@kkostyan Do you think it would work otherwise? Like checking for libatomic presence and it having that function and linking against it? It seems like that's what I saw in llvm patch check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC). I would assume there is no libatomic on platforms having it natively so it is probably safe.

@majestrate
Copy link
Contributor

i had a similar problem when building for MIPS, temp solution was to add -latomic to link flags.

@barracuda156
Copy link
Contributor

Trying to make it work for Darwin PPC: #1726 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants