﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
1350	Static linking is broken on Solaris	evhan		"While testing Peter's fix for #1347, I found that static linking is totally broken on Solaris.

In particular, our linking tests fail on both Solaris 10 and 11 (gcc, i386 -- I haven't tried with any other compiler or architecture), albeit with slightly different error messages. The underlying issue might be the same, however, since they both fail in the same situations.

Note that this problem isn't caused by the fix for #1347; both c4c60ce5 and 4.12.0 fail in the same way, so this was a preexisting bug.

Try running the following command to see the problem:

{{{
$ echo '(print 1)' | csc -static -o /tmp/a.out -
}}}

Test output on Solaris 10:

{{{
==> solaris-solaris-10-i386: ======================================== linking tests ...
==> solaris-solaris-10-i386: [... snip ...]
==> solaris-solaris-10-i386: /export/home/vagrant/chicken-core/tests/../chicken 'linking-tests.scm' -output-file 'linking-tests.c' -feature chicken-compile-static -verbose -include-path /export/home/vagrant/chicken-core/tests/.. -uses reverser
==> solaris-solaris-10-i386: 'gcc' 'linking-tests.c' -o 'linking-tests.o' -c  -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer -I/export/home/vagrant/chicken-core/tests/.. -I/export/home/vagrant/chicken-core/tests/../include/chicken/
==> solaris-solaris-10-i386: rm linking-tests.c
==> solaris-solaris-10-i386: 'gcc' 'linking-tests.o' 'reverser.o' -o 'linking-tests' -L/export/home/vagrant/chicken-core/tests/.. -L/export/home/vagrant/chicken-core/tests/../lib/  -Wl,-R'/export/home/vagrant/chicken-core/lib/' -static -lchicken -lsocket -lnsl -lm -ldl -lrt
==> solaris-solaris-10-i386: ld: fatal: library -lsocket: not found
==> solaris-solaris-10-i386: ld: fatal: library -lnsl: not found
==> solaris-solaris-10-i386: ld: fatal: library -lm: not found
==> solaris-solaris-10-i386: ld: fatal: library -ldl: not found
==> solaris-solaris-10-i386: ld: fatal: library -lrt: not found
==> solaris-solaris-10-i386: ld: fatal: library -lc: not found
==> solaris-solaris-10-i386: ld: fatal: file processing errors. No output written to linking-tests
==> solaris-solaris-10-i386: Error: shell command terminated with non-zero exit status 256: 'gcc' 'linking-tests.o' 'reverser.o' -o 'linking-tests' -L/export/home/vagrant/chicken-core/tests/.. -L/export/home/vagrant/chicken-core/tests/../lib/  -Wl,-R'/export/home/vagrant/chicken-core/lib/' -static -lchicken -lsocket -lnsl -lm -ldl -lrt
}}}

Test output on Solaris 11:

{{{
==> solaris-solaris-11-i386: ======================================== linking tests ...
==> solaris-solaris-11-i386: [... snip ...]
==> solaris-solaris-11-i386: /export/home/vagrant/chicken-core/tests/../chicken 'linking-tests.scm' -output-file 'linking-tests.c' -feature chicken-compile-static -verbose -include-path /export/home/vagrant/chicken-core/tests/.. -uses reverser
==> solaris-solaris-11-i386: 'gcc' 'linking-tests.c' -o 'linking-tests.o' -c  -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer -I/export/home/vagrant/chicken-core/tests/.. -I/export/home/vagrant/chicken-core/tests/../include/chicken/
==> solaris-solaris-11-i386: rm linking-tests.c
==> solaris-solaris-11-i386: 'gcc' 'linking-tests.o' 'reverser.o' -o 'linking-tests' -L/export/home/vagrant/chicken-core/tests/.. -L/export/home/vagrant/chicken-core/tests/../lib/  -Wl,-R'/export/home/vagrant/chicken-core/lib/' -static -lchicken -lsocket -lnsl -lm -ldl -lrt
==> solaris-solaris-11-i386: ld: fatal: option '-R/export/home/vagrant/chicken-core/lib/' is incompatible with building a static executable
==> solaris-solaris-11-i386: 
==> solaris-solaris-11-i386: Error: shell command terminated with non-zero exit status 256: 'gcc' 'linking-tests.o' 'reverser.o' -o 'linking-tests' -L/export/home/vagrant/chicken-core/tests/.. -L/export/home/vagrant/chicken-core/tests/../lib/  -Wl,-R'/export/home/vagrant/chicken-core/lib/' -static -lchicken -lsocket -lnsl -lm -ldl -lrt
}}}"	defect	new	major	someday	unknown	4.12.0		static solaric ld linker		medium
