FS#53732 - [arm-none-eabi-gcc] Compile fails with : undefined reference to `__sync_synchronize'
Attached to Project:
Community Packages
Opened by Brendan Fennell (bfarch) - Friday, 21 April 2017, 04:59 GMT
Last edited by Anatol Pomozov (anatolik) - Friday, 28 April 2017, 13:59 GMT
Opened by Brendan Fennell (bfarch) - Friday, 21 April 2017, 04:59 GMT
Last edited by Anatol Pomozov (anatolik) - Friday, 28 April 2017, 13:59 GMT
|
Details
Description:
Compilation of a simple C++ program with arm-none-eabi-g++ fails with: ... ... /usr/lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/libstdc++.a(future.o): In function `std::future_category()': future.cc:(.text._ZSt15future_categoryv+0xc): undefined reference to `__sync_synchronize' ... .. Note: there are other undefined references to the syscall wrappers, they can be ignored as it due to newlib being compiled with --disable-newlib-supplied-syscalls. Additional info: * community/arm-none-eabi-gcc 6.3.1-1 Steps to reproduce: // main.cc #include <iostream> int main() { auto lambda = [](auto x){ return x; }; std::cout << lambda("Hello\n"); return 0; } // end main.cc $ arm-none-eabi-g++ main.cc |
This task depends upon
//main.cc
#include <iostream>
int main()
{
return 0;
}
$ arm-none-eabi-g++ main.cc
...
...
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/libstdc++.a(future.o): In function `std::future_category()':
future.cc:(.text._ZSt15future_categoryv+0xc): undefined reference to `__sync_synchronize'
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/libstdc++.a(locale.o): In function `std::locale::_Impl::_M_install_cache(std::locale::facet const*, unsigned int)':
locale.cc:(.text._ZNSt6locale5_Impl16_M_install_cacheEPKNS_5facetEj+0x18): undefined reference to `__sync_synchronize'
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/libstdc++.a(locale_init.o): In function `(anonymous namespace)::get_locale_mutex()':
locale_init.cc:(.text._ZN12_GLOBAL__N_116get_locale_mutexEv+0xc): undefined reference to `__sync_synchronize'
...
...
2) Install requireed newlib library arm-none-eabi-newlib
Compiling a file like this make the trick:
arm-none-eabi-g++ -specs=nosys.specs -mthumb -mcpu=cortex-m3 main.cc
In the future please contact upstream maillist for more help on g++ usage.