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

regression: can't target x86_64-freebsd-* ("error: libc not available"/"unable to provide libc" - even if not linking to libc) #14729

Closed
eLeCtrOssSnake opened this issue Feb 25, 2023 · 4 comments

Comments

@eLeCtrOssSnake
Copy link

Zig Version

0.11.0-dev.1797+d3c9bfada

Steps to Reproduce and Observed Behavior

As of now, libc is not provided on freebsd yet, but zig should allow to cross compile for freebsd target if not linking libc.
But even with empty project that doesn't use libc zig complains about libc, afaik this shouldn't happen.

> zig init-exe
> zig build -Dtarget=x86_64-freebsd

Gives:

error: libc not available
    note: run 'zig libc -h' to learn about libc installations
    note: run 'zig targets' to see the targets for which zig can always provide libc
error: directory_name...
error: The following command exited with error code 1:

I tried other x86_64-freebsd-* triplets with different abi's, but none worked.

Expected Behavior

Compile a standalone project without libc dependency for freebsd even if we don't ship libc for freebsd yet without compiler complaining about it.

@eLeCtrOssSnake eLeCtrOssSnake added the bug Observed behavior contradicts documented or intended behavior label Feb 25, 2023
@eLeCtrOssSnake
Copy link
Author

Note that if linking to libc it gives a different error message.

@ifreund
Copy link
Member

ifreund commented Feb 25, 2023

Zig intentionally requires linking libc when targeting FreeBSD as libc is the only stable syscall interface on FreeBSD.

Cross compiling to FreeBSD is currently only possible by obtaining your own copy of the FreeBSD libc and using zig's --libc flag to link against it.

Once #2876 is implemented zig will be able provide a copy of FreeBSD for this use case itself.

Also, the title says regression but to my knowledge this has never worked due to the reasons listed above.

Anyhow, I'm closing this since it's effectively a duplicate of #2876.

@ifreund ifreund closed this as completed Feb 25, 2023
@ifreund ifreund removed the bug Observed behavior contradicts documented or intended behavior label Feb 25, 2023
@jiacai2050
Copy link
Contributor

by obtaining your own copy of the FreeBSD libc

Sorry to update this closed issue, but I have no idea how to copy freebsd libc, the doc here is also TBD

@nektro
Copy link
Contributor

nektro commented Sep 28, 2024

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

No branches or pull requests

4 participants