public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* "skipping incompatible ... when searching for -lgcc"
@ 2019-12-20 12:12 Jędrzej Dudkiewicz
  0 siblings, 0 replies; only message in thread
From: Jędrzej Dudkiewicz @ 2019-12-20 12:12 UTC (permalink / raw)
  To: gcc-help

Hi all,

I have compiled gcc 9.2.0 for x86_64 and armhf and installed it into
custom directory (later referred to as ver1). After that I have build
.deb files for each of them (later referred to as as ver2).

My problem *was* that ver1 successfully compiled simple hello world
program, whereas ver2 did not. It displayed the following error:

/opt/ZS/deps/lib/gcc/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld:
skipping incompatible
/opt/ZS/deps/lib/gcc/arm-linux-gnueabihf/9/libgcc.a when searching for
-lgcc
/opt/ZS/deps/lib/gcc/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld:
cannot find -lgcc
/opt/ZS/deps/lib/gcc/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld:
skipping incompatible
/opt/ZS/deps/lib/gcc/arm-linux-gnueabihf/9/libgcc.a when searching for
-lgcc
/opt/ZS/deps/lib/gcc/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld:
cannot find -lgcc

What I found out was that almost all files in aforementioned libgcc.a
archive were identical, except for _thumb1_case_sqi.o (single file, I
even checked with sha256sum that it was the only file that differed).

I later discovered that this error was caused by debuild command,
which was unable to properly strip objects in archive. There were some
errors regarding strip's inability to strip them since command used
was meant for x86_64 (or amd64 as it is called on Debian) and objects
were for armhf. In the end it seems that it was enough to instruct
debuild not to strip the following archives: libgcc.a, libgcc_eh.a and
libgcov.a. After I did it I were able to install everything, compile
few sample programs and later on quite a few larger projects without
any problems.

But in the end my question is:

How does gcc decides that file is not compatible? If strip was unable
to strip most object files, why was this single file stripped? It also
seems that only data stripped was original build directory and
additional stuff that causes build to be nondeterministic. Other
answer could be that archive format itself contains data that was
removed and this caused archive to be incompatible, not single object
in it. In the end I simply want to know what makes archive
"compatible" (i.e. usable) for the compiler.

Or maybe this question should be asked on binutils group?

Thanks in advance,
--
Jędrzej Dudkiewicz

I really hate this damn machine, I wish that they would sell it.
It never does just what I want, but only what I tell it.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-20 12:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-20 12:12 "skipping incompatible ... when searching for -lgcc" Jędrzej Dudkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).