Ignoramus20785 <[EMAIL PROTECTED]> 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.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to