[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20030616: compiling user server under Linux



>From:  "=?ISO-8859-1?Q?Marianne=20K=F6nig?=" <address@hidden>
>Organization:  EUMETSAT
>Keywords:  200306160918.h5G9IYLd025247 McIDAS-X Linux libf2c.a

Hi Marianne,

>At least I am embarrassed that I keep wasting your time with all my problems -

No worries.

>but I am so stuck again with my Linux mcidas and don't know what to do - and
>I am sure you don't even need to turn on your brain to help me on this one:
>
>I try to install my own world famous MSG Server. (on this Linux machine)
>So I took basically the same little script to compile and link the server that
>  I use on my HP . The script is:
>
>
>mccomp -c msgsadir.f -I/home/mcidas/inc
>mccomp subserv_.c -I/home/mcidas/inc -DSname=msgsadir_
>mccomp -o msgsadir ./msgsadir.o ./subserv_.o -L/home/mcidas/lib -lmcidas
>
>(this script worked on my HP and made this binary msgsadir)

The difference in building on HP and Linux is most likely that you used
the HP C and Fortran compilers on HP-UX, and you are using the gcc/f2c/mcfc
combination under Linux.

>On my Linux it fails with the complaint that it does not find a main.o file - 
>and I am lost with this error message - a server is never a main program.
>
>I use the correct gcc version.
>
>The exact word of the error message are:
>
>/usr/local/lib/libf2c.a(main.o): In function 'main':
>main.o(.text+0x126): undefined reference fo 'MAIN__'

This indicates that the linker is using the shared f2c library, libf2c.so,
instead of the static f2c library, libf2c.a.  The shared f2c library
does not have the MAIN__ entry point in it, but the static library does.

>Any idea where I need to change my script?

Ordinarily, I would suggest adding '-gcc' to the last mccomp line in your
script, but the use of gcc/f2c/mcfc is the default for Linux.

Back when my sites used the gcc/f2c/mcfc compiler combination
(they now use gcc/g77), I would recommend that they do the following
to insure the use of the static f2c library:

  As root:
  
  Type: mkdir /usr/local/lib
  Type: ln -s /usr/lib/libf2c.a /usr/local/lib/libf2c.a
  
  As the user mcidas (the user building McIDAS):
  
  Define the environment variable LD_LIBRARY_PATH so that the
  /user/local/lib directory is searched before others when programs are
  linked. For C-shell users, LD_LIBRARY_PATH would be set in .cshrc as
  follows:
  
  Type: cd ~mcidas
  
        Edit .chsrc and add:
  
        setenv LD_LIBRARY_PATH /usr/local/lib:/lib:/usr/lib
  
  After modifying .cshrc, make sure to make the changes active in your session:
  
  Type: source .cshrc

After doing this, the static f2c library will be used in preferance to
the shared one, and the MAIN__ entry point will be found.

Please let me know if this doesn't solve your link problem.

>Thank you so much for your help, and your "free wine" list with me is
>growing    :)

Sounds good! ;-)

Tom
--
+-----------------------------------------------------------------------------+
* Tom Yoksas                                             UCAR Unidata Program *
* (303) 497-8642 (last resort)                                  P.O. Box 3000 *
* address@hidden                                   Boulder, CO 80307 *
* Unidata WWW Service                             http://www.unidata.ucar.edu/*
+-----------------------------------------------------------------------------+