Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abl_link~ external won’t compile with libpd #33

Open
jrdooley opened this issue Aug 31, 2022 · 3 comments
Open

abl_link~ external won’t compile with libpd #33

jrdooley opened this issue Aug 31, 2022 · 3 comments

Comments

@jrdooley
Copy link

jrdooley commented Aug 31, 2022

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
Copy link
Collaborator

  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)

    abl_link~.class.sources = abl_link~.cpp abl_link_instance.cpp

  2. you might also need to add some special flags when building the two files, see:

    define forDarwin
    cflags += -DLINK_PLATFORM_MACOSX=1 -mmacosx-version-min=10.9
    endef

    and
    cflags = -std=c++11 -I$(LINK_INCLUDES) \
    -I$(ASIO_INCLUDES) -Wno-multichar

@jrdooley
Copy link
Author

jrdooley commented Sep 7, 2022

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
Copy link
Collaborator

umlaeute commented Sep 7, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants