Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

undefined reference to `__atomic_load_8' while building SampleApp on raspberryPi #1404

Closed
8 tasks
Vaishnavikumara opened this issue Jun 27, 2019 · 18 comments
Closed
8 tasks

Comments

@Vaishnavikumara
Copy link

IMPORTANT: Before you create an issue, please take a look at our Issue Reporting Guide.

Briefly summarize your issue:

What is the expected behavior?

What behavior are you observing?

Provide the steps to reproduce the issue, if applicable:

Tell us about your environment:

What version of the AVS Device SDK are you using?

  <x.y.z>

Tell us what hardware you're using:

  • Desktop / Laptop
  • Raspberry Pi
  • Other - tell us more:

Tell us about your OS (Type & version):

  • Linux
  • MacOS
  • Raspbian Stretch
  • Raspbian Jessy
  • Other - tell us more:
@scotthea-amazon
Copy link
Contributor

Hello Vaishnavikumara,

It looks very likely that this is a duplicate of issue 380. The fix reported there is to add:

set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")

...to CMakelists.txt.

best regards,
-SWH

@kclchan kclchan mentioned this issue Jul 5, 2019
6 tasks
This was referenced Aug 15, 2019
@Chiggy-Playz
Copy link

@scotthea-amazon I tried the fix you gave here. It still did not work. I am using rpi4 with debian 10.

@Xxjojo
Copy link

Xxjojo commented Aug 27, 2019

@Chiggy-Playz me too

@Chiggy-Playz
Copy link

@Chiggy-Playz me too

you can solve the issue by going to the avs-sdk.../CMakeTextList.txt and then paste
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")

done for the atomic base error.

@angus390
Copy link

angus390 commented Sep 7, 2019

@Chiggy-Playz me too

you can solve the issue by going to the avs-sdk.../CMakeTextList.txt and then paste
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")

done for the atomic base error.

How do you get to this line? thanks

@coriolan-v
Copy link

coriolan-v commented Sep 13, 2019

Same problem, I have added this line set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") at the end of the file /librealsense/CMakeList.txt, but after installing the binaries, the issue persists:
undefined reference to '__atomic_fetch_add_8'
undefined reference to '__atomic_store_8'
undefined reference to '__atomic_load_8'

@coriolan-v
Copy link

coriolan-v commented Sep 13, 2019

I finally got it working by intsallint gcc 5 and trying again!
sudo apt-get install gcc-5 g++-5

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5

sudo update-alternatives --set gcc "/usr/bin/gcc-5"

@Chiggy-Playz
Copy link

@coriolan-cs you edited the wrong file. you had to edit the file in source/avs-sdk-device/CMakeTextList.txt and then add the file in the end @angus390 follow the same

@coriolan-v
Copy link

Oh sorry about the confusion, I had this problem when building for Intel Realsense, not Alexa (I google the problem and arrived here)
Although I replaced source/avs-sdk-device/ by /librealsense/

@djcors
Copy link

djcors commented Sep 16, 2019

i got a same error.

/usr/bin/ld: CMakeFiles/SampleApp.dir/SampleApplication.cpp.o: en la función `std::__atomic_base<unsigned long long>::operator=(unsigned long long)':
/usr/include/c++/8/bits/atomic_base.h:374: referencia a `__atomic_store_8' sin definir
/usr/bin/ld: CMakeFiles/SampleApp.dir/PortAudioMicrophoneWrapper.cpp.o: en la función `alexaClientSDK::avsCommon::utils::sds::SharedDataStream<alexaClientSDK::avsCommon::utils::sds::InProcessSDSTraits>::Writer::write(void const*, unsigned int, std::chrono::duration<long long, std::ratio<1ll, 1000ll> >)':
/usr/include/c++/8/bits/atomic_base.h:396: referencia a `__atomic_load_8' sin definir
/usr/bin/ld: CMakeFiles/SampleApp.dir/PortAudioMicrophoneWrapper.cpp.o: en la función `alexaClientSDK::avsCommon::utils::sds::SharedDataStream<alexaClientSDK::avsCommon::utils::sds::InProcessSDSTraits>::Writer::Writer(alexaClientSDK::avsCommon::utils::sds::WriterPolicy, std::shared_ptr<alexaClientSDK::avsCommon::utils::sds::SharedDataStream<alexaClientSDK::avsCommon::utils::sds::InProcessSDSTraits>::BufferLayout>)':
/usr/include/c++/8/bits/atomic_base.h:396: referencia a `__atomic_load_8' sin definir
/usr/bin/ld: CMakeFiles/SampleApp.dir/PortAudioMicrophoneWrapper.cpp.o: en la función `std::__atomic_base<unsigned long long>::operator unsigned long long() const':
/usr/include/c++/8/bits/atomic_base.h:396: referencia a `__atomic_load_8' sin definir
/usr/bin/ld: ../../ACL/src/libACL.so: referencia a `__atomic_fetch_add_8' sin definir
collect2: error: ld returned 1 exit status
make[3]: *** [SampleApp/src/CMakeFiles/SampleApp.dir/build.make:288: SampleApp/src/SampleApp] Error 1
make[2]: *** [CMakeFiles/Makefile2:10227: SampleApp/src/CMakeFiles/SampleApp.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:10239: SampleApp/src/CMakeFiles/SampleApp.dir/rule] Error 2

My system:

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"`

I try with
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")

at end of ~/avs-device-sdk/CMakeLists.txt

But not works for me

@Chiggy-Playz
Copy link

@djcors try putting it on the 9th line. That is just after the endif()

@kclchan
Copy link
Contributor

kclchan commented Oct 18, 2019

This issue is fixed in v1.15 of the SDK.

@buddywhitman
Copy link

I have the latest SDK version but still faced the same issue.

@lombardian
Copy link

Yeeeehaaaa! It works. For newbies like me, you have to:

cd avs-device-sdk

then:

nano CMakeLists.txt

go to the bottom and add in the file:

set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")

@cwchawt200
Copy link

sudo update-alternatives --set gcc "/usr/bin/gcc-5"

https://solarianprogrammer.com/2017/12/08/raspberry-pi-raspbian-install-gcc-compile-cpp-17-programs/

for Raspian 10 or above

@dusmit
Copy link

dusmit commented Feb 15, 2023

maybe you need use target_link_libraries(target atomic)

@YourArka
Copy link

YourArka commented Jan 9, 2024

Hello Vaishnavikumara,

It looks very likely that this is a duplicate of issue 380. The fix reported there is to add:

set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")

...to CMakelists.txt.

best regards, -SWH

hello, this is not working

@YourArka
Copy link

YourArka commented Jan 9, 2024

image
here is the error

[ 21%] Linking CXX executable AlertSchedulerTest
/usr/bin/ld: ../../../../AVSCommon/libAVSCommon.so: undefined reference to __atomic_fetch_add_8' /usr/bin/ld: ../../../../AVSCommon/libAVSCommon.so: undefined reference to __atomic_store_8'
/usr/bin/ld: ../../../../AVSCommon/libAVSCommon.so: undefined reference to `__atomic_load_8'
collect2: error: ld returned 1 exit status
make[2]: *** [EXTENSION/Alerts/acsdkAlerts/test/CMakeFiles/AlertSchedulerTest.dir/build.make:114: EXTENSION/Alerts/acsdkAlerts/test/AlertSchedulerTest] Error 1
make[1]: *** [CMakeFiles/Makefile2:7531: EXTENSION/Alerts/acsdkAlerts/test/CMakeFiles/AlertSchedulerTest.dir/all] Error 2
make: *** [Makefile:160: all] Error 2

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

No branches or pull requests