Difference between revisions of "how to build sndpeek from sndtools"
From Noah.org
Jump to navigationJump to searchm (→Errors) |
m (→Errors) |
||
Line 4: | Line 4: | ||
== Errors == | == Errors == | ||
− | When | + | 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. |
+ | |||
+ | Build error: | ||
<pre> | <pre> | ||
../marsyas/LPC.cpp: In member function 'virtual void LPC::process(fvec&, fvec&)': | ../marsyas/LPC.cpp: In member function 'virtual void LPC::process(fvec&, fvec&)': | ||
Line 10: | Line 12: | ||
rmat_(i-1,j-1) = corr_(abs((int)(i-j))); | rmat_(i-1,j-1) = corr_(abs((int)(i-j))); | ||
</pre> | </pre> | ||
− | + | ||
+ | Link error: | ||
<pre> | <pre> | ||
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 | 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 |
Revision as of 16:19, 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 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 libxi-dev libxmu-headers libalsaplayer0 freeglut3-dev libxt-dev libsm-dev libice-dev libsndfile1-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:
# 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.