Home    Quick Instructions    Bulletin Board     FAQ    Porting to Mac OS X

Sponsor: Fork Networking - High Quality Dedicated Servers and Server Colocation with 24/7 local support.

Compiling Problems and Solutions

    This document was created by Jon Daniels with lots of help from Jason Trindade.

    Problem: Undefined Macro argument list.

    Solution: Add -no-cpp-precomp to CFLAGS in Makefile.

    Problem: configure: Error: can not guess host type; you must specify one

    Solution: Replace config.sub and config.guess with the ones from /usr/libexec/ and then remove config.cache.

    Problem: gcc called cross compiler without reference.

    Solution:Use --build=powerpc-apple-bsd or whatever you want instead of --host=...

    Problem:My unix applications keep crashing, why?

    Solution:Set the Compiler flags w/ env or using bash to utilize the functions required in the readme. This is ESPECIALLY important for mysql since the version of gcc (called cc) in mac os x supports felide constructors.

    Problem: During Make my compiler stopped after ranlib with a message about symbols.

    Solution:Compilers usually cache their build (the .h files become .o files and the compiler continues from the last point when you run make again.) Sometimes (and for no reason I can figure out) the Make file will try to ranlib a lib and then drop out. To remedy this ranlib <filename> and then type make again (this won't always work, but it does a lot of the time).

    Problem: gcc doesn't work from the command line.

    Solution: Apple has gcc installed as cc. Make symbolic links for gcc to and g++ to the standard locations.

    Make sure you have the directory:
    Check with ls /usr/local and ls /usr/local/bin

    If not you want to create them with:

    mkdir /usr/local
    mkdir /usr/local/bin

    Make symbolic links:

    ln -s /usr/bin/cc /usr/bin/gcc
    ln -s /usr/bin/c++ /usr/bin/g++
    ln -s /usr/bin/cc /usr/local/bin/gcc
    ln -s /usr/bin/c++ /usr/local/bin/g++

    *you want to do this as root

    Problem: Command not found: make [6]

    Solution: Install Apple's Developer Tools
    Note: You can upgrade to the latest Dev Tools version from connect.apple.com

    Problem: ./configure with every path you can think of specified keeps asking for a library or header file inside of a directory. This frequently occurs when including build directories.

    Fix: inside your build directory create a lib and an include directory. Placing libs in the lib one and all header files inside the include one. I recommend copying the files in there, but you may achieve success if you symbolically link them or move them in there.

    Problem: Your compile stops because it cannot find the header file malloc.h

    Solution: Apple has included this functionality elsewhere so we create a dummy file to satisfy the programs dependencies.

    touch malloc.h

    Alternatively you can edit the source and remove the statement:

    #include <malloc.h>

    Optionally you can grab it from any of these locations:




    Problem:I told configure where a file/lib/binary/header was, put lib and include dirs in my build tree and I still get something like:

    checking for <option>....

    Solution: Some configuration scripts wander down an application specific source tree when you specify an option. For example, if you specify --something=/usr/local/include the configure script may look for /usr/local/include/somedir/another/something or ever worse /usr/local/include/local/include/somedir/another/something.

    To fix this you need to either know exactly what configure is looking for or edit the file. Fortunately configuration scripts are USUALLY layed out in blocks where the screen message almost directly precedes the test. So if your option was --with-sysctl then your best bet is to search for sysctl, look beneath is and see the structure it's looking for, then either edit it, feed it the right arguments, or alter the requested files location.

    Problem: Build Location. Configure check complains about build directory location. You won't come across this often, but if you do the fix is simple

    Solution: As root unpack the archive you are building in /

    Problem: 'uint32_t' undeclared. Item is declared differently on platform.

    Solution: replace uint32_t with u_int32_t (this is qnd).

    Problem: Undefined Symbols: _strtok_r

    Solution: Try replacing all occurances of strok_r() with strtok(). You will need to remove the last argument from strtok_r() when you change it. (grep -r strtok_r src/)

    token = strtok_r(NULL, " ", &blah);


    token = strtok(NULL, " ");

    Error: Definition of sys_errlist

    Solution: Edit the code around line 265 of /usr/include/stdio.h so that it looks like this:

    #ifdef mygnudarwindef
    extern __const char *__const sys_errlist[];

    A similar switch can be installed for the bzero definition, if that gives you problems. When you want it to go back to the normal definition, change the ifdef to ifndef.

    Problem: pthread. You may get errors that say you do not have threading on your system.

    Solution: Edit your Makefiles and remove the -lpthread flag from them.
    Darwin has threading capability built-into the OS, it doesn't use an external library.

Mac OS X Ported Software Discussion Archive | Dedicated Servers and Server Colocation