aws-samples / aws-iot-securetunneling-localproxy

AWS Iot Secure Tunneling local proxy reference C++ implementation
https://docs.aws.amazon.com/iot/latest/developerguide/what-is-secure-tunneling.html
Apache License 2.0
73 stars 70 forks source link

Raspberry PI 4 running Raspbian GNU/Linux 11 (bullseye) - atomic #103

Closed seregicus closed 1 year ago

seregicus commented 1 year ago

[ 4%] Linking CXX executable bin/localproxytest /usr/bin/ld: /usr/local/lib/arm-linux-gnueabihf/libprotobuf-lite.a(arena.cc.o): in function google::protobuf::internal::ThreadSafeArena::Init(bool)': arena.cc:(.text+0xa60): undefined reference to__atomic_fetch_add_8' collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/localproxytest.dir/build.make:292: bin/localproxytest] Error 1 make[1]: [CMakeFiles/Makefile2:97: CMakeFiles/localproxytest.dir/all] Error 2 make: *** [Makefile:103: all] Error 2

It seems to be a problem linking to '__atomic_fetch_add_8' or the atomic libs? Any clues on how to resolve? Anyone been successful building this on an rPi?

borner791 commented 1 year ago

I saw this same issue, it looks like moving #libatomic ensured for all platforms except OSX and WINDOWS if(NOT APPLE AND NOT MSVC) target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} atomic) target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} atomic) endif() below target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} ${Protobuf_LITE_STATIC_LIBRARY})

so basically to the end. This allows me to build on the Pi

RogerZhongAWS commented 1 year ago

Did not have time to validate this on raspberry pi yet, but yes this is an action item for the project.

nimysan commented 1 year ago

i have tried this and resolved the issue.

sudo apt remove gcc

sudo apt install llvm

sudo apt install clang++

mkdir clangbuild

cmake -DCMAKE_EXE_LINKER_FLAGS="-latomic" ../

make

The key is using clang 11 instead of gcc and also add -DCMAKE_EXE_LINKER_FLAGS="-latomic"