It seems that Mac OS X does not fully support building static binaries. From the gcc man page:

-static
On systems that support dynamic linking, this prevents linking with
the shared libraries. On other systems, this option has no effect.


This option will not work on Mac OS X unless all libraries (includ-
ing libgcc.a) have also been compiled with -static. Since neither
a static version of libSystem.dylib nor crt0.o are provided, this
option is not useful to most people.


Because csc explicitly passes the names of the static chicken libraries as arguments to gcc, it is still possible to build executables that contain everything related to chicken using the - static flag. I patched the csc.scm.in file to not issue the -static flag to gcc on Mac OS X in that case.

*** csc.scm.in Thu May 5 19:45:56 2005
--- csc.scm.in.patched Thu May 5 19:43:36 2005
***************
*** 719,725 ****
(string-append link-output-flag (cleanup- filename target-filename))
(append linking-optimization-options files link-options) )
" ")
! (if (and static (not win)) " -static " "")
(if static extra-libraries extra-shared-libraries) ) ) )
(exit last-exit-code) )
(when (and win (not static) (not shared))
--- 719,725 ----
(string-append link-output-flag (cleanup- filename target-filename))
(append linking-optimization-options files link-options) )
" ")
! (if (and static (not win) (not osx)) " -static " "")
(if static extra-libraries extra-shared-libraries) ) ) )
(exit last-exit-code) )
(when (and win (not static) (not shared))


Regards
Henrik

On 2005-03-05, at 08:43, felix winkelmann wrote:

Hm... I have no idea (and no OS X system to test it).

Can somebody with access to a Mac confirm this problem?


cheers, felix

On 5/2/05, Henrik Tramberend <[EMAIL PROTECTED] hannover.de> wrote:

Hi,

i seem to be unable to compile a static chicken executable on Mac OS X.


csc -v -static static.scm

/opt/chicken/bin/chicken static.scm -output-file static.c -feature
chicken-compile-static -quiet
gcc static.c -o static.o -g -DHAVE_CHICKEN_CONFIG_H -c -
DC_NO_PIC_NO_DLL -I /opt/chicken/include
rm static.c
gcc -o static static.o /opt/chicken/lib/libchicken.a -L/opt/chicken/
lib -static  -ldl -lm
/usr/bin/ld: can't locate file for: -lcrt0.o
collect2: ld returned 1 exit status
*** Shell command terminated with exit status 1: gcc -o static
static.o /opt/chicken/lib/libchicken.a -L/opt/chicken/lib -static  -
ldl -lm

Any idea what might be wrong here?

Regards
Henrik

_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users







_______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to