ioi / isolate

Sandbox for securely executing untrusted programs
Other
1.05k stars 157 forks source link

Compiling with gcc, execve("gcc"): No such file or directory #112

Closed marlongerson closed 1 year ago

marlongerson commented 2 years ago

How do I compile using gcc? I get the error:

execve("gcc"): No such file or directory.

My source code exists in /var/local/lib/isolate/0/main.c and is called with isolate -b 0 --run -- gcc /var/local/lib/isolate/0/main.c -o /var/local/lib/isolate/0/main

marlongerson commented 2 years ago

I solved the above issue by using the full path to gcc: isolate -b 0 -- run -- /usr/bin/gcc main.c -o main

But I ran into another issue which is:

Error: collect2: fatal error: cannot find 'ld'. Not sure how to solve this?

tallninja commented 2 years ago

I also encountered the same issue. This worked for me:

isolate -b 0 -E PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --run -- /usr/bin/gcc main.c -o main