Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

davbeck

macrumors regular
Original poster
May 16, 2008
104
0
Reno, NV
I am trying to link mysql to my project for limited client access. I installed mysql vie macports and added the libmysqlclient.a file to xcode, and it compiles and runs fine on my machine. I then take the program to any other computer (mac obviously) and it just quits immediately. Running from the command line it points out that it can not link to libmysqlclient.dylib.

How can I compile my program so that the library is included in the executable? (or less desirable, linked to a copy of the library in my bundle).

Note: I am compiling with release settings.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Make sure the library itself isn't linking against something that doesn't exist on other computers besides yours.
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
That happens with pre-built binaries from macports. You have to build from source. Or find a framework for mysql that shouldn't have that probleem
 

davbeck

macrumors regular
Original poster
May 16, 2008
104
0
Reno, NV
OK heres what I did to get it working.
First I found a post about how if you drag the .a file into xcode, it adds the folder for that file into the search path. If there are also dylibs in that folder, it will use them instead of the a. so I placed all of my static libraries into a different folder.
After I did that, it gave me errors about how it was missing functions (from mysql dependancies). So I also linked to all of those libraries in my project. Once I did that it compiled correctly and will now run on other computers.

The problem with macports is annoying though. Any advise on compiling from source with universal? I have had some pretty bad experience trying this (hence the use of macports).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.