🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6313

Problem with static linking on aix with gcc2.6.3

#6313
From: kho
Date: Sat, 16 Dec 1995 00:00
73 lines
3304 bytes
Hello,

I'm not sure if this is a bug or not, but here's the problem:

I have an application written in C++, which also links in a library 
written in Fortran. It uses no X11 libraries, it simply reads a file,
processes the data, and writes an ASCII file.

The application is running fine on my machine (RS6000 model 250 running 
aix3.2.5), but crashes when our customers run it:

  "child killed: Illegal instruction (core dumped)"

This happens on the same version of the operating system, and for two 
different customers. None of them probably have gcc installed, though.

So far we have assumed that this indicates that the application isn't 
properly statically linked. On aix, this can be checked with the dump -H 
command, which gives

                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      /system/madeira_3c/pubdom/aix/lib:/usr/lib:/lib                                        
1                                    libc.a              shr.o               
2                                    libxlf90.a          xlfsys.o            
3                                    libxlf90.a          io.o                

Using the option -static to gcc however, gives a much larger executable, 
and dump -H now gives

                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      
/system/madeira_3c/pubdom/aix/lib/gcc-lib/powerpc-ibm-aix3.2.5/2.6.3:/sy
stem/madeira_3c/pubdom/ 
1      /                             unix                                    

which should indicate it now is statically linked. But our customers 
still have the same problem: The executable crashes, even though it runs 
fine here!

So my question is how one can achieve static linking on aix when using 
gcc. Or can there be another explanation to the problem?

From the makefile:

C+ = g++
../$(SYS)/c-orion-1 : $(OBJECTS) $(LIB1) $(LIB2) $(LIB1)
        $(C+) $(LDFLAGS) $(OBJECTS) $(LIB1) $(LIB2) $(LIB1) 
$(POST_LDFLAGS)

CFLAGS = -D$(SYS) -DINSERT_UNDERSCORE
LDFLAGS  = -static -o ../$(SYS)/c-orion-1 
POST_LDFLAGS  = /usr/lpp/xlf/lib/lowsys.exp -lxlf90 -lm 
#
LIB1 = ${SCPSSHOME}/helaux-1.2/aix/object/helaux-1.2.a

The IBM Fortran manual suggests:

LDFLAGS  = -bnso -bI:/usr/lib/syscalls.exp -o ../$(SYS)/c-orion-1 

With this, it links fine, but the executable crashes with a segmentation 
fault!

Any hints are appreciated.

--
Knut Hovda                                      E-mail: 
kho@scandpower.no
Consultant, Software Development                Phone: +47 63 81 49 20
Division for Nuclear and Petroleum Engineering  Fax: +47 63 81 88 22
Scandpower A/S, International Consultants       Address: P.O. Box 3
--                                              N-2007 Kjeller, NORWAY
Technical Details
Message-ID: <9512151335.AA29151@malaga>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,1c8a0b524a100450,start
X-Google-Attributes: gid113d02,public
From: kho@scandpower.NO
Subject: Problem with static linking on aix with gcc2.6.3
Date: 1995/12/16
Message-ID: <9512151335.AA29151@malaga>
X-Deja-AN: 122048549
distribution: gnu
sender: daemon@cis.ohio-state.edu
organization: GNUs Not Usenet
newsgroups: gnu.gcc.bug