No C compiler on EC2?
You can get around this by linking /usr/bin/gcc
to /usr/bin/gcc46
using this command:
ln /usr/bin/gcc46 /usr/bin/gcc
When you upgrade gcc
, you can then keep multiple versions with binaries named /usr/bin/gccXX
and simple point the /usr/bin/gcc
link to the version you want to use (which will probably be the newest one).
How do I run compile and run a c file on an AWS EC2 Linux Instance?
Unlike windows systems, Linux systems don't look in the current directory by default when looking for a program to run. You need to give the path to the executable.
./server 51717
No acceptable C compiler found in $PATH while installing the C compiler
You need to install a compiler to compile. The solutions in the mentioned question should work:
yum install gcc
or
yum groupinstall "Development tools"
After that, try to run your compiler to make sure everything is aligned:
gcc
Compiler error in socket.h on Amazon EC2
I'd wager that some header file you have is #define
ing a macro that interferes with socket.h
. Are you able to compile a program that only includes <sys/socket.h>
, with no other inclusions?
The next thing to check is to look at /usr/include/bits/socket.h
and see what's on line 231 (where the first error occurs). If the code looks ok, then the next step is to see what the preprocessed source looks like. To get the preprocessed output, replace the -c
option with -E
on the command line, and change the -o obj/alert.o
option to -o alert.ii
to put the preprocessor output into the file alert.ii
.
If you compare the content of alert.ii
with /usr/include/bits/socket.h
, you can see if it's getting compiled as expected or not. In particular, if there's a macro which defines something into something unexpected, you'll see code which is clearly wrong at the location the compiler is pointing out.
Related Topics
Linux Keyboard Event Capturing /Dev/Inputx
Setup Cron Tab to Specific Time of During Weekdays
Why Do the Md5 Hashes of Two Tarballs of the Same File Differ
What Is the Safest Way to Run an Executable on Linux
Linux 3/1 Virtual Address Split
Run a Persistent Process via Ssh
Could Not Load Shared Library Symbols for Linux-Vdso.So.1. While Debugging
How to Return Exit Code 0 from a Failed Command
Loading Linux Text File into Excel Using Vba
How to Disable Socket Creation for a Linux Process, for Sandboxing
How to Program for Linux's New 'Fanotify' File System Monitoring Feature
Check That There Are at Least Two Arguments Given in a Bash Script