1

I am making online CPP compiler.It works good on my machine but when i deployed it on heroku i am getting an error from GCC. "gcc: error trying to exec 'cc1plus': execvp: No such file or directory"

i am using node js child process to compile the file

var proc = spawn('gcc', [`program` + ".cpp", "-o", `program`, '-lstdc++']);

where program.cpp is the source file.

I got the error "gcc: error trying to exec 'cc1plus': execvp: No such file or directory" can you please tell how it can be resolved.

Wajid
  • 11
  • 4
  • As i have mentioned that i making an online c compiler like cppshell [link](http://cpp.sh/ ) that will provide an online platform for compiling your c code. so every user have its own c code and we have to compile it on runtime for the output of the code. @Chris – Wajid May 22 '19 at 06:34
  • 1
    This works on your local machine because you have installed both the `gcc` and `g++` frontends of GCC. With `g++` you get the C++ compiler, `cc1plus` which enables you to compile C++ source files using `gcc`. They would normally be compiled used `g++`. But on your Heroku cloud host, `g++` is not installed so `gcc` fails to invoke `cc1plus` when presented with a C++ source file. – Mike Kinghan May 22 '19 at 07:48
  • 1
    so can you please guide me how can i install ```gcc``` and ```g++``` frontends of GCC on heroku dyno @MikeKinghan – Wajid May 23 '19 at 06:20
  • Sorry I can't help you with that or I'd have written an answer. I don't use heroku but the failure is reproducible on any system if you try to use `gcc` to invoke the compiler for a language - C++, go, d, fortran, ada - that is not installed. [This question](https://stackoverflow.com/q/50616083/1362568) might help you. – Mike Kinghan May 23 '19 at 08:26
  • Did you ever find a solution to this @Wajid? – Kyle Krzeski Jan 16 '21 at 19:01
  • 1
    I ended up using Docker. It actually worked pretty well for me. @WilliamHampshire – Wajid Jan 18 '21 at 14:46

0 Answers0