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

Getting GCC to run under zigux #2

Open
48cf opened this issue Jun 8, 2022 · 4 comments · Fixed by #3
Open

Getting GCC to run under zigux #2

48cf opened this issue Jun 8, 2022 · 4 comments · Fixed by #3

Comments

@48cf
Copy link
Owner

48cf commented Jun 8, 2022

Currently GCC compiles just fine, but when running it under zigux, the following error is shown:

root@zigux /$ gcc
gcc: fatal error: cannot read spec file '/usr/lib/gcc/x86_64-zigux/12.1.0/specs': No such file or directory (ENOENT)
compilation terminated.

This file is not present on my Linux host either, but seems to work here just fine..? That error also causes bash to crash for unknown reasons :/

@Kyota-exe
Copy link
Contributor

Hmm, I encountered that error as well when trying to get GCC running on Tonix.

Honestly, I don’t remember exactly how I solved it, but what I do remember is that that file isn’t supposed to be there anyway (like you said, it isn’t even there on Linux), and that something went wrong with GCC that caused it to reach that point.

From looking at my notes and commits from around that time, I would check if your access syscall is working, and whether symlinks are working properly or not.

@Kyota-exe
Copy link
Contributor

Just checked your mlibc sysdeps. You have to implement access for GCC. It’s probably checking if that specs file exists, and since you just return 0 (meaning that it does), it crashes when it can’t find it.

@48cf
Copy link
Owner Author

48cf commented Jun 9, 2022

Although I'm afraid that #3 doesn't fix this issue just yet, we got a little bit further now
image

@48cf 48cf reopened this Jun 9, 2022
@48cf
Copy link
Owner Author

48cf commented Jun 9, 2022

There seem to be some missing sysdeps warnings that show up throughout the program's runtime, not sure how important they are to us though.

