marcelogdeandrade / PythonCompiler

Code used on "Writing your own programming language and compiler with Python" post
GNU General Public License v3.0
236 stars 53 forks source link

gcc not compiling #1

Closed gurneesh closed 6 years ago

gurneesh commented 6 years ago

After compiling with llc, when output.o file is compiled using gcc the error message flashes screenshot from 2018-07-03 15-03-15

marcelogdeandrade commented 6 years ago

Try compiling it with -fPIC flag, I've seen some people with this problem, but I'm still looking into it.

gurneesh commented 6 years ago

Thanks for the reply. I tried compiling it with -fPIC flag but error remains same. I wrote a parser and tried to use llvm for compiling with the help of your post on medium.

marcelogdeandrade commented 6 years ago

Can you provide me your OS and system specs? I just tried it with a new Ubuntu 16.04 and everything went fine.

gurneesh commented 6 years ago

Ubuntu 18.04 Core i5 5200u 8gb ram

marcelogdeandrade commented 6 years ago

And could you provide your GCC and LLVM versions please?

marcelogdeandrade commented 6 years ago

I just tried with Ubuntu 18.04 and LLVM 6.0 and I'm getting the same error. Maybe it's a problem with this LLVM version. On ubuntu 16.04 I was using an older one, 3.8.

I'm going to look into this problem and see if I can solve it

marcelogdeandrade commented 6 years ago

Ok, this seems to be a problem with LLVM 6 and GCC.

I tried doing the same thing with Clang and it worked.

If you have Clang, just change $ gcc output.o -o output to $ clang output.o -o output

gurneesh commented 6 years ago

ok. Thanks for the help

ghost commented 3 years ago

gcc -no-pie output.o -o output works too