Need help compiling c files

Discussion in 'Mac Programming' started by Paulie87, Mar 10, 2014.

  1. Paulie87 macrumors newbie

    Joined:
    Mar 2, 2014
    #1
    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.
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    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?
     
  3. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #3
    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.
     
  4. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    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.
     
  5. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #5
  6. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #6
    When running the makefile I get 'mysql/mysql.h' file not found
     
  7. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #7
    Willing to buy a beer for anyone who could compile this for me :)
     
  8. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #8
    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
     

    Attached Files:

  9. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #9
    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
     
  10. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #10
    mysql-5.6.16-osx10.7-x86_64.dmg

    Thats the version i downloaded.

    I really appreciate the help mate.
     
  11. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #11
    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?
     
  12. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #12
    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.)
     
  13. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #13
    Im on a mid 2012 MBP non retina, if that makes a difference.
     
  14. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #14
    @ ArtOfWarfare

    I was only asking. As you can see our posts crossed.
     
  15. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #15
    Also /usr/include didn't exist, I had to create the include folder then create the mysql folder as per your instructions.
     
  16. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #16
    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.
     
  17. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #17
    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?
     
  18. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #18
    Stupid English language - I misunderstood when you said "our" as referring to mine and yours, but of course you meant yours and Paulie87's.

    ----------

    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.
     
  19. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #19
    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.
     
  20. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #20
    Did you download the 64bit version?
     
  21. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #21
    Yes
     
  22. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #22
    Well try to use that then
     
  23. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #23
    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]
     
  24. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #24
    The following line implies you did not.

    Code:
    /usr/lib/libmysqlclient.18.dylib: mach-o, but wrong architecture
    
     
  25. Paulie87 thread starter macrumors newbie

    Joined:
    Mar 2, 2014
    #25
    The mysql version I downloaded and used was x86_64
     

Share This Page