JUCE on Linux/arm


#1

Well i managed to build Introjucer but the JuceDemo has some Atomic problems:


[root@malina:~/juce/extras/JuceDemo/Builds/Linux]# make
Linking Juce Demo
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::get() const':
/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:272: undefined reference to `__sync_add_and_fetch_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::operator+=(long long)':
/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:299: undefined reference to `__sync_add_and_fetch_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::operator++()':
/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:319: undefined reference to `__sync_add_and_fetch_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::operator--()':
/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:333: undefined reference to `__sync_add_and_fetch_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<unsigned long long>::get() const':
/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:272: undefined reference to `__sync_add_and_fetch_8'
build/intermediate/Debug/juce_core_1ee54a40.o:/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:299: more undefined references to `__sync_add_and_fetch_8' follow
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<double>::compareAndSetValue(double, double)':
/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:370: undefined reference to `__sync_val_compare_and_swap_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<double>::compareAndSetBool(double, double)':
/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:347: undefined reference to `__sync_bool_compare_and_swap_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::compareAndSetValue(long long, long long)':
/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:370: undefined reference to `__sync_val_compare_and_swap_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::compareAndSetBool(long long, long long)':
/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:347: undefined reference to `__sync_bool_compare_and_swap_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<unsigned long long>::compareAndSetValue(unsigned long long, unsigned long long)':
/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:370: undefined reference to `__sync_val_compare_and_swap_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<unsigned long long>::compareAndSetBool(unsigned long long, unsigned long long)':
/root/juce/extras/JuceDemo/Builds/Linux/../../../../modules/juce_core/system/../logging/../text/../memory/juce_Atomic.h:347: undefined reference to `__sync_bool_compare_and_swap_8'
collect2: ld returned 1 exit status
make: *** [build/JuceDemo] Error 1

gcc is:


[root@malina:~/juce/extras/JuceDemo/Builds/Linux]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-8+rpi1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-8+rpi1)

Is this something i can fix ? i’m using -march=armv6


#2

Well, GCC is missing those atomic primitives. Sorry, I don’t know anything about gcc on arm or why it might not support basic stuff like that…


#3

Try asking in #workingset on Freenode IRC
If that doesn’t work you can try #boost, and then #c++ (as a last resort).


#4

Well it’s just one module from juce sine Introjucer is running fine

[attachment=0]raspberry_introjucer.jpg[/attachment]
it’s all raspberry pi, i’ll google some more and ask around.


#5

Cool to see the introjucer running on the Pi!

But quite surprising that it would compile when there are atomic functions missing… I guess it might just be lucky that it happens not to use any classes that rely on them.


#6

Very cool to see on the RPi! :smiley:
I was just going to see if I could get the audio plug-in host example running. I didn’t realize the gcc/ARM implementation was so incomplete. I wonder what compiler Nokia use for QtOnPi - they’re bound that have hit similar issues surely?


#7

Ah yes, and this version of make doesn’t appear to support the -march option either. …Commenting out…


#8

It’s not atomic instructions that are missing, it’s only 64-bits atomic instructions that are missing.
You can easily solve this by specializing the template for int64/uint64 type, to use a common static mutex for all 64 bits atomic operations (IIRC there’s only few case where they are used).


#9

