jontio / JMPX

FM Stereo encoder with RDS support
https://jontio.zapto.org/hda1/paradise/jmpxencoder/jmpx.html
56 stars 8 forks source link

cannot compile on raspberry pi #2

Closed allegfede closed 7 years ago

allegfede commented 7 years ago

Hello. Seems now i have another kind of problem. Downloaded the last master from github and followed steps in the wiki. those are the results: root@raspberrypi:/home/pi/jmpx/jontio-JMPX-2316377/libJMPX# make g++ -c -pipe -std=c++11 -ffast-math -Wno-deprecated -O3 -Wall -W -D_REENTRANT -fPIC -DQT_WEBKIT -DJMPX_LIBRARY -DREAL_FASTFIR -Dkiss_fft_scalar=double -D__UNIX_JACK__ -D__LINUX_PULSE__ -D__LINUX_ALSA__ -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I../rtaudio-4.1.2/include -I../kiss_fft130 -I../libopus-1.2-alpha/include -I. -o libJMPX.o libJMPX.cpp cc1plus: error: unrecognized command line option ‘-std=c++11’ Makefile:301: set di istruzioni per l'obiettivo "libJMPX.o" non riuscito make: *** [libJMPX.o] Errore 1

jontio commented 7 years ago

Hi Federico,

That's referring to QMAKE_CXXFLAGS += -std=c++11 -ffast-math in JMPX/libJMPX/libJMPX.pro.

I've compiled it fine on the raspberry Pi 3 today and didn't get that error. Maybe you have an older version of g++. You could try updating g++. On the Pi3 I tried today I have version 4.9.2-10 of g++. If you type g++ --version what do you get?

You could try QMAKE_CXXFLAGS += -std=gnu++11 -ffast-math instead in the pro file then run qmake and make again; I'm not sure if that will make a difference.

It is possible to get it to compile without C++11 but some things would have to be changed in the code.

Although JMPX compiled fine on the Pi3 and I saw no xruns from JACK and JMPX didn't say any frames were dropped I got small dropouts no matter what I did with JACK. I could tell there were dropouts as the lock in JDSCA kept failing (with SCA I could hear them as clicks). When you do get JMPX to compile with your Pi (I assume a Pi3?) could you let me know if the same happens with your sound card? I didn't get the problem when running the sound card at 96000 with JACK only 192000.

untitled2

untitled3

jontio commented 7 years ago

depending on your version of g++ it seems the flag has to be set differently.

try -std=c++0x

see https://gcc.gnu.org/projects/cxx-status.html#cxx11 and select what version you have.

They did a name change at GCC 4.7, anything earlier it's called c++0x

allegfede commented 7 years ago

yes g++ is for shure an older version: g++ (Debian 4.6.3-14+rpi1) 4.6.3

i made those changes on file JMPX/libJMPX/libJMPX.pro :

`#this for the new g++ compiler verstion (4.7)

QMAKE_CXXFLAGS += -std=c++11 -ffast-math

this for the old one (like g++ 4.6)

QMAKE_CXXFLAGS += -std=c++0x -ffast-math`

now qmake ok, but make returns: libJMPX.h:7:40: fatal error: QtConcurrent/QtConcurrentRun: File o directory non esistente

jontio commented 7 years ago

Yes your version is quite old.

