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 error for arm-linux-musleabi #2

Closed
stanleyws opened this issue May 11, 2024 · 1 comment
Closed

Build error for arm-linux-musleabi #2

stanleyws opened this issue May 11, 2024 · 1 comment

Comments

@stanleyws
Copy link

Trying to build 32 bit arm binary to run on my openwrt router with "cmake -B build -DZIG_TARGET=arm-linux-musleabi -DUSE_SYSTEM_PCAP=OFF" but cmake throws a bunch of errors:

LLD Link... ld.lld: error: undefined symbol: __atomic_fetch_add_4
>>> referenced by atomic_support.h:82 (/snap/zig/11356/lib/libcxx/src/support/runtime/../../include/atomic_support.h:82)
>>>               /home/user/.cache/zig/o/45c090ec8d04d9ecbf3580293d7d3b3f/stdexcept.o:(std::logic_error::logic_error(std::logic_error const&)) in archive /home/user/.cache/zig/o/dea5f55ad91e1663a597d7ca3d4c91e5/libc++.a
>>> referenced by atomic_support.h:82 (/snap/zig/11356/lib/libcxx/src/support/runtime/../../include/atomic_support.h:82)
>>>               /home/user/.cache/zig/o/45c090ec8d04d9ecbf3580293d7d3b3f/stdexcept.o:(std::logic_error::operator=(std::logic_error const&)) in archive /home/user/.cache/zig/o/dea5f55ad91e1663a597d7ca3d4c91e5/libc++.a
>>> referenced by atomic_support.h:82 (/snap/zig/11356/lib/libcxx/src/support/runtime/../../include/atomic_support.h:82)
>>>               /home/user/.cache/zig/o/45c090ec8d04d9ecbf3580293d7d3b3f/stdexcept.o:(std::logic_error::operator=(std::logic_error const&)) in archive /home/user/.cache/zig/o/dea5f55ad91e1663a597d7ca3d4c91e5/libc++.a
>>> referenced 158 more times

ld.lld: error: undefined symbol: __atomic_store_4
>>> referenced by atomic_support.h:66 (/snap/zig/11356/lib/libcxx/src/include/atomic_support.h:66)
>>>               /home/user/.cache/zig/o/d45c5ec9af10d5fc3b7ff8e8b73919c1/mutex.o:(std::__1::__call_once(unsigned long volatile&, void*, void (*)(void*))) in archive /home/user/.cache/zig/o/dea5f55ad91e1663a597d7ca3d4c91e5/libc++.a
>>> referenced by atomic_support.h:59 (/snap/zig/11356/lib/libcxx/src/include/atomic_support.h:59)
>>>               /home/user/.cache/zig/o/d45c5ec9af10d5fc3b7ff8e8b73919c1/mutex.o:(std::__1::__call_once(unsigned long volatile&, void*, void (*)(void*))) in archive /home/user/.cache/zig/o/dea5f55ad91e1663a597d7ca3d4c91e5/libc++.a
>>> referenced by atomic_support.h:66 (/snap/zig/11356/lib/libcxx/src/include/atomic_support.h:66)
>>>               /home/user/.cache/zig/o/d45c5ec9af10d5fc3b7ff8e8b73919c1/mutex.o:(std::__1::__call_once(unsigned long volatile&, void*, void (*)(void*))) in archive /home/user/.cache/zig/o/dea5f55ad91e1663a597d7ca3d4c91e5/libc++.a

ld.lld: error: undefined symbol: __atomic_load_4
>>> referenced by shared_ptr.h:83 (/snap/zig/11356/lib/libcxx/include/__memory/shared_ptr.h:83)
>>>               /home/user/.cache/zig/o/d724aee2f8bfcfd188adffe1085a6bb6/future.o:(std::__1::promise<void>::~promise()) in archive /home/user/.cache/zig/o/dea5f55ad91e1663a597d7ca3d4c91e5/libc++.a
>>> referenced by atomic_support.h:74 (/snap/zig/11356/lib/libcxx/src/include/atomic_support.h:74)
>>>               /home/user/.cache/zig/o/6b45565f74dcb203a5c2fe4bbea4310a/memory.o:(std::__1::__shared_weak_count::__release_shared()) in archive /home/user/.cache/zig/o/dea5f55ad91e1663a597d7ca3d4c91e5/libc++.a
>>> referenced by atomic_support.h:74 (/snap/zig/11356/lib/libcxx/src/include/atomic_support.h:74)
>>>               /home/user/.cache/zig/o/6b45565f74dcb203a5c2fe4bbea4310a/memory.o:(std::__1::__shared_weak_count::__release_weak()) in archive /home/user/.cache/zig/o/dea5f55ad91e1663a597d7ca3d4c91e5/libc++.a
>>> referenced 163 more times

