grrrr/flext

dynamically linking externals (using Pd)

umlaeute opened this issue · 7 comments

it seems that i cannot properly link against the dynamic library of flext.

My rough Makefile (i've used make install DESTDIR=/tmp/flex for pseudo-installing flext):

FLEXTDIR=/tmp/flex/usr/local/
CXXFLAGS=-DPD -I$(FLEXTDIR)/include/flext -I/usr/include/pd -fPIC -DPIC
LDFLAGS=-rdynamic -shared -Wl,-rpath,"\$ORIGIN",--enable-new-dtags -fPIC
LIBS=$(LDFLAGS) -L$(FLEXTDIR)/lib -lflext-pd_d

henon.pd_linux: henon.o
    g++ -o $@ $< $(CXXFLAGS) $(LIBS)

henon.o: henon.cpp
    g++ -o $@ -c $< $(CXXFLAGS)

this gives me a nice henon.pd_linux.
But when I run it, it cannot be loaded with the error

./henon.pd_linux: ./henon.pd_linux: undefined symbol: _ZN17flext_base_single4InitEv

which translates to flext_base_single::Init() not being found.

everything works fine when i link against the static version of flext -lflext-pd_s

ah, it seems that for dynamic linking, I have to:

  • define FLEXT_SHARED in the CPPFLAGS
  • link against -lflext-pd only (no idea what libflext-pd-d is for; linking against both crashes Pd during init)
grrrr commented

Exactly right. libflext-pd_d is the debug version.

grrrr commented

Btw., flext can now also be used without linking, by using -D FLEXT_INLINE, where all needed code will be inlined to the external.

ah thanks for clarification about the _d suffix.

-DFLEXT_INLINE doesn't work for me, as the .cpp files are not installed with make install

grrrr commented

Seems you are working with the autoconf files. It's a wonder they work at all ;-)
I will have a look and include the .cpp files to the installation.

grrrr commented

Ok, i believe to have fixed the installation of the .cpp files both for the flext build system and autoconf.

grrrr commented

I think all points are clarified, closing the issue.