How to statically link mpg123?


#1

Hello, I need help linking mpg123 into my Juce app.

 

This is what I have tried.

- Downloaded mpg123-1.20.1 source

- ran "./configure --disable-shared" then "make"

- After failing to find where exactly the .a file compiled to, I did a "make install" and then copied the libmpg123.a file out of my usr/local/lib into a folder with the mpg123.h.

- I then configured Introjucer XCode->External libraries to link = /Users/[Path to lib]/libmpg123.a

- I also added the /Users/[Path to lib] in the Debug and Release as header and library search paths

On compile I get

"ld: library not found for -l/Users/[Path to lib]/libmpg123.a"

 

What obvious thing am I getting wrong here? Also, how should I prepare my Juce project so that I can compile cross platform with mpg123?

Thanks!


#2

mpg123 is only a player, right..? If so, juce already has mp3 decoding classes built-in - see JUCE_USE_MP3AUDIOFORMAT. Or better still, use the OS decoder classes on OSX/Win.

 


#3

I am using it to read id3 tags. My other option is taglib but that's no easier to get working and it doesn't seem to be as active.

I didn't see id3 reading from mp3 (just ogg) in the Juce API so that's why I'm going through all this trouble. Is there an easier way to handle id3 tags cross platform? I'd love to hear it.

thanks

 

EDIT

Following these threads

http://www.juce.com/forum/topic/introjucer-xcodes-link-binary-libraries

http://stackoverflow.com/questions/458805/force-static-linking-of-library-linked-to-xcode-target

I finally managed to compile successfully.

 

to link dynamically, specify "mpg123" (no path) in the "External libraries to link" section.

to link statically, specify "/usr/local/lib/libmpg123.a" in the "Extra linker flags" section

(libmpg123.a appears in /usr/local/lib after "make install")