Discussion:
Wrong libdir on x86_64 linux
Jussi Lehtola
2012-08-10 20:52:34 UTC
Permalink
Hi,


the version of pcc in Fedora is almost a year old, so I decided to have
a look at the newest cvs snapshot.

I was unable to get out a working compiler, since for some reason the
libdir argument isn't taken into account anymore in the compilation
process:

$ pcc -v helloworld.c
pcc 1.1.0.DEVEL 20120810 for x86_64-unknown-linux-gnu
Calling /usr/libexec/cpp -D_LP64 -D__LP64__ -D__amd64 -D__amd64__ -D__x86_64 -D__x86_64__ -D__ELF__ -D__linux__ -D__STDC_HOSTED__=1 -v -D__GNUC_STDC_INLINE__ -D__USER_LABEL_PREFIX__= -D__REGISTER_PREFIX__= -D__GNUC_PATCHLEVEL__=1 -D__GNUC_MINOR__=3 -D__GNUC__=4 -D__SIZEOF_WINT_T__=4 -D__PTRDIFF_TYPE__=long int -D__SIZE_TYPE__=unsigned long -D__WINT_TYPE__=unsigned int -D__WCHAR_MAX__=2147483647 -D__SIZEOF_WCHAR_T__=4 -D__WCHAR_TYPE__=int -D__STDC_ISO_10646__=200009L -D__LONG_LONG_MAX__=0x7fffffffffffffffLL -D__LONG_MAX__=0x7fffffffffffffffLL -D__INT_MAX__=0x7fffffff -D__SHRT_MAX__=32767 -D__SCHAR_MAX__=127 -D__VERSION__="pcc 1.1.0.DEVEL 20120810 for x86_64-unknown-linux-gnu" -D__PCC_MINORMINOR__=0 -D__PCC_MINOR__=1 -D__PCC__=1 -S /usr/include/pcc/ -S /usr/include -S /usr/lib64/pcc/x86_64-u
nknown-linux-gnu/1.1.0.DEVEL/include/ hello.c /tmp/ctm.XJLtZz
cpp: pcc 1.1.0.DEVEL 20120810 for x86_64-unknown-linux-gnu
Calling /usr/libexec/ccom -v /tmp/ctm.XJLtZz /tmp/ctm.ufSKtj
ccom: pcc 1.1.0.DEVEL 20120810 for x86_64-unknown-linux-gnu
Calling /usr/bin/as -v /tmp/ctm.ufSKtj -o /tmp/ctm.yCh3Y2
GNU assembler version 2.22.52.0.1 (x86_64-redhat-linux) using BFD version version 2.22.52.0.1-10.fc17 20120131
Calling /usr/bin/ld -v -d -dynamic-linker /lib64/ld-linux-x86-64.so.2 -e _start /usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/crt0.o /usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/crti.o /usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/crtbegin.o /tmp/ctm.yCh3Y2 -L/usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/ -L/usr/lib/ -lpcc -lc -lpcc /usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/crtend.o /usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/crtn.o
GNU ld version 2.22.52.0.1-10.fc17 20120131
/usr/bin/ld: skipping incompatible /usr/lib//libc.so when searching for -lc

