Issue
I have a fresh install of a Slackware64 14.0 on a dedicate server and I'm having a hard time to compile nginx.
./configure (my options)
returns
checking for OS
+ Linux 3.10.23-xxxx-std-ipv6-64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found
but gcc is installed, as this is what gcc -v
returns:
Reading specs from /usr/lib64/gcc/x86_64-slackware-linux/4.7.1/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-slackware-linux/4.7.1/lto-wrapper
Target: x86_64-slackware-linux
Configured with: ../gcc-4.7.1/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=/home/slackware/slackbuilds/gcc/antlr-runtime-3.4.jar --enable-multilib --target=x86_64-slackware-linux --build=x86_64-slackware-linux --host=x86_64-slackware-linux
Thread model: posix
gcc version 4.7.1 (GCC)
What I tried (after googling)
"/tmp
is mounted with noexec
."
Indeed it was, as part of my hardening configurations. I changed it and reboot to make sure, now my /etc/fstab
looks like this:
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/md1 / ext4 errors=remount-ro,discard 0 1
/dev/md2 /home ext4 defaults,discard 1 2
/dev/md5 /var/www ext4 defaults,discard 1 2
/dev/md6 /var/log ext4 defaults,discard 1 2
/dev/md7 /tmp ext4 defaults,discard,nodev,nosuid 1 2
/dev/md8 /var/lib/mysql ext4 defaults,discard 1 2
/dev/sda3 swap swap defaults 0 0
/dev/sdb3 swap swap defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
/tmp /var/tmp none rw,nosuid,nodev,bind 0 0
The new fstab without noexec does not work though. (I even tried with explicit exec
)
"gcc is not on your $PATH
"
It is.
whereis gcc
gcc: /usr/bin/gcc /usr/lib64/gcc /usr/X11R6/bin/gcc /usr/bin/X11/gcc /usr/X11/bin/gcc /usr/libexec/gcc /usr/man/man1/gcc.1.gz /usr/share/man/man1/gcc.1.gz /usr/X11/man/man1/gcc.1.gz
echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin
Other things I did:
Looking nginx configure file, they make use of a CC var. This CC did not exist.
CC=/usr/bin/gcc
This did not work too.
I tried compiling another program from source to make sure this is not nginx problem, and I found something interesting maybe:
By trying to compile htop
, I got this:
./configure
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/napster/htop-master':
configure: error: C compiler cannot create executables
See `config.log' for more details
Which is expected, because even though I have a minimal installation without most deveveloper tools, the gcc is found. This error should be solved by installing the required tool.
I even checked symbolic links on /usr/bin
to make sure gcc and cc are ok:
ls -l /usr/bin
cc -> gcc
gcc -> gcc-4.7.1
Any ideas?
Thanks in advance.
Solution
What are the contents of the 'config.log' file?
Most likely you're picking up some bad CFLAGS or LDFLAGS somewhere -- possibly in the config script or from nginx/htop defaults.
CFLAGS and LDFLAGS are options passed to the compiler's command line. If they're invalid then the compiler won't run.
The same symptom could result if you're missing a basic library that nginx/htop needs and the LDFLAG that specifies that is causing gcc to bail out.
You really need to check the config.log file.
Answered By - ZRBW Answer Checked By - Senaida (WPSolving Volunteer)