ld.lld: error: undefined symbol: __atomic_compare_exchange_4
>>> referenced by atomic_support.h:100 (/snap/zig/11356/lib/libcxx/src/include/atomic_support.h:100)
>>>               /home/user/.cache/zig/o/6b45565f74dcb203a5c2fe4bbea4310a/memory.o:(std::__1::__shared_weak_count::lock()) in archive /home/user/.cache/zig/o/dea5f55ad91e1663a597d7ca3d4c91e5/libc++.a

ld.lld: error: undefined symbol: __atomic_exchange_4
>>> referenced by atomic_support.h:90 (/snap/zig/11356/lib/libcxx/src/include/atomic_support.h:90)
>>>               /home/user/.cache/zig/o/35d114800117cc7e247f8e91b4ab0252/cxa_default_handlers.o:(std::set_unexpected(void (*)())) in archive /home/user/.cache/zig/o/6f0c9297a7c7e2627e9afa6ba81e3fa0/libc++abi.a
>>> referenced by atomic_support.h:90 (/snap/zig/11356/lib/libcxx/src/include/atomic_support.h:90)
>>>               /home/user/.cache/zig/o/35d114800117cc7e247f8e91b4ab0252/cxa_default_handlers.o:(std::set_terminate(void (*)())) in archive /home/user/.cache/zig/o/6f0c9297a7c7e2627e9afa6ba81e3fa0/libc++abi.a
>>> referenced by atomic_support.h:90 (/snap/zig/11356/lib/libcxx/src/include/atomic_support.h:90)
>>>               /home/user/.cache/zig/o/35d114800117cc7e247f8e91b4ab0252/cxa_default_handlers.o:(std::set_new_handler(void (*)())) in archive /home/user/.cache/zig/o/6f0c9297a7c7e2627e9afa6ba81e3fa0/libc++abi.a

ld.lld: error: undefined symbol: __atomic_load_1
>>> referenced by atomic_support.h:74 (/snap/zig/11356/lib/libcxx/src/include/atomic_support.h:74)
>>>               /home/user/.cache/zig/o/414e6d9e9bdcb8ed878e8727d0425a6b/cxa_guard.o:(__cxa_guard_acquire) in archive /home/user/.cache/zig/o/6f0c9297a7c7e2627e9afa6ba81e3fa0/libc++abi.a
>>> referenced by cxx_atomic_impl.h:363 (/snap/zig/11356/lib/libcxx/include/__atomic/cxx_atomic_impl.h:363)
>>>               PcapLiveDevice.cpp.o:(pcpp::PcapLiveDevice::captureThreadMain()) in archive _deps/pcapplusplus-build/Pcap++/libPcap++.a
>>> referenced by cxx_atomic_impl.h:363 (/snap/zig/11356/lib/libcxx/include/__atomic/cxx_atomic_impl.h:363)
>>>               PcapLiveDevice.cpp.o:(pcpp::PcapLiveDevice::captureThreadMain()) in archive _deps/pcapplusplus-build/Pcap++/libPcap++.a
>>> referenced 6 more times

ld.lld: error: undefined symbol: __atomic_store_1
>>> referenced by atomic_support.h:59 (/snap/zig/11356/lib/libcxx/src/include/atomic_support.h:59)
>>>               /home/user/.cache/zig/o/414e6d9e9bdcb8ed878e8727d0425a6b/cxa_guard.o:(__cxa_guard_release) in archive /home/user/.cache/zig/o/6f0c9297a7c7e2627e9afa6ba81e3fa0/libc++abi.a
>>> referenced by cxx_atomic_impl.h:349 (/snap/zig/11356/lib/libcxx/include/__atomic/cxx_atomic_impl.h:349)
>>>               PcapLiveDevice.cpp.o:(pcpp::PcapLiveDevice::PcapLiveDevice(pcap_if*, bool, bool, bool)) in archive _deps/pcapplusplus-build/Pcap++/libPcap++.a
>>> referenced by cxx_atomic_impl.h:349 (/snap/zig/11356/lib/libcxx/include/__atomic/cxx_atomic_impl.h:349)
>>>               PcapLiveDevice.cpp.o:(pcpp::PcapLiveDevice::onPacketArrivesBlockingMode(unsigned char*, pcap_pkthdr const*, unsigned char const*)) in archive _deps/pcapplusplus-build/Pcap++/libPcap++.a
>>> referenced 4 more times
gmake[2]: *** [CMakeFiles/pppwn.dir/build.make:102: pppwn] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:377: CMakeFiles/pppwn.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2`

Building for native x86_64 and mips works without any issue, so I think the build environment setup is ok.

@xfangfang
Copy link
Owner

xfangfang commented May 11, 2024

@stanleyws

This problem is related to: ziglang/zig#14889

If CPU type is not specified during compilation, the compiler will attempt to make the compiled product run on as many CPUs as possible, in which case atmoic is not supported. The CMakeList has been modified to support setting custom compilation and linking options:

-DZIG_COMPILE_OPTION='-march=armv7;-mcpu=cortex_a9'

https://github.com/xfangfang/PPPwn_cpp/actions/runs/9042674491

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

2 participants