[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BUG -- Apps made on FC5 (GCC 4.1.1) do NOT run on FC3 (GCC 4.0.2)
From: |
Paul Pluzhnikov |
Subject: |
Re: BUG -- Apps made on FC5 (GCC 4.1.1) do NOT run on FC3 (GCC 4.0.2) |
Date: |
Wed, 31 Jan 2007 07:26:27 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
Ignoramus20785 <ignoramus20785@NOSPAM.20785.invalid> writes:
> We have an app that we compile on FC5 (Fedora Core 5) using g++ from
> GCC 4.1.1.
>
> When we copy our app to a FC3 server, to run it, we get this error:
This is expected.
Unlike Win32, UNIX systems generally support *only* backward
compatibility: programs compiled on an older system continue to run
on a newer one (i.e. compile on FC3, run on FC5, and it will work).
> What can I do to get C++ apps compiled on FC5 to run on FC3?
The answer is: compile on the lowest OS release instead.
If there is a good reason why you can't, then you have to get rid
of libstdc++.so.6 and libgcc_s.so.1 dependency [1], or you have to
arrange for FC5 libraries to be used on the FC3 system [2].
For [1], do this:
ln -sf $(g++ --print-file-name=libstdc++.a) .
g++ -static-libgcc -o exe main.o ... -L.
rm libstdc++.a
# exe now has libgcc.a and libstdc++.a statically linked in.
For [2], do this:
g++ -o exe main.o ... -Wl,-rpath='$ORIGIN'
Now copy 'exe' and libgcc_s.so.1 and libstdc++.so.6 into the same
directory on FC3.
Note that either solution may work, but is not at all guaranteed
to work.
Also, a slight modification to source may break it again -- there
are symbols in FC5 libc, which are not present in FC3 libc, and if
you introduce any code that depends on these, you are screwed.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.