Hi, just building on the Pi for the first time in a long time (certainly since Jules' most recent big changes), and I'm getting these -

I found this post, but haven't had a chance to actually read it (nor check my build settings just yet) - Hopefully, I'll update this when I find a solution:

{the answer may be above - but it's too late at the mo to check it all out right now}

pi@raspberrypi ~/projects/JUCE/extras/Demo/Builds/Linux $ make
Linking JuceDemo
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::get() const':
/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:279: undefined reference to `__sync_add_and_fetch_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::operator+=(long long)':
/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:306: undefined reference to `__sync_add_and_fetch_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::operator++()':
/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:327: undefined reference to `__sync_add_and_fetch_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::operator--()':
/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:342: undefined reference to `__sync_add_and_fetch_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<unsigned long long>::get() const':
/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:279: undefined reference to `__sync_add_and_fetch_8'
build/intermediate/Debug/juce_core_1ee54a40.o:/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:306: more undefined references to `__sync_add_and_fetch_8' follow
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<double>::compareAndSetValue(double, double)':
/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:379: undefined reference to `__sync_val_compare_and_swap_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<double>::compareAndSetBool(double, double)':
/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:356: undefined reference to `__sync_bool_compare_and_swap_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::compareAndSetValue(long long, long long)':
/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:379: undefined reference to `__sync_val_compare_and_swap_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<long long>::compareAndSetBool(long long, long long)':
/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:356: undefined reference to `__sync_bool_compare_and_swap_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<unsigned long long>::compareAndSetValue(unsigned long long, unsigned long long)':
/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:379: undefined reference to `__sync_val_compare_and_swap_8'
build/intermediate/Debug/juce_core_1ee54a40.o: In function `juce::Atomic<unsigned long long>::compareAndSetBool(unsigned long long, unsigned long long)':
/home/pi/projects/JUCE/extras/Demo/Builds/Linux/../../../../modules/juce_core/memory/juce_Atomic.h:356: undefined reference to `__sync_bool_compare_and_swap_8'
collect2: ld returned 1 exit status

 


#10

[Am using export TARGET_ARCH="-march=armv6 -mfpu=vfp -mfloat-abi=hard"

]


#11

Does anyone have a fix for this? I've been scouring the Internet for info, but found not a lot - (somewhere suggested updating GCC to 4.8.1 which gets around the issue, but I'd rather not do that... it's almost like the functions aren't defined in GCC 4.7, but I find that hard to believe that Juce is the only thing refernecing 64 atomics on the Pi!)

 


#12

I was compiling JUCE stuff all weekend and never found this issue, i'm using gcc 4.7 (raspbian distro), can you try typing make -n and see what actual parameters are passed when compiling ?


#13

Hi Atom, I know it's been a long time, but I'm finally looking at this again. Here's what I get when I bild Demo on my pi (latest tip of Juce/updates to Raspian) - Note. I can build Introjucer and Example projects without issue... It just seems to be Demo

(I haven't tried the audio apps yet)


#14

{Bump. Sorry for the long delay}

 


#15

OK. silly me. Simply disabling juce Unit tests JUCE_UNIT_TESTS=0 cures this..! Duh

 

I also discovered something. I can't run Juce apps (haveb't checked each of the extras/demos yet) directly on my pi (raspian, up to date) but they do run (almost flawlessly!) via vnc AS LONG AS the vnc server's bit depth is 24 bit. Anything else causes all sorts of funnies.

(also OpenGl demo of JuceDemo crashes out -on both vnc and when running directly version)

 


#16

Ok, on a fresh SD card (having api-get installed all modules identified elsewhere on this forum) I found I had to

apt-get remove zenity

to get Introjucer's project open to work

 

My attempts to get OpenGL demos to work however have failed.

OpenGL under Raspian / X11 doesn't seem to work AFAICT (if anyone else knows otherwise, please let me know ASAP! :) )

 

Hopefully, this little script is handy for others (Assumes juce is installed in ~/devel/juce )

 

File rebuildalljuce.sh
==================

#!/bin/sh
export TARGET_ARCH="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
export CONFIG="Release"
cd ~/devel/juce/extras/audio\ plugin\ demo/Builds/Linux && make clean && make && cd build && mv JuceDemoPlugin.so ~/.vst/JuceDemoPlugin.so
cd ~/devel/juce/extras/audio\ plugin\ host/Builds/Linux && make clean && make && cd build && mv Plugin\ Host ~/Desktop/Plugin\ Host
cd ~/devel/juce/extras/binarybuilder/Builds/Linux && make clean && make && cd build && mv BinaryBuilder ~/Desktop/BinaryBuilder
cd ~/devel/juce/extras/Demo/Builds/Linux && make clean && make && cd build && mv JuceDemo ~/Desktop/JuceDemo
cd ~/devel/juce/extras/example\ projects/Builds/Linux && make clean && make && cd build && mv HelloWorld ~/Desktop\HelloWorld
cd ~/devel/juce/extras/Introjucer/Builds/Linux && make clean && make && cd build && mv Introjucer ~\Desktop/Introjucer
export CONFIG="Debug"
cd ~/devel/juce/extras/audio\ plugin\ demo/Builds/Linux && make clean && make && cd build && mv JuceDemoPlugin.so ~/.vst/JuceDemoPluginDB.so
cd ~/devel/juce/extras/audio\ plugin\ host/Builds/Linux && make clean && make && cd build && mv Plugin\ Host ~/Desktop/Plugin\ HostDB
cd ~/devel/juce/extras/binarybuilder/Builds/Linux && make clean && make && cd build && mv BinaryBuilder ~\Desktop/BinaryBuilderDB
cd ~/devel/juce/extras/Demo/Builds/Linux && make clean && make && cd build && mv JuceDemo ~/Desktop/JuceDemoDB
cd ~/devel/juce/extras/example\ projects/Builds/Linux && make clean && make && cd build && mv HelloWorld ~/Desktop/HelloWorldDB
cd ~/devel/juce/extras/Introjucer/Builds/Linux && make clean && make && cd build && mv Introjucer ~/Desktop/IntrojucerDB

I also created another script to allow incremental builds ( same script without make cleans)

File buildalljuce.sh
================

#!/bin/sh
export TARGET_ARCH="-march=armv6 -mfpu=vfp -mfloat-abi=hard"
export CONFIG="Release"
cd ~/devel/juce/extras/audio\ plugin\ demo/Builds/Linux && make && cd build && mv JuceDemoPlugin.so ~/.vst/JuceDemoPlugin.so
cd ~/devel/juce/extras/audio\ plugin\ host/Builds/Linux && make && cd build && mv Plugin\ Host ~/Desktop/Plugin\ Host
cd ~/devel/juce/extras/binarybuilder/Builds/Linux && make && cd build && mv BinaryBuilder ~/Desktop/BinaryBuilder
cd ~/devel/juce/extras/Demo/Builds/Linux && make && cd build && mv JuceDemo ~/Desktop/JuceDemo
cd ~/devel/juce/extras/example\ projects/Builds/Linux && make && cd build && mv HelloWorld ~/Desktop/HelloWorld
cd ~/devel/juce/extras/Introjucer/Builds/Linux && make && cd build && mv Introjucer ~/Desktop/Introjucer
export CONFIG="Debug"
cd ~/devel/juce/extras/audio\ plugin\ demo/Builds/Linux && make && cd build && mv JuceDemoPlugin.so ~/.vst/JuceDemoPluginDB.so
cd ~/devel/juce/extras/audio\ plugin\ host/Builds/Linux && make && cd build && mv Plugin\ Host ~/Desktop/Plugin\ HostDB
cd ~/devel/juce/extras/binarybuilder/Builds/Linux && make && cd build && mv BinaryBuilder ~/Desktop/BinaryBuilderDB
cd ~/devel/juce/extras/Demo/Builds/Linux && make && cd build && mv JuceDemo ~/Desktop/JuceDemoDB
cd ~/devel/juce/extras/example\ projects/Builds/Linux && make && cd build && mv HelloWorld ~/Desktop/HelloWorldDB
cd ~/devel/juce/extras/Introjucer/Builds/Linux && make && cd build && mv Introjucer ~/Desktop/IntrojucerDB