alexfru / SmallerC

Simple C compiler
BSD 2-Clause "Simplified" License
1.4k stars 156 forks source link

Symbol '__start' not found (was: I wasn't able to compile a simple hello world program) #17

Closed rain-1 closed 7 years ago

rain-1 commented 7 years ago
debbie@debian:~/SmallerC$ ./smlrcc -I./v0100/include/ ~/t/t.c

Symbol '__start' not found

Failed command 'smlrl -elf /home/debbie/t/t.o -o a.out'

hello, what did I do wrong?

alexfru commented 7 years ago

Smaller C Compiler Driver Wiki:

Location of system header and library files under Linux: smlrcc will first look for files limits.h and lc*.a under $SMLRC/include and $SMLRC/lib, where $SMLRC is the value of the environment variable SMLRC. If it doesn't find them there, it will next look for them under $HOME/smlrc/include and $HOME/smlrc/lib, where $HOME is the value of the environment variable HOME, IOW, the user's home directory. If it doesn't find them there, it will look for them under /usr/local/smlrc/include and /usr/local/smlrc/lib. If limits.h isn't found, smlrcc won't pass -SI to the core compiler, which will likely result in a compilation error, unless the proper -SI option is given to smlrcc. If the standard library isn't found and the -SL option isn't given to smlrcc, the standard library won't be linked in, potentially causing a linking error.

The easiest is to simply do:

./configure make sudo make install

This will compile Smaller C and put the binaries in /usr/local/bin and the headers and libraries under /usr/local/smlrc.

rain-1 commented 7 years ago

thank you!