This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: static linking c libraries


Hi Israel,

Using your GCC cross-compiler from RedHat 9 to make a RedHat 7 executable should work.

You should double-check to make sure that you are linking against the RedHat 7 object code and libraries and using RedHat 7 system header files.

Regarding the legal implications: I'm not a lawyer. My understanding (which may be incorrect) is that the GCC Standard C Library and the GCC Standard C++ Library are covered by LGPL. The LGPL is *not* GPL. Non-GPL programs can link statically (or dynamically) to those LGPL protected libraries.

If you were using C instead of C++, it's very likely that your programs could be complied on RedHat 9 with the RedHat 9 native compiler, and moved to RedHat 7 and run without needing a cross-compiler. The C ABI is the same on both platforms, if I'm not mistaken.

But the C++ ABI has changed between RedHat 7 and RedHat 9, if memory serves. I wouldn't expect any RedHat 7 C++ dynamic libraries to work with a C++ application compiled on RedHat 9 by a RedHat 9 native compiler.

Also, if your application uses any RedHat 9 OS API (directly or indirectly) that is not present in RedHat 7 OS API, I'd expect the application to fail to run.

And finally, I believe that the preferred executable format for RedHat 9 is different from RedHat 7 (again, which is why a RedHat 7 cross-compiler is necessary). RedHat 7 applications will (probably) be forward compatible/runnable on RedHat 9; but not necessarily vice versa. Note: I may be mistaken on this one.

I ran into similar issues using GCC 2.95 on SunOS 5.8 (Solaris 8) with a target platform of SunOS 5.6 (Solaris 6). Both platforms were using the self-same GCC 2.95; but differences in the OS API librt.so caused issues. I had to make sure I was using the SunOS 5.6 header files when compiling on SunOS 5.8 -- that made sure I didn't inadvertently use an unsupported-on-5.6 API call.

Sincerely,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]