sloader
sloader copied to clipboard
Can't build and other questions.
Hello!
I am trying to build the repository but facing an issue with the libc_mapping.c file
FAILED: CMakeFiles/sloader.dir/libc_mapping.cc.o
/usr/bin/c++ -DC10_USE_GLOG=1 -DGLOG_CUSTOM_PREFIX_SUPPORT -I/usr/local/google/home/fmzakari/code/github.com/akawashiro/sloader/build/glog -I/usr/local/google/home/fmzakari/code/github.com/akawashiro/sloader/build/glog/src -I/usr/local/google/home/fmzakari/code/github.com/akawashiro/sloader/raw_write -O2 -g -DNDEBUG -std=gnu++20 -Wall -Werror -MD -MT CMakeFiles/sloader.dir/libc_mapping.cc.o -MF CMakeFiles/sloader.dir/libc_mapping.cc.o.d -o CMakeFiles/sloader.dir/libc_mapping.cc.o -c /usr/local/google/home/fmzakari/code/github.com/akawashiro/sloader/libc_mapping.cc
/usr/local/google/home/fmzakari/code/github.com/akawashiro/sloader/libc_mapping.cc:306:53: error: ‘__dprintf_chk’ was not declared in this scope
306 | {"__dprintf_chk", reinterpret_cast<Elf64_Addr>(&__dprintf_chk)},
| ^~~~~~~~~~~~~
/usr/local/google/home/fmzakari/code/github.com/akawashiro/sloader/libc_mapping.cc:310:60: error: ‘__explicit_bzero_chk’ was not declared in this scope; did you mean ‘explicit_bzero’?
310 | {"__explicit_bzero_chk", reinterpret_cast<Elf64_Addr>(&__explicit_bzero_chk)},
| ^~~~~~~~~~~~~~~~~~~~
| explicit_bzero
/usr/local/google/home/fmzakari/code/github.com/akawashiro/sloader/libc_mapping.cc:311:51: error: ‘__fdelt_chk’ was not declared in this scope
311 | {"__fdelt_chk", reinterpret_cast<Elf64_Addr>(&__fdelt_chk)},
| ^~~~~~~~~~~
/usr/local/google/home/fmzakari/code/github.com/akawashiro/sloader/libc_mapping.cc:312:51: error: ‘__fgets_chk’ was not declared in this scope
312 | {"__fgets_chk", reinterpret_cast<Elf64_Addr>(&__fgets_chk)},
| ^~~~~~~~~~~
/usr/local/google/home/fmzakari/code/github.com/akawashiro/sloader/libc_mapping.cc:313:60: error: ‘__fgets_unlocked_chk’ was not declared in this scope; did you mean ‘fgets_unlocked’?
313 | {"__fgets_unlocked_chk", reinterpret_cast<Elf64_Addr>(&__fgets_unlocked_chk)},
I can't seem to find these functions located anywhere which makes sense. I audited the Dockerfile which is included and run the same commands but I get the same failure.
- Is there a missing implementation that needs to be included?
- Why is there chibicc in the repo ? I can't find any use of it.
- I also installed
apt-get install -y ninja-build cmake gcc g++ git python3 python3-distutils python3-dev python3-pip nasm clang-format libcap-dev tmux zsh neovimon my machine..
Thank you!
Hi,
- Is there a missing implementation that needs to be included?
Umm... I confirmed sudo docker build . --network=host still working. Which OS are you using? Can you show me the result of uname -a ? I want to make another Dockerfile of your OS.
- Why is there chibicc in the repo ? I can't find any use of it.
I use chibicc to check sloader is working. But now, I haven't use it anymore.
I moved unused script to misc directory in https://github.com/akawashiro/sloader/pull/42/files.
❯ uname -a
Linux my-machine 6.4.4-3rodete1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.4.4-3rodete1 (2023-09-05) x86_64 GNU/Linux
It did build with the Dockerfile actually but not on my local Debian... trying to find out why.
Should I re-run the generate script on my machine? I'm still a bit confused why I don't have these symbols hmm. Very cool project btw -- I'm trying to use it with another project I've written :)
I'm sorry for being late. I'm debugging on this branch using debian 12.2 image. https://github.com/akawashiro/sloader/pull/43
The error is reproduced https://gist.github.com/akawashiro/c7ad091abe2fef5cdc1d35c60b4dada8.
Should I re-run the generate script on my machine?
No, I think the cause of this error is the difference of libc of ubuntu and debian.
Sorry, I cannot fix this problem soon. Just tweaking libc_mapping.cc doesn't fix this.
I'm approaching this problem from completely different way which uses custom built glibc.
I confirmed this is due to the difference of glibc (glibc-2.36 and glibc-2.35).