AmrDeveloper / Amun

A Statically typed, compiled general purpose low level programming language built using C++ and LLVM Infrastructure framework designed to be simple and fast
https://amun-lang.github.io/docs/
MIT License
64 stars 3 forks source link

Compiler is unable to compile samples #3

Open Soupertonic opened 1 year ago

Soupertonic commented 1 year ago

Platform

Description

When attempting to compile the samples, the compiler would spit outCan't create output file Undefined error: 0 for all files it's trying to compile. It seems like it is unable to write to output.o for some reason. (Message is generated here: amun_compiler.cpp, line 72; this commit's file tree 85457f4a1024328b9de8f01a34f29c0e057c9eca)

Unsuccessful attempts to fix the issue

Reproduction

AmrDeveloper commented 1 year ago

Hello @soupertonic,

This issue happened on M1,

Can you please try to compile to IR

cd bin
./amun compile-ir ../samples/Hello.amun

to run it using lli

lli output.ll

then we can try to link manually to detect the issue and solve it soon

Soupertonic commented 1 year ago

I'm afraid that doesn't work. When trying to compile to IR I get the same error message.

$ ./amun emit-ir ../samples/Hello.amun
Can't create output file Undefined error: 0

It creates the output.ll file but its size is 0 bytes.

AmrDeveloper commented 1 year ago

That means the problem is not trom external linker or creating files, it comes from emit object or ll code oj M1,

I will try to found the reason for that and solve it soon, also i will provide a docker file to be useful in this temporary cases