LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware - ARM (https://www.linuxquestions.org/questions/slackware-arm-108/)
-   -   trying to compile (https://www.linuxquestions.org/questions/slackware-arm-108/trying-to-compile-4175534194/)

gearheadgeek 02-16-2015 10:01 AM

trying to compile
 
I am having a problem I have never experienced in many years of slackware use. I am putting Slack 14.0 on a BeagleBone Black (instead of Debian) and have it up and running except that gcc silently fails. By that, I mean it runs cc1 without producing an output file, a complaint, an error message, anything, and stops there. I have installed d/binutils, d/gcc, l/glibc, l/gmp, and l/libmpc. What am I missing?

business_kid 02-16-2015 01:07 PM

Let's see the exact error message.

louigi600 02-16-2015 02:20 PM

Are the glibc-solibs installed ?
What do you get if you execute
Code:

gcc -v
That should tell you version, target and how it was compiled.
If you try compiling a really simple thing (like just printing on stdo "hello world") what do you get ? and what's the return code of gcc ? (supposing it silently produced nothing)

gearheadgeek 02-17-2015 12:41 PM

Quote:

Originally Posted by business_kid (Post 5318229)
Let's see the exact error message.

As I said, it produces nothing - error message or output.

gearheadgeek 02-17-2015 12:48 PM

Quote:

Originally Posted by louigi600 (Post 5318266)
Are the glibc-solibs installed ?

Yes. Sorry, I missed that when looking back at the tag files, but they are installed.
Quote:

What do you get if you execute
Code:

gcc -v
That should tell you version, target and how it was compiled.
root@hen-dev:/tmp# gcc -v
Reading specs from /usr/lib/gcc/arm-slackware-linux-gnueabi/4.7.1/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-slackware-linux-gnueabi/4.7.1/lto-wrapper
Target: arm-slackware-linux-gnueabi
Configured with: ../gcc-4.7.1/configure --with-arch=armv5te --with-float=soft --disable-werror --prefix=/usr --mandir=/usr/man --infodir=/usr/info --libdir=/usr/lib --enable-bootstrap --enable-checking=release --with-system-zlib --disable-libunwind-exceptions --with-python-dir=/lib/python2.7/site-packages --enable-shared --enable-languages=ada,c,c++,fortran,java,objc,lto --enable-objc-gc --enable-threads=posix --enable-__cxa_atexit --enable-libssp --enable-lto --with-gnu-ld --verbose --enable-java-home --with-java-home=/usr/lib/jvm/jre --with-jvm-root-dir=/usr/lib/jvm --with-jvm-jar-dir=/usr/lib/jvm/jvm-exports --with-arch-directory= --with-antlr-jar=/root/slackware64-current/source/d/gcc/antlr-runtime-3.4.jar --enable-java-awt=gtk --disable-gtktest --host=arm-slackware-linux-gnueabi --build=arm-slackware-linux-gnueabi --target=arm-slackware-linux-gnueabi
Thread model: posix
gcc version 4.7.1 (GCC)

Note that this is just the stock compiler from the slackarm 14.0 distribution.
Quote:

If you try compiling a really simple thing (like just printing on stdo "hello world") what do you get ? and what's the return code of gcc ? (supposing it silently produced nothing)
I was compiling "hello world" and as I said, there is no output - error message or anything. The return code is 1 but I couldn't find anything germane on the web.

louigi600 02-18-2015 02:24 AM

Ok ... what if you tell it to compile with verbose flag, should give you some clues as to where it's failing
Code:

drao@darkstar:~$ gcc -v -Wall -save-temps -o hello_worls hello_world.c
Reading specs from /usr/lib/gcc/i486-slackware-linux/4.7.1/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-slackware-linux/4.7.1/lto-wrapper
Target: i486-slackware-linux
Configured with: ../gcc-4.7.1/configure --prefix=/usr --libdir=/usr/lib --mandir=/usr/man --infodir=/usr/info --enable-shared --enable-bootstrap --enable-languages=ada,c,c++,fortran,go,java,lto,objc --enable-threads=posix --enable-checking=release --enable-objc-gc --with-system-zlib --with-python-dir=/lib/python2.7/site-packages --disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp --enable-lto --with-gnu-ld --verbose --enable-java-home --with-java-home=/usr/lib/jvm/jre --with-jvm-root-dir=/usr/lib/jvm --with-jvm-jar-dir=/usr/lib/jvm/jvm-exports --with-arch-directory=i386 --with-antlr-jar=/root/slackware-current/source/d/gcc/antlr-runtime-3.4.jar --enable-java-awt=gtk --disable-gtktest --with-arch=i486 --target=i486-slackware-linux --build=i486-slackware-linux --host=i486-slackware-linux
Thread model: posix
gcc version 4.7.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-Wall' '-save-temps' '-o' 'hello_worls' '-mtune=i486' '-march=i486'
 /usr/libexec/gcc/i486-slackware-linux/4.7.1/cc1 -E -quiet -v hello_world.c -mtune=i486 -march=i486 -Wall -fpch-preprocess -o hello_world.i
ignoring nonexistent directory "/usr/lib/gcc/i486-slackware-linux/4.7.1/../../../../i486-slackware-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i486-slackware-linux/4.7.1/include
 /usr/local/include
 /usr/lib/gcc/i486-slackware-linux/4.7.1/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-Wall' '-save-temps' '-o' 'hello_worls' '-mtune=i486' '-march=i486'
 /usr/libexec/gcc/i486-slackware-linux/4.7.1/cc1 -fpreprocessed hello_world.i -quiet -dumpbase hello_world.c -mtune=i486 -march=i486 -auxbase hello_world -Wall -version -o hello_world.s
GNU C (GCC) version 4.7.1 (i486-slackware-linux)
        compiled by GNU C version 4.7.1, GMP version 5.0.5, MPFR version 3.1.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (GCC) version 4.7.1 (i486-slackware-linux)
        compiled by GNU C version 4.7.1, GMP version 5.0.5, MPFR version 3.1.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 147333b4f444708024f96128dde54444
hello_world.c:2:1: warning: return type defaults to 'int' [-Wreturn-type]
hello_world.c: In function 'main':
hello_world.c:4:1: warning: control reaches end of non-void function [-Wreturn-type]
COLLECT_GCC_OPTIONS='-v' '-Wall' '-save-temps' '-o' 'hello_worls' '-mtune=i486' '-march=i486'
 /usr/lib/gcc/i486-slackware-linux/4.7.1/../../../../i486-slackware-linux/bin/as -v --32 -o hello_world.o hello_world.s
GNU assembler version 2.22.52.0.2 (i486-slackware-linux) using BFD version (Linux/GNU Binutils) 2.22.52.0.2.20120424
COMPILER_PATH=/usr/libexec/gcc/i486-slackware-linux/4.7.1/:/usr/libexec/gcc/i486-slackware-linux/4.7.1/:/usr/libexec/gcc/i486-slackware-linux/:/usr/lib/gcc/i486-slackware-linux/4.7.1/:/usr/lib/gcc/i486-slackware-linux/:/usr/lib/gcc/i486-slackware-linux/4.7.1/../../../../i486-slackware-linux/bin/
LIBRARY_PATH=/usr/lib/gcc/i486-slackware-linux/4.7.1/:/usr/lib/gcc/i486-slackware-linux/4.7.1/../../../../i486-slackware-linux/lib/:/usr/lib/gcc/i486-slackware-linux/4.7.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-Wall' '-save-temps' '-o' 'hello_worls' '-mtune=i486' '-march=i486'
 /usr/libexec/gcc/i486-slackware-linux/4.7.1/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o hello_worls /usr/lib/gcc/i486-slackware-linux/4.7.1/../../../crt1.o /usr/lib/gcc/i486-slackware-linux/4.7.1/../../../crti.o /usr/lib/gcc/i486-slackware-linux/4.7.1/crtbegin.o -L/usr/lib/gcc/i486-slackware-linux/4.7.1 -L/usr/lib/gcc/i486-slackware-linux/4.7.1/../../../../i486-slackware-linux/lib -L/usr/lib/gcc/i486-slackware-linux/4.7.1/../../.. hello_world.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i486-slackware-linux/4.7.1/crtend.o /usr/lib/gcc/i486-slackware-linux/4.7.1/../../../crtn.o
drao@darkstar:~$ ls -lrt hello*
-rw-r--r-- 1 drao users    56 Feb 18 09:09 hello_world.c
-rw-r--r-- 1 drao users 17585 Feb 18 09:20 hello_world.i
-rw-r--r-- 1 drao users  456 Feb 18 09:20 hello_world.s
-rw-r--r-- 1 drao users  1008 Feb 18 09:20 hello_world.o
-rwxr-xr-x 1 drao users  6048 Feb 18 09:20 hello_worls*
drao@darkstar:~$

If you do this it might give you a hint as to what's wrong with your install ...
Your problem inspired me to look into the compilation process step by step ... you can try this step by step to see where your compilation process is failing (sorry some of the timestamps below are wonky ... I was learning something myself while producing it):
Code:

drao@darkstar:~$ cat hello_world.c
#include <stdio.h>
main ()
{ printf("Hello World\n");
}
drao@darkstar:~$

##just do the preprocessing
gcc -v -Wall -E -o hello_world.i hello_world.c

drao@darkstar:~$ ls -lrt hello*
-rw-r--r-- 1 drao users    56 Feb 18 09:09 hello_world.c
-rw-r--r-- 1 drao users 17585 Feb 18 10:54 hello_world.i
drao@darkstar:~$

##take the preprocessed complie but do not assemble
gcc -v -Wall -S -o hello_world.s -x cpp-output hello_world.i

drao@darkstar:~$ ls -lrt hello*
-rw-r--r-- 1 drao users    56 Feb 18 09:09 hello_world.c
-rw-r--r-- 1 drao users 17585 Feb 18 10:57 hello_world.i
-rw-r--r-- 1 drao users  456 Feb 18 11:04 hello_world.s
drao@darkstar:~$

##take the complied asemble it but do not link it
gcc -v -Wall -c -o hello_world.o -x assembler-with-cpp hello_world.s

drao@darkstar:~$ ls -lrt hello_world.*
-rw-r--r-- 1 drao users    56 Feb 18 09:09 hello_world.c
-rw-r--r-- 1 drao users 17585 Feb 18 11:09 hello_world.i
-rw-r--r-- 1 drao users  456 Feb 18 11:09 hello_world.s
-rw-r--r-- 1 drao users  1008 Feb 18 11:18 hello_world.o
drao@darkstar:~$

##link the assembled stuff
gcc -v -Wall -o hello_world hello_world.o

drao@darkstar:~$ ls -lrt hello_world*
-rw-r--r-- 1 drao users    56 Feb 18 09:09 hello_world.c
-rw-r--r-- 1 drao users 17585 Feb 18 11:38 hello_world.i
-rw-r--r-- 1 drao users  456 Feb 18 11:38 hello_world.s
-rw-r--r-- 1 drao users  1008 Feb 18 11:38 hello_world.o
-rwxr-xr-x 1 drao users  6048 Feb 18 11:43 hello_world*
drao@darkstar:~$ ./hello_world
Hello World
drao@darkstar:~$


gearheadgeek 02-18-2015 07:13 AM

Quote:

Originally Posted by louigi600 (Post 5319242)
Ok ... what if you tell it to compile with verbose flag, should give you some clues as to where it's failing

As I noted in my first post, it stops after running cc1 without producing the .s file in /tmp.
Code:


root@hen-dev:/tmp# gcc -v t.c
Reading specs from /usr/lib/gcc/arm-slackware-linux-gnueabi/4.7.1/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-slackware-linux-gnueabi/4.7.1/lto-wrapper
Target: arm-slackware-linux-gnueabi
Configured with: ../gcc-4.7.1/configure --with-arch=armv5te --with-float=soft --disable-werror --prefix=/usr --mandir=/usr/man --infodir=/usr/info --libdir=/usr/lib --enable-bootstrap --enable-checking=release --with-system-zlib --disable-libunwind-exceptions --with-python-dir=/lib/python2.7/site-packages --enable-shared --enable-languages=ada,c,c++,fortran,java,objc,lto --enable-objc-gc --enable-threads=posix --enable-__cxa_atexit --enable-libssp --enable-lto --with-gnu-ld --verbose --enable-java-home --with-java-home=/usr/lib/jvm/jre --with-jvm-root-dir=/usr/lib/jvm --with-jvm-jar-dir=/usr/lib/jvm/jvm-exports --with-arch-directory= --with-antlr-jar=/root/slackware64-current/source/d/gcc/antlr-runtime-3.4.jar --enable-java-awt=gtk --disable-gtktest --host=arm-slackware-linux-gnueabi --build=arm-slackware-linux-gnueabi --target=arm-slackware-linux-gnueabi
Thread model: posix
gcc version 4.7.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-march=armv5te' '-mfloat-abi=soft' '-mtls-dialect=gnu'
 /usr/libexec/gcc/arm-slackware-linux-gnueabi/4.7.1/cc1 -quiet -v t.c -quiet -dumpbase t.c -march=armv5te -mfloat-abi=soft -mtls-dialect=gnu -auxbase t -version -o /tmp/ccHxtJGB.s


louigi600 02-18-2015 08:24 AM

It looks like it preprocessed not sure if it assembled ... try that again and add the "-Wall -save-temps" flags and see if you get <whatever>.s ... but since it's returning 1 I think it's not assembling. Are binutils installed ?

You also need these libraries along with glibc-solibs and gcc itself to use gcc:
glibc
zlib
binutils
glibc-i18n
glibc-profile
glibc-zoneinfo
mpfr
libmpc
gpm

If they are all installed you might want to reinstall them all again (just incase the installation was corrupt):
gcc
glibc
glibc-i18n
glibc-profile
glibc-solibs
glibc-zoneinfo
zlib
binutils
mpfr
libmpc
gpm

Hope I didn't forget anything

gearheadgeek 02-18-2015 12:25 PM

Quote:

Originally Posted by louigi600 (Post 5319394)
It looks like it preprocessed not sure if it assembled ... try that again and add the "-Wall -save-temps" flags and see if you get <whatever>.s ... but since it's returning 1 I think it's not assembling. Are binutils installed ?

You also need these libraries along with glibc-solibs and gcc itself to use gcc:
glibc
zlib
binutils
glibc-i18n
glibc-profile
glibc-zoneinfo
mpfr
libmpc
gpm

If they are all installed you might want to reinstall them all again (just incase the installation was corrupt):
gcc
glibc
glibc-i18n
glibc-profile
glibc-solibs
glibc-zoneinfo
zlib
binutils
mpfr
libmpc
gpm

Hope I didn't forget anything

Didn't know about -save-temps, but still no output from cc1. I did miss a couple the the libs you list but have another fire to put out at the moment. I will get all loaded and try again. Thanks for the help.

gearheadgeek 03-20-2015 03:31 PM

Quote:

Originally Posted by louigi600 (Post 5319394)
It looks like it preprocessed not sure if it assembled ... try that again and add the "-Wall -save-temps" flags and see if you get <whatever>.s ... but since it's returning 1 I think it's not assembling. Are binutils installed ?

You also need these libraries along with glibc-solibs and gcc itself to use gcc:
glibc
zlib
binutils
glibc-i18n
glibc-profile
glibc-zoneinfo
mpfr
libmpc
gpm

Hope I didn't forget anything

For sake of closure and anyone who might stumble upon this thread, I got the fires extinguished and came back to this. Missing mpfr was the problem. Why gcc silently did nothing without it is beyond me, but after adding it, hello.c compiles and gives the expected output. Thanks very, very much. I never would have found that on my own.

louigi600 03-21-2015 03:14 AM

Too much time went by and I forgot how I got the list ... surely I don't know them off the top of my head and ldd on the pieces required to do the single steps did not get me back the full list ... maybe I googled: Prerequisites for GCC ... it's not specific for Slackware (that might not use ISL) but it gives you an idea of what you might need to get gcc to work right.

Good to know that I was helpful ... you can reward helpful posts by clicking on the "yes" right beside "Did you find this post helpful?"

gearheadgeek 03-23-2015 08:07 AM

Quote:

Originally Posted by louigi600 (Post 5335482)
maybe I googled: Prerequisites for GCC ... it's not specific for Slackware (that might not use ISL) but it gives you an idea of what you might need to get gcc to work right.

I naturally tried Google before I came here and found requirements to build gcc but not to run gcc.
Quote:

Good to know that I was helpful ... you can reward helpful posts by clicking on the "yes" right beside "Did you find this post helpful?"
Done. Thanks again!

gus3 03-23-2015 11:23 AM

Just my US$0.02:

When I have a complicated process that fails for no obvious, visible reason, I find "strace" very handy. I capture its output to a log, then pick through processes to search for the last fork/exec, and/or first failing exit. That's the first clue to follow.

Additionally, GCC's default error exit code of 1 can be overridden with the "-pass-exit-codes" option, which passes back the highest error code of any sub-process back to the top level.

business_kid 03-24-2015 05:50 AM

@gearheadgeek: Head over to the linuxfromscratch.org website and they list the requirements for gcc. They are building from scratch. I presume the language you are compiling changes those requirements. I suggest the chapter 6 list
http://www.linuxfromscratch.org/lfs/view/stable/

louigi600 03-25-2015 02:17 PM

Maybe I completed the list with this:
Code:

bash-4.2# gcc -v t.c
Reading specs from /usr/lib64/gcc/x86_64-slackware-linux/4.8.2/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-slackware-linux/4.8.2/lto-wrapper
Target: x86_64-slackware-linux
Configured with: ../gcc-4.8.2/configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man --infodir=/usr/info --enable-shared --enable-bootstrap --enable-languages=ada,c,c++,fortran,go,java,lto,objc --enable-threads=posix --enable-checking=release --enable-objc-gc --with-system-zlib --with-python-dir=/lib64/python2.7/site-packages --disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp --enable-lto --with-gnu-ld --verbose --enable-java-home --with-java-home=/usr/lib64/jvm/jre --with-jvm-root-dir=/usr/lib64/jvm --with-jvm-jar-dir=/usr/lib64/jvm/jvm-exports --with-arch-directory=amd64 --with-antlr-jar=/tmp/gcc/antlr-runtime-3.4.jar --enable-java-awt=gtk --disable-gtktest --disable-multilib --target=x86_64-slackware-linux --build=x86_64-slackware-linux --host=x86_64-slackware-linux
Thread model: posix
gcc version 4.8.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-slackware-linux/4.8.2/cc1 -quiet -v t.c -quiet -dumpbase t.c -mtune=generic -march=x86-64 -auxbase t -version -o /tmp/cc5Csk03.s
GNU C (GCC) version 4.8.2 (x86_64-slackware-linux)
        compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2, MPC version 0.8.2

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../x86_64-slackware-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib64/gcc/x86_64-slackware-linux/4.8.2/include
 /usr/local/include
 /usr/lib64/gcc/x86_64-slackware-linux/4.8.2/include-fixed
 /usr/include
End of search list.
GNU C (GCC) version 4.8.2 (x86_64-slackware-linux)
        compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 0e9a2964deaf26412d5df2f4c22feef7
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 /usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../x86_64-slackware-linux/bin/as -v --64 -o /tmp/cc4f6RhH.o /tmp/cc5Csk03.s
GNU assembler version 2.23.52.0.1 (x86_64-slackware-linux) using BFD version (Linux/GNU Binutils) 2.23.52.0.1.20130226
COMPILER_PATH=/usr/libexec/gcc/x86_64-slackware-linux/4.8.2/:/usr/libexec/gcc/x86_64-slackware-linux/4.8.2/:/usr/libexec/gcc/x86_64-slackware-linux/:/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/:/usr/lib64/gcc/x86_64-slackware-linux/:/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../x86_64-slackware-linux/bin/
LIBRARY_PATH=/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/:/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../x86_64-slackware-linux/lib/:/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-slackware-linux/4.8.2/collect2 --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-slackware-linux/4.8.2/crtbegin.o -L/usr/lib64/gcc/x86_64-slackware-linux/4.8.2 -L/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../x86_64-slackware-linux/lib -L/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../.. /tmp/cc4f6RhH.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib64/gcc/x86_64-slackware-linux/4.8.2/crtend.o /usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../lib64/crtn.o
bash-4.2#

along with ldd on the binaries involved in compiling (assembler, linker ... etc).


All times are GMT -5. The time now is 07:26 AM.