Difference between revisions of "how to build sndpeek from sndtools"
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
== Errors == | == Errors == | ||
− | When trying to compile '''sndpeek''' and likely other binaries from '''sndtools''' ([http://sndtools.cs.princeton.edu/ http://sndtools.cs.princeton.edu/]) for Ubuntu you may get the following build and link errors. This note will show how to fix the problems. | + | When trying to compile '''sndpeek''' and likely other binaries from '''sndtools''' ([http://sndtools.cs.princeton.edu/ http://sndtools.cs.princeton.edu/]) for Ubuntu you may get the following build and link errors. This build process was for the ALSA build target. This note will show how to fix the problems. |
Build error: | Build error: | ||
Line 35: | Line 35: | ||
Install the following Ubuntu packages: | Install the following Ubuntu packages: | ||
<pre> | <pre> | ||
− | aptitude install libxi-dev libxmu-headers libalsaplayer0 freeglut3-dev libxt-dev libsm-dev libice | + | aptitude install libsndfile1-dev libxi-dev libxmu-headers libalsaplayer0 freeglut3-dev libxt-dev libsm-dev libice-dev |
</pre> | </pre> | ||
I did not start from a stock Ubuntu installation. Others repeating these instructions may need to install additional packages ('''build-essential''', at the very least). | I did not start from a stock Ubuntu installation. Others repeating these instructions may need to install additional packages ('''build-essential''', at the very least). | ||
+ | |||
== Source patches required to build == | == Source patches required to build == | ||
− | Patch the makefile.alsa source file under '''src/sndpeek''' | + | Patch the makefile.alsa source file under '''src/sndpeek'''. This adds the '''-Wl''' option telling '''gcc''' to pass an option directly to the linker. This is used to pass the '''--start-group''' and '''--end-group''' options to the GNU linker, which tell it to try to resolve circular references by trying every possible link order until it finds one with no undefined references. This can be slow in general, but causes no significant delay here. |
<pre> | <pre> | ||
# diff -u makefile.alsa ../../../sndpeek-1.4.backup/src/sndpeek/makefile.alsa | # diff -u makefile.alsa ../../../sndpeek-1.4.backup/src/sndpeek/makefile.alsa |
Latest revision as of 16:49, 18 January 2016
Contents
Errors
When trying to compile sndpeek and likely other binaries from sndtools (http://sndtools.cs.princeton.edu/) for Ubuntu you may get the following build and link errors. This build process was for the ALSA build target. This note will show how to fix the problems.
Build error:
../marsyas/LPC.cpp: In member function 'virtual void LPC::process(fvec&, fvec&)': ../marsyas/LPC.cpp:120:40: error: 'abs' was not declared in this scope rmat_(i-1,j-1) = corr_(abs((int)(i-j)));
Link error:
g++ -o sndpeek chuck_fft.o RtAudio.o Thread.o sndpeek.o Stk.o Centroid.o DownSampler.o Flux.o LPC.o MFCC.o RMS.o Rolloff.o System.o fvec.o AutoCorrelation.o Communicator.o Hamming.o MagFFT.o NormRMS.o MarSignal.o fmatrix.o -L/usr/X11R6/lib -lglut -lGL -lGLU -lasound -lXmu -lX11 -lXext -lXi -lm -lsndfile /usr/bin/ld: Thread.o: undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[1]: *** [sndpeek] Error 1
My build environment
$ uname -a Linux noah-ubuntu 3.19.0-43-generic #49~14.04.1-Ubuntu SMP Thu Dec 31 15:44:49 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux $ cat /etc/issue.net Ubuntu 14.04.3 LTS
Ubuntu Packages required for building and running
Install the following Ubuntu packages:
aptitude install libsndfile1-dev libxi-dev libxmu-headers libalsaplayer0 freeglut3-dev libxt-dev libsm-dev libice-dev
I did not start from a stock Ubuntu installation. Others repeating these instructions may need to install additional packages (build-essential, at the very least).
Source patches required to build
Patch the makefile.alsa source file under src/sndpeek. This adds the -Wl option telling gcc to pass an option directly to the linker. This is used to pass the --start-group and --end-group options to the GNU linker, which tell it to try to resolve circular references by trying every possible link order until it finds one with no undefined references. This can be slow in general, but causes no significant delay here.
# diff -u makefile.alsa ../../../sndpeek-1.4.backup/src/sndpeek/makefile.alsa --- makefile.alsa 2015-03-01 14:31:15.000000000 -0800 +++ ../../../sndpeek-1.4.backup/src/sndpeek/makefile.alsa 2016-01-18 14:19:59.271647943 -0800 @@ -4,7 +4,7 @@ INCLUDES=-I../marsyas/ MARSYAS_DIR=../marsyas/ CFLAGS=-D__LINUX_ALSA__ -D__LITTLE_ENDIAN__ $(INCLUDES) -O3 -c -LIBS=-L/usr/X11R6/lib -lglut -lGL -lGLU -lasound -lXmu -lX11 -lXext -lXi -lm -lsndfile +LIBS=-Wl,--start-group -L/usr/X11R6/lib -lglut -lGL -lGLU -lasound -lXmu -lX11 -lXext -lXi -lm -lsndfile -pthread -Wl,--end-group OBJS=chuck_fft.o RtAudio.o Thread.o sndpeek.o Stk.o \ Centroid.o DownSampler.o Flux.o LPC.o MFCC.o RMS.o Rolloff.o \
Patch the LPC.cpp source file under src/marsyas:
diff -u LPC.cpp ../../../sndpeek-1.4.backup/src/marsyas/LPC.cpp --- LPC.cpp 2015-03-01 14:31:15.000000000 -0800 +++ ../../../sndpeek-1.4.backup/src/marsyas/LPC.cpp 2016-01-18 13:48:37.115597483 -0800 @@ -27,6 +27,7 @@ #include "LPC.h" +#include <cstdlib> LPC::LPC( unsigned int inSize ) {
Now running make linux-alsa should work.