xiph / rnnoise

Recurrent neural network for audio noise reduction
BSD 3-Clause "New" or "Revised" License
4.05k stars 895 forks source link

Clashing symbols with Opus #165

Open Krzmbrzl opened 3 years ago

Krzmbrzl commented 3 years ago

Hi, We are developing a program (Mumble) that uses Opus as well as RNNoise. The issue we are facing is that RNNoise seems to define some symbols that are identical to Opus, causing a linker error like this one:

src/mumble/rnnoise/librnnoise.a(rnn.c.o): In function `compute_dense':
rnn.c:(.text+0x0): multiple definition of `compute_dense'
/home/user/MumbleBuild/vcpkg/installed/x64-linux/lib/libopus.a(mlp.c.o):mlp.c:(.text+0x0): first defined here
src/mumble/rnnoise/librnnoise.a(rnn.c.o): In function `compute_gru':
rnn.c:(.text+0x590): multiple definition of `compute_gru'
/home/user/MumbleBuild/vcpkg/installed/x64-linux/lib/libopus.a(mlp.c.o):mlp.c:(.text+0x690): first defined here
src/mumble/rnnoise/librnnoise.a(kiss_fft.c.o): In function `opus_fft_impl':
kiss_fft.c:(.text+0x2900): multiple definition of `opus_fft_impl'
/home/user/MumbleBuild/vcpkg/installed/x64-linux/lib/libopus.a(kiss_fft.c.o):kiss_fft.c:(.text+0x0): first defined here
src/mumble/rnnoise/librnnoise.a(kiss_fft.c.o): In function `opus_fft_c':
kiss_fft.c:(.text+0x39d0): multiple definition of `opus_fft_c'
/home/user/MumbleBuild/vcpkg/installed/x64-linux/lib/libopus.a(kiss_fft.c.o):kiss_fft.c:(.text+0x1090): first defined here
src/mumble/rnnoise/librnnoise.a(kiss_fft.c.o): In function `opus_ifft_c':
kiss_fft.c:(.text+0x3a30): multiple definition of `opus_ifft_c'
/home/user/MumbleBuild/vcpkg/installed/x64-linux/lib/libopus.a(kiss_fft.c.o):kiss_fft.c:(.text+0x1110): first defined here

Given that there even is a clash on something like opus_fft_impl I can't help but think that maybe some parts of the Opus code were used in this project without altering their name?

Without knowing any details about the code structure here, my suggestion would be to either rename those functions within RNNoise (e.g. prefix with rnnoise_) or exclude these functions (e.g. via preprocessor) if one also intends to link against Opus.

/cc @davidebeatrici

davidebeatrici commented 3 years ago

More specifically, we load Opus at runtime.

The problem is that we link to libsndfile, which internally links to Opus.

According to 3fe8622bca1ac970b880008013a01b436d1ff597, the code is directly imported from Opus.

Krzmbrzl commented 3 years ago

I just noticed that there seems to be an issue on GitLab that goes in the same direction.

DingkangWangFB commented 3 years ago

Same problem happens when there is some dependency on Opus. Any update on resolving this issue?

MarkTiukov commented 2 years ago

I'm running into the same problem. Any updates over last year?

Krzmbrzl commented 2 years ago

Not that I am aware of