Problems Linking C Programs


Up: In Case of Trouble Next: General Previous: General



Up: In Case of Trouble Next: General Previous: General


General


Up: Problems Linking C Programs Next: Sun Solaris Previous: Problems Linking C Programs

    1. Q: When linking programs, I get messages about __builtin_saveregs being undefined.

    A: You may have a system on which C and Fortran routines are incompatible (for example, using gcc and the vendor's Fortran compiler). If you do not plan to use Fortran, the easiest fix is to rebuild with the -nof77 option to configure.

    You should also look into making your C compiler compatible with your Fortran compiler. One possibility is use f2c to convert Fortran to C, then use the C compiler to compile everything. If you take this route, remember that every Fortran routine has to be compiled using f2c and the C compiler.



Up: Problems Linking C Programs Next: Sun Solaris Previous: Problems Linking C Programs


Sun Solaris


Up: Problems Linking C Programs Next: HPUX Previous: General

    1. Q: When linking on Solaris, I get an error like this:
    cc -g -o testtypes testtypes.o -L/usr/local/mpich/lib/solaris/ch_p4 -lmpich  
    
           -lsocket -lnsl -lthread 
    
    ld: warning: symbol `_defaultstkcache' has differing sizes: 
    
           (file /usr/lib/libthread.so value=0x20; file /usr/lib/libaio.so  
    
           value=0x8); 
    
           /usr/lib/libthread.so definition taken 
    
    
    A: This is a bug in Solaris 2.3 that is fixed in Solaris 2.4. There may be a patch for Solaris 2.3; contact Sun for more information.



Up: Problems Linking C Programs Next: HPUX Previous: General


HPUX


Up: Problems Linking C Programs Next: LINUX Previous: Sun Solaris

    1. Q: When linking on HPUX, I get an error like this:
        cc -o pgm pgm.o -L/usr/local/mpich/lib/hpux/ch_p4 -lmpich  -lm 
    
        /bin/ld: Unsatisfied symbols: 
    
        sigrelse (code) 
    
        sigset (code) 
    
        sighold (code) 
    
        *** Error code 1 
    
    
    A: You need to add the link option -lV3. The p4 device uses the System V signals on the HP; these are provided in the V3 library.



Up: Problems Linking C Programs Next: LINUX Previous: Sun Solaris


LINUX


Up: Problems Linking C Programs Next: Problems starting programs Previous: HPUX

    1. Q: When linking a Fortran program, I get
    Linking: 
    
    foo.o(.data+0x0): undefined reference to `pmpi_wtime_' 
    
    
    A: This is a bug in the pgf77 compiler (which is itself a workaround for a bug in the LINUX ld command). You can fix it by either adding -lpmpich to the link line or modifying the mpif.h to remove the external pmpi_wtime, pmpi_wtick statement.
The mpich configure attempts to determine if pmpi_wtime and pmpi_wtick can be declared in mpif.h and removes them if there is a problem. If this happens and you use pmpi_wtime or pmpi_wtick in your program, you will need to declare them as functions returning double precision values.



Up: Problems Linking C Programs Next: Problems starting programs Previous: HPUX