elks icon indicating copy to clipboard operation
elks copied to clipboard

elf.c:34:18: error: use of undeclared identifier 'LIBELF_ARCH'

Open anchorz opened this issue 1 year ago • 5 comments

after make menuconfig; make clean; make

the build process stops at cd lib/elftoolchain-0.7.1/libelf; do gcc -Wall -I/Users/jayne/Development/ws-git/elks/include -I/Users/jayne/Development/ws-git/elks/elks/include -I/Users/jayne/Development/ws-git/elks/elks/tools/elf2elks/lib/elftoolchain-0.7.1/libelf -I/Users/jayne/Development/ws-git/elks/elks/tools/elf2elks/lib/elftoolchain-0.7.1/common -D__KERNEL__ -c -I. -I../common "$src"; done;

elf.c:34:18: error: use of undeclared identifier 'LIBELF_ARCH' .libelf_arch = LIBELF_ARCH, ^ elf.c:35:22: error: use of undeclared identifier 'LIBELF_BYTEORDER' .libelf_byteorder = LIBELF_BYTEORDER, ^ elf.c:36:19: error: use of undeclared identifier 'LIBELF_CLASS' .libelf_class = LIBELF_CLASS, ^

anchorz avatar Dec 03 '23 06:12 anchorz

I dont know myself how to use the files.That may help:

_libelf_config.h

#if defined(amd64) #define LIBELF_ARCH EM_X86_64 #define LIBELF_BYTEORDER ELFDATA2LSB #define LIBELF_CLASS ELFCLASS64 #elif defined(i386) #define LIBELF_ARCH EM_386 #define LIBELF_BYTEORDER ELFDATA2LSB #define LIBELF_CLASS ELFCLASS32 +#elif defined(aarch64) +#define LIBELF_ARCH EM_AARCH64 +#define LIBELF_BYTEORDER ELFDATA2LSB +#define LIBELF_CLASS ELFCLASS64 #endif

anchorz avatar Dec 03 '23 06:12 anchorz

after that fix i can get the image: qemu-system-x86_64 -drive format=raw,file=image/fd1440.img,if=floppy

anchorz avatar Dec 03 '23 06:12 anchorz

Hello @anchorz,

Thanks for the fix for building elf2elks on M1. I'll look into add this as a patch to the build, since the elf2elks source is pulled from a specific external commit rather than being held resident in this repository.

Thank you!

ghaerr avatar Dec 06 '23 18:12 ghaerr

can you just simply add the patch in ELKS repository?

anchorz avatar Dec 15 '23 17:12 anchorz

can you just simply add the patch in ELKS repository?

Yes, thank you. I plan to do that.

ghaerr avatar Dec 15 '23 17:12 ghaerr