td icon indicating copy to clipboard operation
td copied to clipboard

Rpi4, Time.cpp:(.text._ZN2td4Time3nowEv+0x28): undefined reference to `__atomic_load_8' - -latomic missing in link.txt

Open denimjeans opened this issue 3 years ago • 2 comments

tyring to compile on rapberry pi, running into an issue:


`[ 73%] Linking CXX executable generate_json
/usr/bin/ld: ../../tdutils/libtdutils.a(buffer.cpp.o): in function `td::BufferAllocator::track_buffer_slice(long long)':
buffer.cpp:(.text._ZN2td15BufferAllocator18track_buffer_sliceEx+0x58): undefined reference to `__atomic_fetch_add_8'
/usr/bin/ld: ../../tdutils/libtdutils.a(Time.cpp.o): in function `td::Time::now()':
Time.cpp:(.text._ZN2td4Time3nowEv+0x28): undefined reference to `__atomic_load_8'
/usr/bin/ld: Time.cpp:(.text._ZN2td4Time3nowEv+0x50): undefined reference to `__atomic_load_8'
/usr/bin/ld: Time.cpp:(.text._ZN2td4Time3nowEv+0x74): undefined reference to `__atomic_compare_exchange_8'
/usr/bin/ld: Time.cpp:(.text._ZN2td4Time3nowEv+0x88): undefined reference to `__atomic_load_8`

not sure if this is the right way, but it compiles now...

resolved by adding "-latomic" to find ./ -name "generate_json*" ./build/td/generate/CMakeFiles/generate_json.dir/link.txt

-latomi (add this to the end of link.txt file located in generate_json.dir )

denimjeans avatar Dec 05 '21 10:12 denimjeans

The fix direction is right, but there will be more link errors if you try to fix generated files.

See https://github.com/tdlib/td/issues/790#issuecomment-553993433 for the correct fix on CMake level.

levlam avatar Dec 05 '21 19:12 levlam

wonderful, thanks! worked much better without issues

denimjeans avatar Dec 05 '21 22:12 denimjeans