debug(virt): Trying to load executable /usr/bin/gcc at 0x0
debug(virt):   PT_LOAD { .p_offset=0x0, .p_vaddr=0x400000, .p_filesz=0x12F1B8, .p_memsz=0x12F1B8, .p_flags=0x5 }
debug(virt):   PT_LOAD { .p_offset=0x130000, .p_vaddr=0x730000, .p_filesz=0x2328, .p_memsz=0x5E70, .p_flags=0x6 }
debug(scheduler): Dynamic linker for /usr/bin/gcc is at /usr/lib/ld.so
debug(virt): Trying to load executable /usr/lib/ld.so at 0x40000000
debug(virt):   PT_LOAD { .p_offset=0x0, .p_vaddr=0x0, .p_filesz=0x15330, .p_memsz=0x15330, .p_flags=0x5 }
debug(virt):   PT_LOAD { .p_offset=0x15330, .p_vaddr=0x215330, .p_filesz=0x140, .p_memsz=0x538, .p_flags=0x6 }
info(process): mlibc: __fsetlocking() is a no-op
info(process): mlibc: __fsetlocking() is a no-op
info(process): mlibc: __fsetlocking() is a no-op
info(process): In function getrlimit, file ../../sources/mlibc/options/posix/generic/sys-resource-stubs.cpp:50
__ensure(Library function fails due to missing sysdep) failed
warn(process): Unimplemented syscall 0x10C: { 0x7FFFFFFF67E0, 0x4000, 0x7FFFFFB3FC00, 0x5, 0x0, 0x0 }
debug(virt): Trying to load executable /usr/libexec/gcc/x86_64-zigux/12.1.0/cc1 at 0x0
debug(virt):   PT_LOAD { .p_offset=0x0, .p_vaddr=0x400000, .p_filesz=0x220467E, .p_memsz=0x220467E, .p_flags=0x5 }
debug(virt):   PT_LOAD { .p_offset=0x2204680, .p_vaddr=0x2804680, .p_filesz=0xDAB0, .p_memsz=0x1AE0D0, .p_flags=0x6 }
debug(scheduler): Dynamic linker for /usr/libexec/gcc/x86_64-zigux/12.1.0/cc1 is at /usr/lib/ld.so
debug(virt): Trying to load executable /usr/lib/ld.so at 0x40000000
debug(virt):   PT_LOAD { .p_offset=0x0, .p_vaddr=0x0, .p_filesz=0x15330, .p_memsz=0x15330, .p_flags=0x5 }
debug(virt):   PT_LOAD { .p_offset=0x15330, .p_vaddr=0x215330, .p_filesz=0x140, .p_memsz=0x538, .p_flags=0x6 }
info(process): In function getrlimit, file ../../sources/mlibc/options/posix/generic/sys-resource-stubs.cpp:50
__ensure(Library function fails due to missing sysdep) failed
info(process): mlibc: __fsetlocking() is a no-op
info(process): mlibc: __fsetlocking() is a no-op
info(process): mlibc: __fsetlocking() is a no-op
info(process): mlibc: sysconf(_SC_PHYS_PAGES) returns arbitrary value 1024
info(process): In function getrlimit, file ../../sources/mlibc/options/posix/generic/sys-resource-stubs.cpp:50
__ensure(Library function fails due to missing sysdep) failed
info(process): mlibc: sysconf(_SC_PHYS_PAGES) returns arbitrary value 1024
info(process): In function getrlimit, file ../../sources/mlibc/options/posix/generic/sys-resource-stubs.cpp:50
__ensure(Library function fails due to missing sysdep) failed
info(process): In function getrlimit, file ../../sources/mlibc/options/posix/generic/sys-resource-stubs.cpp:50
__ensure(Library function fails due to missing sysdep) failed
info(process): mlibc: sysconf(_SC_PHYS_PAGES) returns arbitrary value 1024
info(process): In function getrlimit, file ../../sources/mlibc/options/posix/generic/sys-resource-stubs.cpp:50
__ensure(Library function fails due to missing sysdep) failed
debug(scheduler): Exiting process 6 with code 1
warn(process): Unimplemented syscall 0x10C: { 0x7FFFFFFF7560, 0x4000, 0x7FFFFFB3FC80, 0x5, 0x0, 0x0 }
debug(virt): Trying to load executable /usr/x86_64-zigux/bin/as at 0x0
debug(virt):   PT_LOAD { .p_offset=0x0, .p_vaddr=0x400000, .p_filesz=0x17F4B4, .p_memsz=0x17F4B4, .p_flags=0x5 }
debug(virt):   PT_LOAD { .p_offset=0x17F4B8, .p_vaddr=0x77F4B8, .p_filesz=0x1910, .p_memsz=0xB558, .p_flags=0x6 }
debug(scheduler): Dynamic linker for /usr/x86_64-zigux/bin/as is at /usr/lib/ld.so
debug(virt): Trying to load executable /usr/lib/ld.so at 0x40000000
debug(virt):   PT_LOAD { .p_offset=0x0, .p_vaddr=0x0, .p_filesz=0x15330, .p_memsz=0x15330, .p_flags=0x5 }
debug(virt):   PT_LOAD { .p_offset=0x15330, .p_vaddr=0x215330, .p_filesz=0x140, .p_memsz=0x538, .p_flags=0x6 }
info(process): In function getrusage, file ../../sources/mlibc/options/posix/generic/sys-resource-stubs.cpp:37
__ensure(Library function fails due to missing sysdep) failed
info(process): mlibc: Unexpected value 7 for category in setlocale()
info(process): In function getrlimit, file ../../sources/mlibc/options/posix/generic/sys-resource-stubs.cpp:50
__ensure(Library function fails due to missing sysdep) failed
info(process): mlibc: sysconf(_SC_OPEN_MAX) returns arbitrary value 256
debug(process): Attempt to call fcntl on fd 3 with request: 0x3 and argument: 0x0
debug(process): Attempt to unmap 140737480089600 byte(s) at 0x52000
debug(scheduler): Exiting process 7 with code 0

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