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

make can't find dlopen, dlclose and dlsym #48

Open
znmeb opened this issue Aug 8, 2023 · 2 comments
Open

make can't find dlopen, dlclose and dlsym #48

znmeb opened this issue Aug 8, 2023 · 2 comments
Labels

Comments

@znmeb
Copy link

znmeb commented Aug 8, 2023

This is on Debian bullseye/ x86_64, gcc is gcc (Debian 10.2.1-6) 10.2.1 20210110

❯ git clone https://github.com/bwhitman/amy.git
Cloning into 'amy'...
remote: Enumerating objects: 624, done.
remote: Counting objects: 100% (210/210), done.
remote: Compressing objects: 100% (118/118), done.
remote: Total 624 (delta 134), reused 134 (delta 92), pack-reused 414
Receiving objects: 100% (624/624), 21.13 MiB | 19.98 MiB/s, done.
Resolving deltas: 100% (386/386), done.
❯ cd amy
❯ make
gcc -g -Wall -Wno-strict-aliasing  -I. -c src/algorithms.c -o src/algorithms.o
gcc -g -Wall -Wno-strict-aliasing  -I. -c src/amy.c -o src/amy.o
gcc -g -Wall -Wno-strict-aliasing  -I. -c src/envelope.c -o src/envelope.o
gcc -g -Wall -Wno-strict-aliasing  -I. -c src/delay.c -o src/delay.o
gcc -g -Wall -Wno-strict-aliasing  -I. -c src/filters.c -o src/filters.o
gcc -g -Wall -Wno-strict-aliasing  -I. -c src/oscillators.c -o src/oscillators.o
gcc -g -Wall -Wno-strict-aliasing  -I. -c src/pcm.c -o src/pcm.o
gcc -g -Wall -Wno-strict-aliasing  -I. -c src/partials.c -o src/partials.o
gcc -g -Wall -Wno-strict-aliasing  -I. -c src/libminiaudio-audio.c -o src/libminiaudio-audio.o
gcc -g -Wall -Wno-strict-aliasing  -I. -c src/amy-example-esp32.c -o src/amy-example-esp32.o
gcc -g -Wall -Wno-strict-aliasing  -I. -c src/amy-example.c -o src/amy-example.o
gcc  src/algorithms.o  src/amy.o  src/envelope.o  src/delay.o  src/filters.o  src/oscillators.o  src/pcm.o  src/partials.o  src/libminiaudio-audio.o  src/amy-example-esp32.o src/amy-example.o -Wall -lpthread  -lm -o amy-example
/usr/bin/ld: src/libminiaudio-audio.o: in function `ma_dlopen':
/home/znmeb/amy/src/miniaudio.h:17734: undefined reference to `dlopen'
/usr/bin/ld: src/libminiaudio-audio.o: in function `ma_dlclose':
/home/znmeb/amy/src/miniaudio.h:17754: undefined reference to `dlclose'
/usr/bin/ld: src/libminiaudio-audio.o: in function `ma_dlsym':
/home/znmeb/amy/src/miniaudio.h:17773: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make: *** [Makefile:40: amy-example] Error 1

❯ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This Stack Overflow might be relevant but I haven't tried it:

https://stackoverflow.com/questions/20369672/undefined-reference-to-dlsym

@bwhitman
Copy link
Collaborator

Thanks! Adding-ldl to LIBS should fix this, so line 4 of Makefile would be:

LIBS = -lpthread  -lm -ldl

We do check for this but it looks like only on RPIs. I've tested AMY on Ubuntu which didn't need it, but maybe straight Debian does. Unclear if we can detect the need for it, or always include it? I'm not too familiar with all the Linux flavors and how they differ.

@znmeb
Copy link
Author

znmeb commented Aug 10, 2023

Always including it shouldn't hurt anything.

@bwhitman bwhitman added the port label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants