Problems compiling in MacOSX 10.6

artblanc wrote on Sunday, November 22, 2009:

I’m getting a problem compiling the current trunk version (2.7-pre) under
MacOSX 10.6 (Snow Leopard).

Well, actually is not the library, is it’s linkage with the other apps.

I had to add a -arch i386 to the makefiles.

I was getting a:
ld: warning: in …/lib/cocoa/libglfw.a, file is not of required architecture

elmindreda wrote on Sunday, November 22, 2009:

Am I correct in assuming then that the Snow Leopard compiler(s) default to
generating 64-bit code even on 32-bit systems?

artblanc wrote on Sunday, November 22, 2009:

The thing is that I needed to add a -arch i386 in the Makefile.cocoa of the
trunk/lib/cocoa and in the Makefile.cocoa of trunk/examples.

But now I realize that the compilation didn’t finished because the
Makefile.cocoa in /trunk/tests has a flag:

CFLAGS = -I…/include -m32

that was asking for a 32 bit version.

If I remove this -m32 everything is compiling and I don’t need to add the
-arch i386 to build the trunk (lib + examples + tests).

About which is the default architecture by default… I’m a little bit confused
about this.
If I try to link the default compiled library (not adding de -arch i386)
with my App I still have some architecture problems.

If I want to produce a 32 bits app I get another
ld: warning: in …/lib/cocoa/libglfw.a, file is not of required architecture

But if I configure my project to produce a 64 bits app I get a linker error:

“_objc_msgSendSuper2”, referenced from:
- in libglfw.a(cocoa_window.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status

The only way I could link the library with my App with success was adding a
-arch i386 on glfw makefiles and build my app as a 32 bit app.

So It seems you are right in some way about assuming that I’m getting a 64-bit
code by default.

I will try to learn something more about this.

artblanc wrote on Sunday, November 22, 2009:

The linker error I got compiling with 64 bit:

“objcmsgSendSuper2”, referenced from: - in libglfw.a(cocoa_window.o) ld:
symbol(s) not found collect2: ld returned 1 exit status

Disappear if I compile my app with SDK 10.6 (I was compiling with SDK 10.5).
Now everything is compiling.

I still have to think on all the implications of this :slight_smile: