Need help compiling c files

Paulie87

macrumors newbie
Original poster
Mar 2, 2014
24
0
Hi, I need a big favour off someone. I'm not too clued up with this, but I've been trying for a few days and can't get it done.

If possible and anyone is willing I need to send some files to be compiled then have the compiled files sent back to me.

If anyone could help please, I would be over the moon.

It is open source code.

Thanks
Paul.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,559
3,966
Hi, I need a big favour off someone. I'm not too clued up with this, but I've been trying for a few days and can't get it done.
Hi Paul. What have you tried? Have you gotten Xcode (free on the Mac App Store) and downloaded/installed the Command Line Tools through it yet?
 

Paulie87

macrumors newbie
Original poster
Mar 2, 2014
24
0
Yes I have Xcode and I do know a bit of objc I've written a couple of apps. I've tried compiling in Xcode and through terminal, it throws errors of MySQL.h, and a few others. I've added these files but still can't get it to compile. It's 10 year old code so I'm not sure which version of MySQL it needs. I was hoping someone would be kind enough to look through it for me and see what's what.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,559
3,966
it throws errors of MySQL.h, and a few others. I've added these files but still can't get it to compile.
What errors? What files did you add and where did you add them?

Also, do you realize you've not yet actually shared any link to this project?

Have you tried looking up this project on Brew or MacPort? I generally just type "brew install <name>" whenever I want something on my computer (I don't even look up whether it's on Brew) and more often than not, brew has it and installs without any complaints.
 

kryten2

macrumors 6502a
Mar 17, 2012
995
59
Belgium
Willing to buy a beer for anyone who could compile this for me :)
I compiled it on Leopard 10.5.8 PPC. These are the steps I did :

  1. Downloaded mysql-5.1.33-osx10.5-powerpc.dmg from http://dev.mysql.com/downloads/mysql/for my architecture. Yours will probably be different!
  2. Downloaded nezbit-code-19-trunk.zip from the link you posted.
  3. Opened mysql-5.1.33-osx10.5-powerpc.pkg from mysql-5.1.33-osx10.5-powerpc.dmg with Pacifist.
  4. Created directory mysql in /usr/include eg /usr/include/mysql
  5. Copied all header files from the include folder in mysql-5.1.33-osx10.5-powerpc.pkg to /usr/include/mysql
  6. Copied the libmysqlclient.a file from the lib folder in mysql-5.1.33-osx10.5-powerpc.pkg to /usr/lib
  7. Changed the -lcrypt in the LIB = -lmysqlclient -lcrypt -lz line in the Makefile to -lcrypto
  8. Cd to the folder where you unzipped the nezbit-code-19-trunk.zip file.
  9. make all
 

Attachments

Paulie87

macrumors newbie
Original poster
Mar 2, 2014
24
0
Ive followed these steps and I'm still getting this error

Pauls-MacBook-Pro:ticker paulprice$ make all
gcc -O3 -g -Wall -c -o ticker.o ticker.c
ticker.c:29:10: fatal error: 'mysql/mysql.h' file not found
#include <mysql/mysql.h>
^
1 error generated.
make: *** [ticker.o] Error 1

I'm on Mavericks 10.9.1
 

Paulie87

macrumors newbie
Original poster
Mar 2, 2014
24
0
mysql-5.6.16-osx10.7-x86_64.dmg

Thats the version i downloaded.

I really appreciate the help mate.
 

kryten2

macrumors 6502a
Mar 17, 2012
995
59
Belgium
I'm surfing a bit right now on my trusty old Leopard PPC machine and also watching a movie with one eye but I'll try to compile it later on my Mavericks 10.9.2. I'll let you know if it was successful. You might want to consider to upgrade to 10.9.2.

Note : You did download the right mySQL for your architecture right?
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,559
3,966
Note : You did download the right mySQL for your architecture right?
Are there any 32-bit Macs that run Mavericks (he specified that he got mysql-5.6.16-osx10.7-86_64 which is presumably the right version for 64-bit Macs running Lion and newer.)
 

Paulie87

macrumors newbie
Original poster
Mar 2, 2014
24
0
Also /usr/include didn't exist, I had to create the include folder then create the mysql folder as per your instructions.
 

kryten2

macrumors 6502a
Mar 17, 2012
995
59
Belgium
Don't forget I did this on Leopard. I didn't give any instructions I merely stated the steps taken to get it to compile on my machine. Things change on every release of OS X. I believe everything is located inside the Xcode application folder now but I'll have to look. Going to watch my movie now.
 

Paulie87

macrumors newbie
Original poster
Mar 2, 2014
24
0
i managed to get it to compile when running the program i get this error.

dyld: Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/Documents/MyPHPpa/ticker/ticker
Reason: no suitable image found. Did find:
/usr/lib/libmysqlclient.18.dylib: mach-o, but wrong architecture
Trace/BPT trap: 5
logout

[Process completed]


any ideas on a fix? is it just a case of using a 32bit mysql version and recompiling?
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,559
3,966
As you can see our posts crossed.
Stupid English language - I misunderstood when you said "our" as referring to mine and yours, but of course you meant yours and Paulie87's.

----------

i managed to get it to compile when running the program i get this error.

dyld: Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/Documents/MyPHPpa/ticker/ticker
Reason: no suitable image found. Did find:
/usr/lib/libmysqlclient.18.dylib: mach-o, but wrong architecture
Trace/BPT trap: 5
logout

[Process completed]


any ideas on a fix? is it just a case of using a 32bit mysql version and recompiling?
This would indicate that your binary is of one architecture and the library is of a different one. Unless I'm mistaken, 32bit mysql should run fine on a 64bit Mac, so using 32bit mysql should work fine for you.

Alternatively, you could try modifying the make script to make a 64bit binary instead.
 

Paulie87

macrumors newbie
Original poster
Mar 2, 2014
24
0
Just tried to use a 32bit version, and and got an error of symbol not found for architecture x86_64

How do I go about modifying the makefile for a 64bit binary? If you don't mind, sorry for taking up so much of your time.
 

subsonix

macrumors 68040
Feb 2, 2008
3,551
79
Just tried to use a 32bit version, and and got an error of symbol not found for architecture x86_64

How do I go about modifying the makefile for a 64bit binary? If you don't mind, sorry for taking up so much of your time.
Did you download the 64bit version?
 

Paulie87

macrumors newbie
Original poster
Mar 2, 2014
24
0
Well try to use that then
i have done, but when i try to run the program i get this result.

dyld: Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/paulprice/Documents/MyPHPpa/ticker/ticker
Reason: no suitable image found. Did find:
/usr/lib/libmysqlclient.18.dylib: mach-o, but wrong architecture
Trace/BPT trap: 5
logout

[Process completed]
 

subsonix

macrumors 68040
Feb 2, 2008
3,551
79
i have done, but when i try to run the program i get this result.

dyld: Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/paulprice/Documents/MyPHPpa/ticker/ticker
Reason: no suitable image found. Did find:
/usr/lib/libmysqlclient.18.dylib: mach-o, but wrong architecture
Trace/BPT trap: 5
logout

[Process completed]
The following line implies you did not.

Code:
/usr/lib/libmysqlclient.18.dylib: mach-o, but wrong architecture