Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ld: file not found: elf_i386 error on Mac Terminal

Tags:

when i run a command in terminal (Using El Capitan)

ld -m elf_i386 -T linker.ld -o kernel kasm.o kc.o

It shows the following error :

ld: warning: option -m is obsolete and being ignored
ld: file not found: elf_i386

Can anybody help me with this?

like image 341
Chirag Bansal Avatar asked Jun 27 '16 18:06

Chirag Bansal


1 Answers

when i run a command in terminal

You are trying to link some kind of kernel using ld directly. This is actually one of very few cases where using ld directly is appropriate.

However, the command line arguments you give to ld assume that you are using GNU-ld (you may have copied them from a Linux tutorial), but you are not using GNU-ld, you are using MacOS native linker, which doesn't understand these arguments.

Can anybody help me with this?

Please ask a separate question, along the lines of "I am trying to build XXX on MacOS, following tutorial YYY, and don't understand how to adjust this Linux command to Mac OS".

Note that it may not be possible to build XXX on MacOS at all. In particular, the ld manpage does not mention ELF as possible output, so if your "build XXX" goal includes building an ELF kernel, you'll likely need to build a cross-linker (a GNU-ld linker which runs on Mac OS (i.e. hosted on Mac OS), but produces code for ELF target.

like image 69
Employed Russian Avatar answered Sep 28 '22 01:09

Employed Russian