Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build and other questions. #41

Open
fzakaria opened this issue Oct 10, 2023 · 10 comments · Fixed by #43
Open

Can't build and other questions. #41

fzakaria opened this issue Oct 10, 2023 · 10 comments · Fixed by #43

Comments

@fzakaria
Copy link

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.

  1. Is there a missing implementation that needs to be included?
  2. Why is there chibicc in the repo ? I can't find any use of it.
  3. 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 neovim on my machine..

Thank you!

@akawashiro
Copy link
Owner

Hi,

  1. 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.

  1. 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.

@akawashiro
Copy link
Owner

I moved unused script to misc directory in https://github.com/akawashiro/sloader/pull/42/files.

@fzakaria
Copy link
Author

❯ 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

@fzakaria
Copy link
Author

It did build with the Dockerfile actually but not on my local Debian... trying to find out why.

@fzakaria
Copy link
Author

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 :)

@akawashiro
Copy link
Owner

I'm sorry for being late. I'm debugging on this branch using debian 12.2 image. #43

@akawashiro
Copy link
Owner

@akawashiro
Copy link
Owner

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.

@akawashiro
Copy link
Owner

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.

@akawashiro
Copy link
Owner

I confirmed this is due to the difference of glibc (glibc-2.36 and glibc-2.35).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants