Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 212 Vote(s) - 3.66 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compile error: "g++: error trying to exec 'cc1plus': execvp: No such file or directory"

#1
When I compile C/C++ program with `popen` in `php`... I got this error:

g++: error trying to exec 'cc1plus': execvp: No such file or directory

but if I run php code in shell.. it works fine..

in Arch Linux..

PHP Code:

<!-- language: lang-php -->

<?php
function rfile($fp) {
$out="";
while (!feof($fp)) {
$out.= fgets($fp, 1024000);
}
return $out;
}
$p = popen('g++ -Wall -g aplusb.cc -o aplusb 2>&1', 'r');
$result = rfile($p);
pclose($p);
echo $result;
?>

thanks
Reply

#2
Each compiler has its own libexec/ directory. Normally libexec directory contains small helper programs called by other programs. In this case, gcc is looking for its own 'cc1' compiler. Your machine may contains different versions of gcc, and each version should have its own 'cc1'. Normally these compilers are located on:
<pre><code>
/usr/local/libexec/gcc/<architecture>/<compiler>/<compiler_version>/cc1
</code></pre>

Similar path for g++. Above error means, that the current gcc version used is not able to find its own 'cc1' compiler. This normally points to a PATH issue.
Reply

#3
I had the same issue with gcc "gnat1" and it was due to the path being wrong. Gnat1 was on version 4.6 but I was executing version 4.8.1, which I had installed. As a temporary solution, I copied gnat1 from 4.6 and pasted under the 4.8.1 folder.

The path to gcc on my computer is /usr/lib/gcc/i686-linux-gnu/<versions of gcc here>

You can find the path by using the find command:

find /usr -name "gnat1"

In your case you would look for cc1plus:

find /usr -name "cc1plus"

Of course, this is a quick solution and a more solid answer would be fixing the broken path.
Reply

#4
You need to install `gcc-c++` package.

yum install gcc-c++
Reply

#5
I don't know why but i just renamed my source file COLARR.C to colarr.c and the error vanished!
probably you need this

sudo apt-get install g++
Reply

#6
This problem can happen if different versions of g++ and gcc are installed.

g++ --version
gcc --version

If these don't give the result, you probably have multiple versions of gcc installed. You can check by using:

dpkg -l | grep gcc | awk '{print $2}'

Usually, /usr/bin/gcc will be sym-linked to /etc/alternatives/gcc which is again sym-linked to say /usr/bin/gcc-4.6 or /usr/bin/gcc-4.8 (In case you have gcc-4.6, gcc-4.8 installed.)

By changing this link you can make gcc and g++ run in the same version and this may resolve your issue!


Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through