I've got the following error when compiling ncar program with Sun
cc and f90 and /usr/ccs/bin/ld.
cc -ansi -O -I/usr/openwin/include -I/usr/include/X11 -DSYSV -
D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped -Di386 -DNeedFuncProto -
cc: Warning: illegal option -nsi
cc: -a conflicts with -dy.
*** Error code 1
make: Fatal error: Command failed for target `cl.o'
After that i've changed the config/SolarisPC file and tried a build with gcc 3.4.3 and f90 but I got
ld fatal: library -lc not found.
I have an old box from 2001 which was under HCL of Solaris 8 x86.
The people at NCAR did not update their configuration files for Solaris 10 x86. The SolarisPC file is old and is using by default g77 as the fortran compiler. Could I mix gcc with f90 ? Which linker should I use in that case?
/usr/ccs/bin/ld or /usr/ucb/ld?
Please refer to the C Users Guide for details of cc command line options. All manuals for Sun Studio 12u1 are listed here:
There is no -ansi option in Sun/Oracle C, nor has there ever been. The compiler attempts to interpret it as -a followed by some other letters, which is why you get a complaint about -a. Remove the option.
Depending on what you expect from the -ansi option, either the default compiler behavior or the -Xc option should work. I suggest trying the default behavior (no -X option). Refer to the manual for details.
Always use the /usr/ccs/bin/ld linker, but you normally should not use the ld linker directly. If you mixing C and Fortran, use the f90 driver to do the linking; it knows what Fortran libraries need to be linked, depending on command line option. When linking a program using only C, use the cc driver to link. Some C command-line options require linking special system files; the cc and f90 drivers know the rules.
To mix Fortran with C, refer to the Fortran Users Guide. I recommend using the Studio C compiler when mixing code, not gcc. The requirements of gcc are not known to the f90 driver, but it does know the requirements of Studio C.
The schema for a mixed Fortran and C program is something like this:
Sorry, I misread your question as applying to C5.10 instead of Studio 10. It does not appear that documentation for Studio 10 is available online. Normal support for Studio 10 ended in Jan 2010, although you can still get Oracle Extended (or Premier) Support for it.
My comments about command-line options and the use of the cc and f90 drivers still apply.