shorepine / amy

AMY - the Additive Music synthesizer librarY

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`make` can't find `dlopen`, `dlclose` and `dlsym`

znmeb opened this issue · comments

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

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.

Always including it shouldn't hurt anything.