Discussion:
Compiling pcc?
g***@sdf.org
2011-11-15 16:54:16 UTC
Permalink
Hi list,

I'm trying to install pcc (version 1.0.0) on my Debian computer (AMD64),
and... it doesn't work :(

I did the usual:

$ cd pcc-libs-1.0.0
$ ./configure --prefix=$HOME/opt/pcc
$ make
$ make install
$ cd ../pcc-1.0.0
$ ./configure --prefix=$HOME/opt/pcc
$ make
$ make install

but:

$ echo "int main () { return 0; }" >> foo.c
$ pcc foo.c
ld: cannot find /usr/lib64/crt1.o: No such file or directory
ld: cannot find /usr/lib64/crti.o: No such file or directory

So I figured out that I should define the "--with-libdir" option of the
configure script, which I did:

$ ./configure --prefix=$HOME/opt/pcc --with-libdir=$HOME/opt/pcc/lib/pcc/x86_64-unknown-linux-gnu/1.0.0.RELEASE/lib
$ make
$ make install
$ cd ..
$ echo "int main () { return 0; }" >> foo.c
$ pcc foo.c
$

Everything seems to be fine now, but...

$ ./a.out
Segmentation fault
$ gdb -q a.out
Reading symbols from a.out...(no debugging symbols found)...done.
(gdb) run
Starting program: a.out

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000001 in ?? ()
(gdb) bt
#0 0x0000000000000001 in ?? ()
#1 0x00000000004003ce in __do_global_ctors_aux ()
#2 0x00000000004002e9 in _init ()
#3 0x0000000000000000 in ?? ()
(gdb) Quit
$

What did I do wrong, and what should I do in order to make it work?

Best,

--ghe
g***@sdf.org
2011-11-15 16:48:31 UTC
Permalink
Hi list,

I'm trying to install pcc (version 1.0.0) on my Debian computer (AMD64),
and... it doesn't work :(

I did the usual:

$ cd pcc-libs-1.0.0
$ ./configure --prefix=$HOME/opt/pcc
$ make
$ make install
$ cd ../pcc-1.0.0
$ ./configure --prefix=$HOME/opt/pcc
$ make
$ make install

but:

$ echo "int main () { return 0; }" >> foo.c
$ pcc foo.c
ld: cannot find /usr/lib64/crt1.o: No such file or directory
ld: cannot find /usr/lib64/crti.o: No such file or directory

So I figured out that I should define the "--with-libdir" option of the
configure script, which I did:

$ ./configure --prefix=$HOME/opt/pcc --with-libdir=$HOME/opt/pcc/lib/pcc/x86_64-unknown-linux-gnu/1.0.0.RELEASE/lib
$ make
$ make install
$ cd ..
$ echo "int main () { return 0; }" >> foo.c
$ pcc foo.c
$

Everything seems to be fine now, but...

$ ./a.out
Segmentation fault
$ gdb -q a.out
Reading symbols from a.out...(no debugging symbols found)...done.
(gdb) run
Starting program: a.out

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000001 in ?? ()
(gdb) bt
#0 0x0000000000000001 in ?? ()
#1 0x00000000004003ce in __do_global_ctors_aux ()
#2 0x00000000004002e9 in _init ()
#3 0x0000000000000000 in ?? ()
(gdb) Quit
$

What did I do wrong, and what should I do in order to make it work?

Best,

--ghe
Szabolcs Nagy
2011-11-15 20:08:26 UTC
Permalink
Post by g***@sdf.org
I'm trying to install pcc (version 1.0.0) on my Debian computer
(AMD64), and... it doesn't work :(
what you did looks reasonable

don't use 1.0.0 but the latest cvs source
you may want to compile with the -v flag
to see if everything is ok
(with -X you can look at the generated temporary files)
check if environment is ok
try static linking with -static
look at the generated asm and .o (readelf, objdump)
to figure out if it's a linker or code generation issue
g***@sdf.org
2011-11-15 20:31:27 UTC
Permalink
Post by Szabolcs Nagy
Post by g***@sdf.org
I'm trying to install pcc (version 1.0.0) on my Debian computer
(AMD64), and... it doesn't work :(
what you did looks reasonable
don't use 1.0.0 but the latest cvs source
Thank you, this simple advice solved it... It is still necessary to give a --with-libdir=$HOME/opt/pcc/lib/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib option to the configure script, but it seems to work correctly now.
Post by Szabolcs Nagy
you may want to compile with the -v flag
to see if everything is ok
(with -X you can look at the generated temporary files)
check if environment is ok
try static linking with -static
look at the generated asm and .o (readelf, objdump)
to figure out if it's a linker or code generation issue
Thorsten Glaser
2011-11-15 22:00:49 UTC
Permalink
I'm trying to install pcc (version 1.0.0) on my Debian computer (AMD64), and...
Use Debian stable or older – newer has Multiarch and will not
currently work. It is on my TODO, though.

Also, /usr/lib64 looks bogus.

bye,
//mirabilos
--
“Having a smoking section in a restaurant is like having
a peeing section in a swimming pool.”
-- Edward Burr
g***@sdf.org
2011-11-15 23:04:35 UTC
Permalink
I'm trying to install pcc (version 1.0.0) on my Debian computer (AMD64), and...
Use Debian stable or older -- newer has Multiarch and will not currently
work. It is on my TODO, though.
Well, changing the operating system to install a compiler is not really a solution :)
Also, /usr/lib64 looks bogus.
Indeed. But compiling after giving the option --with-libdir=$HOME/opt/pcc/lib/pcc/x86_64-unknown-linux-gnu/1.1.0.DEVEL/lib to "configure" does solve the problem.

--ghe

Loading...