Hello faithfull list,
I have a question reguarding writing externals. Ive never really built anything Ive written myself in linux sence my CSCI classes in college, can someone remind me as to how to build in the linux environment?
LDFLAGS = -Wl,-export-dynamic -lasound -lrt -ljack LIB = -ldl -lm -lpthread -lasound
INCLUDE = -I/usr/local/include BIN_DIR = ../general
EXT= pd_linux
sphere: $(CC) $(LDFLAGS) $(INCLUDE) -o $(BIN_DIR)/sphere~.$(EXT) sphere~.c
but the compiler isint finding my m_pd.h I think, as I get:
gcc -Wl,-export-dynamic -lasound -lrt -ljack -I/usr/local/include -o ../general/fft-bin~.pd_linux fft-bin~.c
/usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../crt1.o(.text+0x18): In function _start\': : undefined reference to
main'
/tmp/ccAyKAvm.o(.text+0xf): In function fftbin_tilde_new\': : undefined reference to
gensym'
etc...
Also, how would I put both of these into one .pd_linux external through linking? Just provide two .c files to be compiled instead of one?
THanks for the help! -thewade
Hallo, thewade hat gesagt: // thewade wrote:
I have a question reguarding writing externals. Ive never really built anything Ive written myself in linux sence my CSCI classes in college, can someone remind me as to how to build in the linux environment?
Heres my makefile
LDFLAGS = -Wl,-export-dynamic -lasound -lrt -ljack
Do you really need link in librt, libjack and libasound?
LIB = -ldl -lm -lpthread -lasound
INCLUDE = -I/usr/local/include BIN_DIR = ../general
EXT= pd_linux
sphere: $(CC) $(LDFLAGS) $(INCLUDE) -o $(BIN_DIR)/sphere~.$(EXT) sphere~.c
fft-bin: $(CC) $(LDFLAGS) $(INCLUDE) -o $(BIN_DIR)/fft-bin~.$(EXT) fft-bin~.
but the compiler isint finding my m_pd.h I think, as I get:
gcc -Wl,-export-dynamic -lasound -lrt -ljack -I/usr/local/include -o ../general/fft-bin~.pd_linux fft-bin~.c /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../crt1.o(.text+0x18): In function
_start\': : undefined reference to
main' /tmp/ccAyKAvm.o(.text+0xf): In functionfftbin_tilde_new\': : undefined reference to
gensym'
I'm no compiler wizard, but I think, your makefile misses the "-c" option in the gcc call. "-c" tells gcc, that you are not building a really application (with "int main() ...") but just a module.
I normally just do copy-paste makefiles. The CVS has some good examples. Probably the easies to reuse could be the one in externals/build/linux/makefile which is used to compile most of the CVS externals. Just drop it into your source dir and try "make".
Frank Barknecht _ ______footils.org__
On Fri, 2 Apr 2004, thewade wrote:
gcc -Wl,-export-dynamic -lasound -lrt -ljack -I/usr/local/include -o ../general/fft-bin~.pd_linux fft-bin~.c /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../crt1.o(.text+0x18): In function
_start\': : undefined reference to
main' /tmp/ccAyKAvm.o(.text+0xf): In functionfftbin_tilde_new\': : undefined reference to
gensym' Also, how would I put both of these into one .pd_linux external through linking? Just provide two .c files to be compiled instead of one?
To build a linux DLL file such as .so's or .pd_linux's, you need to use the -shared option. Otherwise it assumes you want to compile an application, and therefore it looks for main() AND for all functions of PureData that you use in your external.
To build a macosx DLL it's different, it's more like "-bundle -undefined suppress -flat_namespace", because OSX is so much more intuitive.
To build a win32 DLL i don't know.
In any case, "-c" is not relevant here, as it is use to produce an intermediate result file, those that normally have a .o suffix (or .OBJ in windows).
Mathieu Bouchard http://artengine.ca/matju