How to fix csc to generate the right options for static compilation of executables?
Is there a file we can modify before compiling chicken itself to fix the compilation options for Oracle Solaris?
I don't think this is in the Solaris Makefile.
Compiling in verbose mode yields the following output with the -static option.
The c compiler provided with Oracle Studio doesn't like these options and throws an error(below)
$ csc -verbose -static -o hello hello.scm
'/export/home/jopython/cscheme/bin/chicken' 'hello.scm' -output-file 'hello.c' -feature chicken-compile-static -verbose
'cc' 'hello.c' -o 'hello.o' -c -errtags -xdebugformat=stabs -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -g -xO3 -I"/export/home/jopython/cscheme/include/chicken"
rm hello.c
'cc' 'hello.o' -o 'hello' -L"/export/home/jopython/cscheme/lib" -Wl,-R"/export/home/jopython/cscheme/lib" -static '/export/home/jopython/cscheme/lib/libchicken.a' -lsocket -lnsl -lm -ldl -lrt
cc: No valid input files specified, no output generated
Error: shell command terminated with non-zero exit status 256: 'cc' 'hello.o' -o 'hello' -L"/export/home/jopython/cscheme/lib" -Wl,-R"/export/home/jopython/cscheme/lib" -static '/export/home/jopython/cscheme/lib/libchicken.a' -lsocket -lnsl -lm -ldl -lrt
I was able to investigate and find out that the correct options are as follows. Look at the order below and the use of the -Bstatic option:
'cc' 'hello.o' -o 'hello' -L"/export/home/jopython/cscheme/lib" -Wl,-R"/export/home/jopython/cscheme/lib" -lsocket -lnsl -lm -ldl -lrt -Bstatic '/export/home/jopython/cscheme/lib/libchicken.a'