Are you using Qt4 or Qt5? (I'm using 5.6 on Windows and 5.3 on Debian)

I've just got rid of QtConcurrent for now as some things I wanted to use in it aren't available till Qt5.4, and 5.3 still seems to be used on Debian. Try cloning the master again and see what happens.

allegfede commented 7 years ago

I suppose q4. I follow the guidelines on the wiki :D (sudo apt-get install qt4-dev-tools).

Clonet the master, modded the .pro for old compiler and afeter running make i got:

g++ -c -pipe -std=c++0x -ffast-math -Wno-deprecated -O3 -Wall -W -D_REENTRANT -fPIC -DQT_WEBKIT -DJMPX_LIBRARY -DREAL_FASTFIR -Dkiss_fft_scalar=double -DUNIX_JACK -DLINUX_PULSE -D__LINUX_ALSA__ -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I../rtaudio-4.1.2/include -I../kiss_fft130 -I../libopus-1.2-alpha/include -I. -o libJMPX.o libJMPX.cpp In file included from libJMPX.cpp:1:0: libJMPX.h:65:29: sorry, unimplemented: non-static data member initializers libJMPX.h:65:29: error: ISO C++ forbids in-class initialization of non-const static member ‘buffers_head_ptr_in’

and so on ....

PS: shure when i get it running i'll inform you about drops or pops :D

jontio commented 7 years ago

hmm that's referring to things like int buffers_head_ptr_in=0; in class declarations. They are new in C++11. I would rather keep them as it save having lots of buffers_head_ptr_in=0; in the constructor. I guess the g++ you have the c++0x flag is missing that.

You could either change every line like int buffers_head_ptr_in=0; in the h files that create errors to int buffers_head_ptr_in; and add buffers_head_ptr_in=0; in the constructor (usually in the cpp file). Or you could use 'apt-get' to update g++.

I suggest you try 'sudo apt-get update' and sudo apt-get upgrade that should update your g++ at least.

You might also consider going to Qt5 as that's what everyone uses now. Depending on your system sudo apt-get install qt5-default and sudo apt-get install qtcreator might install Qt5 along with qtcreator.

allegfede commented 7 years ago

i suppose i have to update my current platform from wheezy to jessy. Thanks for the help Jontio, i'll update and get you informed.

allegfede commented 7 years ago

shifted to new jessie, downloaded qt5 qt4 and so on, and now qmake goes ok and make goes a little further. now exits with: /usr/bin/ld: impossibile trovare -lopus collect2: error: ld returned 1 exit status Makefile:144: set di istruzioni per l'obiettivo "liblibJMPX.so.1.0.0" non riuscito make: *** [liblibJMPX.so.1.0.0] Errore 1

solved with: sudo apt-get install libopus-dev

jontio commented 7 years ago

Ah yes. sudo apt-get install libopus-dev gives you libopus.

jontio commented 7 years ago

I've simplified the build process somewhat. You only need to type qmake && make && sudo make install now.

On jessie debian for the Pi you probably installed these things and maybe some more...

sudo apt-get install qt5-default && libopus-dev && qt5-qmake && libjack-jackd2-dev && build-essential && qjackctl && git

The ALSA and Pulseaudio libraries aren't needed if you only want to use JACK if you comment out the ALSA and Pulseaudio sound systems in the libJMPX.pro file.

Then after commenting out ALSA and Pulseaudio sound systems in libJMPX.pro typing ...

git clone http://github.com/jontio/JMPX cd JMPX qmake && make && sudo make install

Should install JMPX.

allegfede commented 7 years ago

Perfect! Thanks a lot for your support.

Il 15/apr/2017 04:21 AM, "Jonti Olds" notifications@github.com ha scritto:

I've simplified the build process somewhat. You only need to type qmake && make && sudo make install now.

On jessie debian for the Pi you probably installed these things and maybe some more...

sudo apt-get install qt5-default && libopus-dev && qt5-qmake && libjack-jackd2-dev && build-essential && qjackctl && git

The ALSA and Pulseaudio libraries aren't needed if you only want to use JACK if you comment out the ALSA and Pulseaudio sound systems in the libJMPX.pro file.

Then after commenting out ALSA and Pulseaudio sound systems in libJMPX.pro typing ...

git clone http://github.com/jontio/JMPX cd JMPX qmake && make && sudo make install

Should install JMPX.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jontio/JMPX/issues/2#issuecomment-294266382, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXE2i_WkrX8tA2Y3C_xeOIjyh9E0dVXks5rwCmggaJpZM4M8dHR .