I tried to follow the rust for linux quick setup in order to learn some kernel programming in rust , but when I tried to compile the kernel using make LLVM=1 it showed this error :
scripts/gendwarfksyms/gendwarfksyms.h:6:10: fatal error: 'dwarf.h' file not found
6 | #include <dwarf.h>
| ^~~~~~~~~
1 error generated.
make[3]: *** [scripts/Makefile.host:131: scripts/gendwarfksyms/gendwarfksyms.o] Error 1
make[2]: *** [scripts/Makefile.build:556: scripts/gendwarfksyms] Error 2
make[1]: *** [/home/pc/os2-rs/linux/Makefile:1263: scripts] Error 2
make: *** [Makefile:248: __sub-make] Error 2
anyone can help me with please I'm stuck for hours
[package] backward-cpp/1.6: Build fails on Linux with `dwarf.h: No such file or directory`
Cannot find dwarf.h
Build on Pentoo Linux on arm64 fails with "fatal error: libdwarf/dwarf.h: No such file or directory"
Fatal error: file.h: No such file or directory but i installed the libaries
So after too many hours finally it's been solved. It goes like this:
- Download libdwarf-20130207.tar.gz
Extract the archive and in a new terminal type:
cd dwarf-2013-02-07/libdwarf ./configure --enable-shared make -j$(nproc)If you need a 32 bit library (as in my case), just open the
MakeFileand add-m32toCFLAGSCFLAGS = -m32 $(PREINCS) -g -O2 $(INCLUDES) $(dwfpic) $(POSTINCS)At the end, just copy the
libdwarf.sointo/usr/lib
I suspect this wasn't true when the question was asked, but in 2018:
sudo apt-get install libelf-dev libdwarf-dev
You might also be interested in https://github.com/aclements/libelfin.