This discussion is archived
3 Replies Latest reply: Nov 7, 2011 7:49 PM by user12616316 RSS

Building NCAR Graphics 5.2.1 on Solaris 10 x86u9 under Sun Studio 10 (2005)

898286 Newbie
Currently Being Moderated
Hello,
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 -
c cl.c
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?
  • 1. Re: Building NCAR Graphics 5.2.1 on Solaris 10 x86u9 under Sun Studio 10 (2005)
    Steve_Clamage Pro
    Currently Being Moderated
    Please refer to the C Users Guide for details of cc command line options. All manuals for Sun Studio 12u1 are listed here:
    http://download.oracle.com/docs/cd/E19205-01/index.html

    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:
    cc -c f1.c f2.c <other options>
    f90 -c f3.f90 f4.f90 <other options>
    f90 -o myprog f1.o f2.0 f3.0 f4.0 <other options>
  • 2. Re: Building NCAR Graphics 5.2.1 on Solaris 10 x86u9 under Sun Studio 10 (2005)
    Steve_Clamage Pro
    Currently Being Moderated
    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.
    http://www.oracle.com/us/support/index.html

    My comments about command-line options and the use of the cc and f90 drivers still apply.
  • 3. Re: Building NCAR Graphics 5.2.1 on Solaris 10 x86u9 under Sun Studio 10 (2005)
    user12616316 Newbie
    Currently Being Moderated
    Steve is correct that the option -ansi is an option for OSS f90/f95 only. Also, mixed C and Fortran programs should be linked using the Fortran driver f90 or f95.

    Bob Corbett

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points