libpd / abl_link

Ableton Link integration for Pure Data on desktop and Android.
Other
80 stars 15 forks source link

abl_link~ external won’t compile with libpd #33

Open jrdooley opened 1 year ago

jrdooley commented 1 year ago

system: macOS Monterey 12.5.1 Apple M1 processor

Objective: Compile macOS exectuable of libpd with the abl_link~ external.

Issue: I’m compiling a c++ program based on the libpd c++ rtaudio example using the provided libpd makefile. The code successfully compiles on its own. When I try to compile it with the abl_link~ external, compilation fails. I’m following the C++ instructions as found here

The console spits out the following error:

g++ -o ../../build/formulsengine formulsengine/PdObject.o formulsengine/main.o formulsengine/RtAudio.o ../libs/libpd/libs/libpd.dylib ../libs/libpd/libs/libpd.dylib -framework Foundation -framework CoreAudio
Undefined symbols for architecture arm64:
  "_abl_link_tilde_setup", referenced from:
      init(int, int, int) in main.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [../../build/formulsengine] Error 1

Is this a libpd error or abl_link~ error? I am able to compile the abl_link~ external on its own and load it in regular pd. I have tried loading the compiled external in libpd, but the object doesn’t register/load/instantiate.

umlaeute commented 1 year ago
  1. most likely you just forgot to add the two source-files of the external to your project (they obviously need to be compiled as well) https://github.com/libpd/abl_link/blob/69cfebd6d081eb4f90c13d9df0a67f0684bf1817/external/Makefile#L15

  2. you might also need to add some special flags when building the two files, see: https://github.com/libpd/abl_link/blob/69cfebd6d081eb4f90c13d9df0a67f0684bf1817/external/Makefile#L32-L34 and https://github.com/libpd/abl_link/blob/69cfebd6d081eb4f90c13d9df0a67f0684bf1817/external/Makefile#L23-L24

jrdooley commented 1 year ago

Thanks @umlaeute. I've finally had chance to look at this and try to integrate your suggestions into my code, but I'm still having some issues. I've done what I think is including the source files into the project, though I'm getting the following error now after running the makefile:

make: *** No rule to make target `external/abl_link~.o', needed by \`../../build/formulsengine'.  Stop.

For reference, the makefile I've edited is here: https://github.com/jrdooley/formuls/blob/development/src/formulsengine/Makefile I assume that it needs to be told to create a "abl_link~.pd_darwin" file, though I have to admit that solving this problem seems to have reached the limits of my copy-and-paste coding skills!

umlaeute commented 1 year ago

I assume that it needs to be told to create a "abl_link~.pd_darwin" file

no.

you have to add all the abl_link~ files to your libpd projects: that is, when building libpd you also compile abl_link~ and link everything together into a single libpd that includes the additional object.