C compiler gcc not found while installing passenger and nginx
Asked Answered
N

6

12

I'm trying to install Passenger and Nginx on my VPS.

I followed these instructions and replaced all links of all sources to the current version.

But when i ran the Phusion Passenger installer for Nginx, something with gcc compiler went wrong:

Compiling and installing Nginx...
# sh ./configure --prefix='/opt/nginx' --with-http_ssl_module --with-http_gzip_static_module --with-cc-opt='-Wno-error' --add-module='/usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.17/ext/nginx'
checking for OS
 + Linux 2.6.32-220.el6.x86_64 x86_64
checking for C compiler ... not found

./configure: error: C compiler gcc is not found

What should I do?

OBS: My VPS works with CentOS 6.2 x64

Newsboy answered 7/10, 2012 at 16:13 Comment(6)
Have you installed the CentOS package that contains gcc? If not, install that, it should fix the problem you're seeing.Fitful
Did you really run yum install zlib-devel wget openssl-devel pcre pcre-devel make gcc gcc-c++ curl-devel?Braggart
Yes I installed the gcc package and ran yum install zlib-devel wget openssl-devel pcre pcre-devel make gcc gcc-c++ curl-develNewsboy
Look I ran gcc -vand got Using built-in specs. Target: x86_64-redhat-linux gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)Newsboy
@EduardoLeal: There is a remote possibility that the configure script is checking some location for existence of gcc while it is installed at some other location. For example: /usr/bin vs /usr/local/bin. This may be an issue of incompatibility between the packages vs the OS version.Gambill
So I should reinstall the packages in other location or specify the current path location?Newsboy
I
9

If you do have gcc installed, the problem stems from /tmp being mounted as noexec. The error doesn't exactly help, but if you remount /tmp as exec you can install passenger properly.

mount -o remount,rw,exec,nosuid /tmp
Interlocutress answered 21/10, 2012 at 13:57 Comment(2)
That worked. However, redmine doesn't seem to be working since I get an 403 forbidden error. In nginx logs I found nginx: [emerg] unknown directive "passenger_enabled" in /etc/nginx/sites-enabled/site:33Dinothere
That sounds like you didn't install Nginx with the passenger module. You can do nginx -V list the compiled flags. Make sure passenger is listed there. Also make sure passenger_enabled on; is listed inside the server block.Interlocutress
C
16

Have the same problem and the following commands solve it; (on ubuntu server)

sudo apt-get install linux-kernel-headers
sudo apt-get install build-essential
Coyle answered 2/8, 2013 at 15:12 Comment(0)
I
9

If you do have gcc installed, the problem stems from /tmp being mounted as noexec. The error doesn't exactly help, but if you remount /tmp as exec you can install passenger properly.

mount -o remount,rw,exec,nosuid /tmp
Interlocutress answered 21/10, 2012 at 13:57 Comment(2)
That worked. However, redmine doesn't seem to be working since I get an 403 forbidden error. In nginx logs I found nginx: [emerg] unknown directive "passenger_enabled" in /etc/nginx/sites-enabled/site:33Dinothere
That sounds like you didn't install Nginx with the passenger module. You can do nginx -V list the compiled flags. Make sure passenger is listed there. Also make sure passenger_enabled on; is listed inside the server block.Interlocutress
E
8

Got the same error. Just installed gcc and it started working:

yum install gcc

Englert answered 2/2, 2016 at 14:35 Comment(1)
Got the same problem on Amazon Linux AMI and this worked!Hire
H
6

same problem here and I found out that I am not able to run command as root has to use

 sudo

and it worked like charm

Hamner answered 4/2, 2017 at 0:55 Comment(0)
H
4

Be sure that you sudo, if applicable.

Example:

sudo ./configure ...
Hop answered 23/3, 2015 at 21:6 Comment(0)
U
1

One quick hack (I struggled a lot with it and finally install pre-built) is to install the pre-built package of Nginx rather than compiling it from source.

For RHEL/CentOS create the file named /etc/yum.repos.d/nginx.repo with the following contents:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

In above baseurl replace “OS” with “centos” and “OSRELEASE” with “6”.

Finally execute yum install nginx

Reference https://nginx.org/en/linux_packages.html#stable

Uranic answered 24/11, 2017 at 7:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.