margalo
margalo

Reputation: 138

Changes to linked library code not showing up when Juce program is built in Xcode

I am trying to include a library (LAME) in my Juce audio plugin, but want to be able to make some changes to the library code. However, when I make changes to the LAME library source code and make it, the changes are not reflected when I build my plugin in Xcode!

In the Projucer settings, I’ve included the path to my local copy of LAME in “Header Search Paths.” In the Xcode exporter part of the projucer, I’ve included -I<path to my local copy of lame>/include in Extra Compiler Flags, -L<path to my local copy of lame>/libmp3lame/.libs in Extra Linker Flags, and mp3lame in External Libraries to link. LAME has a makefile, when I run make for my local copy of LAME, it builds the libraries, Xcode is able to find them, and my plugin can build and run correctly. When I run make clean for the LAME makefile, it removes the libraries, and my plugin doesn’t build, with error library not found for -lmp3lame, as expected.

However, changes I make to the LAME library source code are not reflected when I run my plugin. For instance, my plugin calls the function lame_encode_buffer_interleaved_ieee_float() from LAME. I changed the body of that function to be simply printf("in encode function\n");return 0;, ran make, and then built my plugin. The function ran as it did before, returning non-zero values and printing nothing. My changes had no effect.

How can I fix this, so that changes I make to LAME show up when I build my plugin? Does Xcode cache libraries in some way, and can I override that to get it to link the changed version of the library?

Upvotes: 0

Views: 175

Answers (1)

margalo
margalo

Reputation: 138

The issue turned out to be that while I thought I was linking the local copy of LAME, I was actually linking the lame library in /usr/local/lib/. The reason it wasn't building when I ran make clean was because the clean command removed the header file that I was including with the -I flag. To solve this, I swapped out -L<path to my local copy of lame>/libmp3lame/.libs for <path to my local copy of lame>/libmp3lame/.libs/libmp3lame.a, and removed mp3lame from external libraries to link, telling the linker explicitly which library to link.

Upvotes: 0

Related Questions