If I add -L/usr/lib64 then the compiler compiles the hello world program as expected.
--
Jussi Lehtola
Fedora Project Contributor
***@fedoraproject.org
Anders Magnusson
2012-08-11 08:46:48 UTC
Permalink
Post by Jussi Lehtola
Hi,
the version of pcc in Fedora is almost a year old, so I decided to have
a look at the newest cvs snapshot.
I was unable to get out a working compiler, since for some reason the
libdir argument isn't taken into account anymore in the compilation
$ pcc -v helloworld.c
pcc 1.1.0.DEVEL 20120810 for x86_64-unknown-linux-gnu
Calling /usr/libexec/cpp -D_LP64 -D__LP64__ -D__amd64 -D__amd64__ -D__x86_64 -D__x86_64__ -D__ELF__ -D__linux__ -D__STDC_HOSTED__=1 -v -D__GNUC_STDC_INLINE__ -D__USER_LABEL_PREFIX__= -D__REGISTER_PREFIX__= -D__GNUC_PATCHLEVEL__=1 -D__GNUC_MINOR__=3 -D__GNUC__=4 -D__SIZEOF_WINT_T__=4 -D__PTRDIFF_TYPE__=long int -D__SIZE_TYPE__=unsigned long -D__WINT_TYPE__=unsigned int -D__WCHAR_MAX__=2147483647 -D__SIZEOF_WCHAR_T__=4 -D__WCHAR_TYPE__=int -D__STDC_ISO_10646__=200009L -D__LONG_LONG_MAX__=0x7fffffffffffffffLL -D__LONG_MAX__=0x7fffffffffffffffLL -D__INT_MAX__=0x7fffffff -D__SHRT_MAX__=32767 -D__SCHAR_MAX__=127 -D__VERSION__="pcc 1.1.0.DEVEL 20120810 for x86_64-unknown-linux-gnu" -D__PCC_MINORMINOR__=0 -D__PCC_MINOR__=1 -D__PCC__=1 -S /usr/include/pcc/ -S /usr/include -S /usr/lib64/pcc/x86_64
-unknown-linux-gnu/1.1.0.DEVEL/include/ hello.c /tmp/ctm.XJLtZz
Post by Jussi Lehtola
cpp: pcc 1.1.0.DEVEL 20120810 for x86_64-unknown-linux-gnu
Calling /usr/libexec/ccom -v /tmp/ctm.XJLtZz /tmp/ctm.ufSKtj
ccom: pcc 1.1.0.DEVEL 20120810 for x86_64-unknown-linux-gnu
Calling /usr/bin/as -v /tmp/ctm.ufSKtj -o /tmp/ctm.yCh3Y2
GNU assembler version 2.22.52.0.1 (x86_64-redhat-linux) using BFD version version 2.22.52.0.1-10.fc17 20120131
Calling /usr/bin/ld -v -d -dynamic-linker /lib64/ld-linux-x86-64.so.2 -e _start /usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/crt0.o /usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/crti.o /usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/crtbegin.o /tmp/ctm.yCh3Y2 -L/usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/ -L/usr/lib/ -lpcc -lc -lpcc /usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/crtend.o /usr/lib64/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib/crtn.o
GNU ld version 2.22.52.0.1-10.fc17 20120131
/usr/bin/ld: skipping incompatible /usr/lib//libc.so when searching for -lc
If I add -L/usr/lib64 then the compiler compiles the hello world program as expected.
True; Linux amd64 should search for its lib in /usr/lib64. I tested it
on Ubuntu where these two dirs are the same so I didn't notice. Fixed
now, thanks.

-- Ragge
Jussi Lehtola
2012-08-23 22:11:15 UTC
Permalink
On Sat, 11 Aug 2012 10:46:48 +0200
Post by Anders Magnusson
Post by Jussi Lehtola
I was unable to get out a working compiler, since for some reason
the libdir argument isn't taken into account anymore in the
$ pcc -v helloworld.c
If I add -L/usr/lib64 then the compiler compiles the hello world program as expected.
True; Linux amd64 should search for its lib in /usr/lib64. I tested
it on Ubuntu where these two dirs are the same so I didn't notice.
Fixed now, thanks.
OK, this works now, so I can compile test programs and pcc-libs.
However, I'm unable to compile pcc with itself, as configure fails:

$ export CC=pcc
$ ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for gcc... pcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C
compiled programs. If you meant to cross compile, use `--host'.
See `config.log' for more details.
Post by Anders Magnusson
From config.log I see
## ----------- ##
## Core tests. ##
## ----------- ##

configure:1784: checking build system type
configure:1802: result: x86_64-unknown-linux-gnu
configure:1824: checking host system type
configure:1839: result: x86_64-unknown-linux-gnu
configure:1861: checking target system type
configure:1876: result: x86_64-unknown-linux-gnu
configure:2423: checking for gcc
configure:2450: result: pcc
configure:2688: checking for C compiler version
configure:2695: pcc --version >&5
pcc 1.1.0.DEVEL 20120823 for x86_64-unknown-linux-gnu
configure:2698: $? = 0
configure:2705: pcc -v >&5
pcc 1.1.0.DEVEL 20120823 for x86_64-unknown-linux-gnu
no input files
configure:2708: $? = 8
configure:2715: pcc -V >&5
warning: unknown option '-V'
no input files
configure:2718: $? = 8
configure:2741: checking for C compiler default output file name
configure:2768: pcc conftest.c >&5
configure:2771: $? = 0
configure:2809: result: a.out
configure:2826: checking whether the C compiler works
configure:2836: ./a.out
configure:2839: $? = 8
configure:2848: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.

.. so something is clearly wrong.
--
Jussi Lehtola
Fedora Project Contributor
***@fedoraproject.org
Loading...