Error building the jucer (undef ref: __sync_add_and_fetch_4)

I’m completely new to juce. My first intention was to try the jucer, but it failed to link:

[] Unpack juce 1.51 or git clone.[/]
[] cd juce/extras/the jucer/build/linux[/]
[] make - results in the below error:[/][/list]

Linking Jucer build/intermediate/Debug/juce_LibrarySource.o: In function `juce::Atomic::decrementAndReturn(int&)': juce_LibrarySource.cpp:(.text._ZN4juce6Atomic18decrementAndReturnERi[juce::Atomic::decrementAndReturn(int&)]+0x15): undefined reference to `__sync_add_and_fetch_4' build/intermediate/Debug/juce_LibrarySource.o: In function `juce::Atomic::compareAndExchange(int&, int, int)': juce_LibrarySource.cpp:(.text._ZN4juce6Atomic18compareAndExchangeERiii[juce::Atomic::compareAndExchange(int&, int, int)]+0x1b): undefined reference to `__sync_val_compare_and_swap_4' build/intermediate/Debug/juce_LibrarySource.o: In function `juce::Atomic::swapPointers(void* volatile*, void*)': juce_LibrarySource.cpp:(.text._ZN4juce6Atomic12swapPointersEPVPvS1_[juce::Atomic::swapPointers(void* volatile*, void*)]+0x2d): undefined reference to `__sync_bool_compare_and_swap_4' collect2: ld returned 1 exit status make[1]: *** [build/jucer] Error 1 make: *** [Jucer] Error 2

I’ve searched the net and found suggestions to use -march=686 (, but have no idea if that’s relevant for juce and in that case how to apply it to the build process.

I’m on Mandriva 2009.1, (32 bit)
Linux #1 SMP Fri Jan 29 15:14:01 EST 2010 i686 Intel® Core™2 CPU T7400 @ 2.16GHz GNU/Linux
gcc 4.3.2

– Johan

Ok, I fixed it by adding:

to jucer_premake.lua, rerunning premake and build.

I assume it should work out of the box though, so someone might want to take a look at it!

I guess -march=native would work as well?

I don’t have that problem on my linux machine, maybe because I’ve got gcc4.4? The old lua-based makefile stuff is all going away anyway, and will be replaced by the new jucer-generated makefiles, but thanks, I’ll patch this to avoid any confusion in the meantime.

Yes, it should. Among others, “extras/audio plugin host” Makefile uses TARGET_ARCH := -march=native and that compiled cleanly for me without patching.

Great. I just posted a few notes on getting the audio plugin demo built on Linux, hope that helps.

– Johan