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

Errors cross-compiling from M1 Mac for x86_64 FreeBSD: fatal error: 'inttypes.h' file not found #14212

Closed
n8henrie opened this issue Jan 5, 2023 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@n8henrie
Copy link

n8henrie commented Jan 5, 2023

Zig Version

0.10.0

Steps to Reproduce and Observed Behavior

I'm trying to compile a simple test program for x86_64 FreeBSD from Apple Silicon / aarch64-darwin (MacOS 13.1 / Ventura).

$ tar -xf zig-macos-aarch64-0.10.0.tar.xz
$ zig-macos-aarch64-0.10.0/zig version
0.10.0
$ cat <<'EOF' > main.cpp
#include <iostream>

int main() {
    std::cout << "hello, from c++!" << std::endl;
    return 0;
}
EOF
$ zig-macos-aarch64-0.10.0/zig cc -lc++ -o hello_world_cpp main.cpp
$ ./hello_world_cpp
hello, from c++!
$ zig-macos-aarch64-0.10.0/zig cc -lc++ -o hello_world_cpp -target x86_64-freebsd main.cpp
In file included from /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.Av46yJjiYZ/zig-macos-aarch64-0.10.0/lib/libunwind/src/UnwindLevel1.c:21:
/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.Av46yJjiYZ/zig-macos-aarch64-0.10.0/lib/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
In file included from /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.Av46yJjiYZ/zig-macos-aarch64-0.10.0/lib/libunwind/src/UnwindLevel1-gcc-ext.c:12:
/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.Av46yJjiYZ/zig-macos-aarch64-0.10.0/lib/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
#include_next <inttypes.h>
#include_next <inttypes.h>              ^~~~~~~~~~~~

              ^~~~~~~~~~~~
In file included from main.cpp:1:
In file included from /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.Av46yJjiYZ/zig-macos-aarch64-0.10.0/lib/libcxx/include/iostream:36:
In file included from /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.Av46yJjiYZ/zig-macos-aarch64-0.10.0/lib/libcxx/include/__assert:13:
/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.Av46yJjiYZ/zig-macos-aarch64-0.10.0/lib/libcxx/include/__config:292:14: fatal error: 'sys/endian.h' file not found
In file included from /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.Av46yJjiYZ/zig-macos-aarch64-0.10.0/lib/libunwind/src/Unwind-seh.cpp#    include <sys/endian.h>:
13             ^~~~~~~~~~~~~~
:
/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.Av46yJjiYZ/zig-macos-aarch64-0.10.0/lib/libunwind/src/config.h:16:10: fatal error: 'assert.h' file not found
#include <assert.h>
         ^~~~~~~~~~
In file included from /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.Av46yJjiYZ/zig-macos-aarch64-0.10.0/lib/libunwind/src/Unwind-sjlj.c:14:
/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.Av46yJjiYZ/zig-macos-aarch64-0.10.0/lib/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
#include_next <inttypes.h>
              ^~~~~~~~~~~~
1 error generated.
1 error generated.
1 error generated.
1 error generated.
$ 1 error generated.

I see the same behavior on homebrew-provided zig as the official downloaded binary I used above. I see the same behavior with env -i HOME=~ zig... (to make sure it's hopefully not something LLVM related in my environment).

Searching through issues, it seems similar / related to:

Expected Behavior

I had hoped cross-compilation from aarch64-darwin to x86_64-freebsd would work.

@n8henrie n8henrie added the bug Observed behavior contradicts documented or intended behavior label Jan 5, 2023
@nektro
Copy link
Contributor

nektro commented Jan 5, 2023

duplicate of #2876

@Vexu Vexu closed this as completed Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

3 participants