[PD] compiling external in Linux

IOhannes m zmoelnig zmoelnig at iem.at
Tue Jul 8 08:55:44 CEST 2008

Jaime Oliver wrote:
> Hello all,
> I am trying to compile a simple external (non-signal one) in Fedora in 
> the following way:
> I put a folder with the .c file, m_pd.h and the makefile (attached) in 
> the extra folder,

it is _really_ bad style to bundle the m_pd.h file with your code.
imo, the more correct way would be to tell the compiler where to find 
the header-file (that is matching the Pd installation on your system)
you can do so by adding the "-I" flag to the compiler flags; if you have 
installed Pd properly, you should find the m_pd.h file either in 
/usr/include or in /usr/local/include anyhow.

if you have everything in <pd>/extra/analista it should find the header 
in <pd>/src/ already, as you already have the "-I../../src" added.

> [joliverl at maquina analista]$ make pd_linux
> cc -DPD -O2 -funroll-loops -fomit-frame-pointer -Wall -W -Wshadow 
> -Wstrict-prototypes -Werror -Wno-unused -Wno-parentheses -Wno-switch 
> -I../../src -o analista.o -c analista.c
> ld -export_dynamic  -shared -o analista.pd_linux analista.o -lc -lm
> ld: analista.o: relocation R_X86_64_32 against `a local symbol' can not 
> be used when making a shared object; recompile with -fPIC

the error message is very clear here: "recompile with -fPIC".
edit the makefile and add "-fPIC" to the compiler-flags (usually: 
CFLAGS) and re-compile.
this is needed only on x86_64 (your skeleton makefile seems to be done 
for i386 only, so it's missing this flags), but it doesn't really hurt 
on i386.

> analista.o: could not read symbols: Bad value
> make: *** [analista.pd_linux] Error 1
> ------------------------------------------------------------------------
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list

More information about the Pd-list mailing list