Problems linking libsdl in MacOs

Hello,

Im having a problem in the linking stage of a very simple SDL test program.

I use Mac Os 10.3, with Xcode 1.5 installed.

When I compile with GCC, the compilation works but in the linking stage
I get following error:

ld: /usr/lib/crt1.o illegal reference to symbol: __objInit defined in
indirectly referenced dynamic library /usr/lib/libobjc.A.dylib

btw, I get same error wheter I use the standard sdl-devl installation or
the fink unix package.

thanks in advance,

M.–
Manuel Astudillo
Software Engineer

Scalado AB
Ideon Research Park, Beta 4
Scheelev?gen 17
SE-223 70 Lund
Sweden

Phone: +46(0)46 2864259
Mobile: +46(0)733 329536
Fax: +46(0)46 2864257
@Manuel_Astudillo

?The information in this email, and attachment(s) thereto, is strictly
confidential and may be legally privileged. It is intended solely for
the named recipient(s), and access to this e-mail, or any attachment(s)
thereto, by anyone else is unauthorized.

Violations hereof may result in legal actions. Any attachment(s) to this
e-mail has been checked for viruses, but please rely on your own
virus-checker and procedures.

If you contact us by e-mail, we will store your name and address to
facilitate communications in the matter concerned. If you do not consent
to us storing your name and address for above stated purpose, please
notify the sender promptly. Also, if you are not the intended recipient
please inform the sender by replying to this transmission, and delete
the e-mail, its attachment(s), and any copies of it, without disclosing
it.?
-------------- next part --------------
A non-text attachment was scrubbed…
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050705/c79edb44/attachment.pgp

Manuel Astudillo wrote:

Im having a problem in the linking stage of a very simple SDL test program.

I use Mac Os 10.3, with Xcode 1.5 installed.

When I compile with GCC, the compilation works but in the linking stage
I get following error:

ld: /usr/lib/crt1.o illegal reference to symbol: __objInit defined in
indirectly referenced dynamic library /usr/lib/libobjc.A.dylib

btw, I get same error wheter I use the standard sdl-devl installation or
the fink unix package.

You forgot to use the sdl-config program (or template Xcode projects),
and thus you are not passing all the required flags to the linker.

In this case, it is missing the Objective-C runtime library - which
in turn is required by the Cocoa framework used in the “Quartz” driver.

You should add a gcc (or LDFLAGS) setting of: sdl-config --libs,
just as you should add a sdl-config --cflags to your CFLAGS…

Unfortunately the “sdl-config” script is missing from the current
framework package, but you do get it when you compile SDL yourself.

–anders

Hi,

thanks for the quick response. Unfortunatelly, I cannot make it work either.
Im using scons as build system (which has complications on its on), but
when I run sdl-config --libs I just get following flags:
-L/sw/lib -lSDL -framework Cocoa -framework OpenGL

Using this flags when linking does not make things anything better…

Here: http://gpwiki.org/index.php/C:How_to_set_up_your_SDL_Build_Environment

they explain how to set up scons, but I think there must be some bug in
scons since it does not parse correctly the flags from sdl-config (the
-framework flag for example is being totally ignored).

Any other ideas? :slight_smile:

M.

Anders F Bj?rklund wrote:> Manuel Astudillo wrote:

Im having a problem in the linking stage of a very simple SDL test
program.

I use Mac Os 10.3, with Xcode 1.5 installed.

When I compile with GCC, the compilation works but in the linking stage
I get following error:

ld: /usr/lib/crt1.o illegal reference to symbol: __objInit defined in
indirectly referenced dynamic library /usr/lib/libobjc.A.dylib

btw, I get same error wheter I use the standard sdl-devl installation or
the fink unix package.

You forgot to use the sdl-config program (or template Xcode projects),
and thus you are not passing all the required flags to the linker.

In this case, it is missing the Objective-C runtime library - which
in turn is required by the Cocoa framework used in the “Quartz” driver.

You should add a gcc (or LDFLAGS) setting of: sdl-config --libs,
just as you should add a sdl-config --cflags to your CFLAGS…

Unfortunately the “sdl-config” script is missing from the current
framework package, but you do get it when you compile SDL yourself.

–anders


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Manuel Astudillo
Software Engineer

Scalado AB
Ideon Research Park, Beta 4
Scheelev?gen 17
SE-223 70 Lund
Sweden

Phone: +46(0)46 2864259
Mobile: +46(0)733 329536
Fax: +46(0)46 2864257
@Manuel_Astudillo

?The information in this email, and attachment(s) thereto, is strictly
confidential and may be legally privileged. It is intended solely for
the named recipient(s), and access to this e-mail, or any attachment(s)
thereto, by anyone else is unauthorized.

Violations hereof may result in legal actions. Any attachment(s) to this
e-mail has been checked for viruses, but please rely on your own
virus-checker and procedures.

If you contact us by e-mail, we will store your name and address to
facilitate communications in the matter concerned. If you do not consent
to us storing your name and address for above stated purpose, please
notify the sender promptly. Also, if you are not the intended recipient
please inform the sender by replying to this transmission, and delete
the e-mail, its attachment(s), and any copies of it, without disclosing
it.?
-------------- next part --------------
A non-text attachment was scrubbed…
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050705/5b448c09/attachment.pgp

hi again,

sorry for the previous email. I actually managed to fix it. It was a bug
in scons ParseConfig function. It does not parse correctly the
-framework option.

thanks for your help,

M.

Anders F Bj?rklund wrote:> Manuel Astudillo wrote:

Im having a problem in the linking stage of a very simple SDL test
program.

I use Mac Os 10.3, with Xcode 1.5 installed.

When I compile with GCC, the compilation works but in the linking stage
I get following error:

ld: /usr/lib/crt1.o illegal reference to symbol: __objInit defined in
indirectly referenced dynamic library /usr/lib/libobjc.A.dylib

btw, I get same error wheter I use the standard sdl-devl installation or
the fink unix package.

You forgot to use the sdl-config program (or template Xcode projects),
and thus you are not passing all the required flags to the linker.

In this case, it is missing the Objective-C runtime library - which
in turn is required by the Cocoa framework used in the “Quartz” driver.

You should add a gcc (or LDFLAGS) setting of: sdl-config --libs,
just as you should add a sdl-config --cflags to your CFLAGS…

Unfortunately the “sdl-config” script is missing from the current
framework package, but you do get it when you compile SDL yourself.

–anders


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Manuel Astudillo
Software Engineer

Scalado AB
Ideon Research Park, Beta 4
Scheelev?gen 17
SE-223 70 Lund
Sweden

Phone: +46(0)46 2864259
Mobile: +46(0)733 329536
Fax: +46(0)46 2864257
@Manuel_Astudillo

?The information in this email, and attachment(s) thereto, is strictly
confidential and may be legally privileged. It is intended solely for
the named recipient(s), and access to this e-mail, or any attachment(s)
thereto, by anyone else is unauthorized.

Violations hereof may result in legal actions. Any attachment(s) to this
e-mail has been checked for viruses, but please rely on your own
virus-checker and procedures.

If you contact us by e-mail, we will store your name and address to
facilitate communications in the matter concerned. If you do not consent
to us storing your name and address for above stated purpose, please
notify the sender promptly. Also, if you are not the intended recipient
please inform the sender by replying to this transmission, and delete
the e-mail, its attachment(s), and any copies of it, without disclosing
it.?
-------------- next part --------------
A non-text attachment was scrubbed…
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050705/9150b22b/attachment.pgp

Manuel Astudillo wrote:

Im using scons as build system (which has complications on its on), but
when I run sdl-config --libs I just get following flags:
-L/sw/lib -lSDL -framework Cocoa -framework OpenGL

That sounds like it could be enough, I have some more features and a:
-L/usr/local/lib -lSDLmain -lSDL -framework Cocoa -framework Carbon
-framework OpenGL

(I am running a patched SDL 1.2.9 from CVS, with some extra drivers)

Using this flags when linking does not make things anything better…

It should… If you still get the original error, which you shouldn’t
when you explicitly include Cocoa - you can always add an extra -lobjc ?

Here:
http://gpwiki.org/index.php/C:How_to_set_up_your_SDL_Build_Environment

they explain how to set up scons, but I think there must be some bug in
scons since it does not parse correctly the flags from sdl-config (the
-framework flag for example is being totally ignored).

Tools for other systems usually have no idea about the NeXT frameworks.
But in those instructions it says to use the templates ? (with FLAGS)

I have planned to do new SDL installers, but haven’t gotten around yet.

–anders