NuxiNL / cloudlibc

CloudABI's standard C library
BSD 2-Clause "Simplified" License
295 stars 17 forks source link

i686-unknown-cloudabi-cc: fatal error: 'stdio.h' file not found #20

Closed mcandre closed 5 years ago

mcandre commented 5 years ago

Hello, I am trying to figure out if I can build 32-bit binaries with the CloudABI toolchain on macOS. I can build and run 64-bit binaries with x86_64-unknown-cloudabi-cc, but when I use the i686 variant, I get an error about a missing header file, stdio.h. I get the same behavior in Docker as well.

Do I need to install some additional LLVM components, or pass some new flags to the compiler, to get this to work?

Same error for the aarch64 and armv6 eabihf compilers.

EdSchouten commented 5 years ago

Hi there,

To build i686 binaries, make sure to install i686-unknown-cloudabi-cxx-runtime. It's likely the case you only have the x86_64-* flavour installed. Do note that due to lack of decent support for position independent code on 32-bit x86, support for running these executables is more limited (e.g., cloudabi-run -e doesn't support them).

mcandre commented 5 years ago

@EdSchouten Thank you for explaining this! So i686 CloudABI binaries would require the runtime kernel to be patched? Does that mean i686 CloudABI binaries are unable to run on macOS?

EdSchouten commented 5 years ago

Exactly. i686 CloudABI binaries can't run on macOS. They can currently only be run on FreeBSD (both FreeBSD/i386 and FreeBSD/amd64).

FreeBSD's CloudABI support is integrated into the kernel, so we can give those processes a dedicated virtual address space.

Edit: Marking this as closed, as the original question as answered. Feel free to reopen if needed.