Hello,
I am working on a custom operating system and I want create static libraries. I am working on a MacBook M4 (silicon).
I am using the compiler x86_64-elf-gcc and linker x86_64-elf-ld. The problem is when I create a static library with command:
ar -r libc.a *.o I get a library. But if I am using command ranlib I get response:
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: libc.a the table of contents is empty (no object file members in the library define global symbols)
And the library is not working with the linker.
Does anybody know what is wrong?
Kind regards,
Robert
Static Library
Re: Static Library
You need to use the ar and ranlib that came with your linker, which should exist with the same prefix, eg. x86_64-elf-ar and x86_64-elf-ranlib. The unprefixed ones you are using on macOS are part of a mach-o toolchain and do not understand your ELF object files.
Re: Static Library
Hi klange,
Thank you so much for this answer and it is working
Kind regards,
Robert
Thank you so much for this answer and it is working
Kind regards,
Robert
