Re: Static compilation: segmentation fault in execution [host=x86_64, target: ia64]

José Luis García Pallero <[email protected]>
Newsgroups gmane.linux.debian.devel.embedded
Message-ID <CAFemY3a_s7ig3b7UacUmELVtSWaeEJ6Cd_WxK4=ZwQVzyVZhkA@mail.gmail.com>
2012/9/17 Benjamin Henrion <[email protected]>:
> On Fri, Sep 14, 2012 at 3:13 PM, José Luis García Pallero
> <[email protected]> wrote:
>> Hello:
>>
>> I have installed in my x86_64 machine running Debian Sid the cross
>> compiler for ia64 from emdebian squeeze. I need to run my programs in
>> an old Altix 3700 Bx2 machine with 64 CPUs, and I need the cross
>> compiler because the machine has very old compilers (no OpenMP, etc.)
>> Because the machine has old libraries and kernel (Linux 2.4) I need to
>> generate the executables statically linked. The problem is when I run
>> them.
>>
>> I have problems with a simple Hello world program
>>
>> #include<stdio.h>
>> int main()
>> {
>>     printf("Hello world\n");
>>     return 0;
>> }
>>
>> If I compile it dynamically linked, the executable runs without
>> problems in the ia64 environment, but if I compile it statically
>> linked (ia64-linux-gnu-gcc -static hello.c -o hello), when I try to
>> run in the ia64 machine I obtain a segmentation fault:
>>
>> ia64-linux-gnu-gcc -static hello.c -o hello_static
>> ./hello_static
>> Segmentation fault
>>
>> Is it a bug?
>
> GCC community has always been hostile to static compilation:
>
> http://www.staticramlinux.com/BuildingStaticCompiler.html
>
> "The GCC/Linux developer community is sold on shared library
> executables. They like shared libraries due to the reduced memory and
> disk footprints, as well as the concept that upgrading one shared
> library eventually automatically upgrades all applications which use
> that library. Consequently, information on statically linked programs
> is rather sparse."
>
> A simple test.c to see if your GCC can produce static binaries:
>
> http://www.stalinux.org/

The test.c compiles without errors with ia64-linux-gnu-gcc cross
compiler, so it should be capable to generate static binaries. The
probles is that the binary prodices a segmentation fault error when is
executed in the target machine

>
> --
> Benjamin Henrion <bhenrion at ffii.org>
> FFII Brussels - +32-484-566109 - +32-2-3500762
> "In July 2005, after several failed attempts to legalise software
> patents in Europe, the patent establishment changed its strategy.
> Instead of explicitly seeking to sanction the patentability of
> software, they are now seeking to create a central European patent
> court, which would establish and enforce patentability rules in their
> favor, without any possibility of correction by competing courts or
> democratically elected legislators."



-- 
*****************************************
José Luis García Pallero
[email protected]
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.