tsoding / porth

It's like Forth but in Python
629 stars 50 forks source link

compiling code is not working #86

Open Ccode-lang opened 3 years ago

Ccode-lang commented 3 years ago

computer info: OS:raspios Model:model 4 b

Ccode-lang commented 3 years ago

sim works fine

Ccode-lang commented 3 years ago
[INFO] Generating /home/pi/porth/hello-world.asm
[CMD] nasm -felf64 /home/pi/porth/hello-world.asm
[CMD] ld -o /home/pi/porth/hello-world /home/pi/porth/hello-world.o
/home/pi/porth/hello-world.o: file not recognized: file format not recognized
DemonEach commented 3 years ago

That's because nasm is used for the x86 CPU architecture, raspberry pi in the other hand uses ARM architecture. And also I think assembly instructions in Porth can be only used for x86, for ARM you need to use different assembly instructions.

There is also pull request for arm support https://github.com/tsoding/porth/pull/63

CoolCat467 commented 3 years ago

Basically, you need to use aarch64-linux-gnu-as assembler instead of nasm. I believe you might have to modify the main file to do this until that pull request gets looked into.