cmacosgccneko

Errors while compiling Neko VM OS X


I'm trying to compile the Neko VM on Mac OS X (10.5.7) using GCC 4.01 and I'm completely stuck, because it stops while compiling saying:

vm/threads.c:202: error: conflicting types for 'neko_thread_register'
vm/neko_vm.h:37: error: previous declaration of 'neko_thread_register' was here

I've tried googling this and some say it's because of lack of a "prototype" and some say it's because of a header include being done several times, and I can't really find any of those.

The affected line in threads.c:202 looks like this:

EXTERN bool neko_thread_register( bool t ) {

And the affected line in neko_vm.h:37 looks like this:

EXTERN bool neko_thread_register( bool t );

I can't see any difference in them, besides one of them being the implementation of the other.

The compiler command I'm using is:

cc -Wall -O3 -v -fPIC -fomit-frame-pointer -I vm -D_GNU_SOURCE -arch i386 -L/usr/local/lib -L/opt/local/lib -I/opt/local/include  -o vm/threads.o -c vm/threads.c

I'd appreciate some ideas on what i might be able to do here, I don't really know where to go from here.

A mirror of the code for Neko which I'm trying to compile can be found here.

Thanks!


Solution

  • Have you tried compiling that file alone and outputting the preprocessed version? It could be that the scope or linkage macros are being modified somewhere in between the header file and the implementation file-- the same could be true of the 'bool' type, which is usually a macro defined by a system header.

    According to the GCC 4.2 docs here, you should need to add the -E flag to the compilation line above, and you ought to change -o vm/threads.o to -o vm/threads.i so a file with the correct extension is created (.i means 'preprocessed file', essentially).