Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.

fatal error: 'libDER/DERItem.h' file not found #2

Closed
andrewrk opened this issue Nov 17, 2020 · 5 comments
Closed

fatal error: 'libDER/DERItem.h' file not found #2

andrewrk opened this issue Nov 17, 2020 · 5 comments

Comments

@andrewrk
Copy link
Member

what do you have to have installed for this to be present?

@andrewrk
Copy link
Member Author

Hmm I think this may be because I am running on macOS 10.15.7 (Catalina) and you were running on Big Sur. My hunch is that we ideally want to be running fetch-them-macos-headers on the minimum supported macOS version - which is currently 10.13 but soon to be bumped to 10.14. The idea here is that macOS binaries will continue to execute after an OS upgrade, which means if you target the earlier version, it will still work on the later version, but not vice versa.

ideally ideally we would have the headers depend on the minimum target OS version in the zig target OS version range. But that might incur more complication than we intend to bear.

andrewrk added a commit that referenced this issue Nov 17, 2020
remove libDER header include. that appears to be introduced with
Big Sur. See #2
andrewrk added a commit to ziglang/zig that referenced this issue Nov 17, 2020
See ziglang/fetch-them-macos-headers#2 for more details. The path
forward looks like one of the following:

 * Ony provide headers for the oldest supported macOS (currently 10.13
   but soon to be bumped to 10.14).
 * Provide headers for multiple versions, and select based on the Zig
   target OS version range minimum.
 * Don't try to provide macOS headers.

If we don't tackle the version problem, we would have to re-introduce
the ability to detect and depend on native system headers if we wanted
to support C/C++ code that used newer OS definitions.

This patch also adds support for `#include <mach/mach_time.h>`.

Also related: #5236
@prime31
Copy link

prime31 commented Dec 29, 2020

I'm seeing this with current head of zig as well on Big Sur arm64. Error shows the following:

/Users/desaro/Desktop/zig-master/build/bin/zig build tilescript
error(compilation): clang failed with stderr: In file included from /Users/desaro/zig-upaya/src/deps/sokol/compile_sokol.c:12:
In file included from /Users/desaro/zig-upaya/src/deps/sokol/sokol/sokol_app.h:1088:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.h:9:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLTypes.h:8:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:87:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:117:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/oids.h:35:10: fatal error: 'libDER/DERItem.h' file not found

@floooh
Copy link

floooh commented Jan 2, 2021

The header 'libDER/DERItem.h' is in the macOS-SDK's usr/include subdirectory:

[path-to-macos-sdk]/usr/include/libDER/DERItem.h

The path to the macOS SDK can be queried with xcrun --show-sdk-path, e.g. on my machine this resolves to:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libDER/DERItem.h

I fixed this by adding the [macos-sdk]/usr/include search path via LibExeObjStep.addIncludeDir, but IMHO this should happen automatically (e.g. when running the system clang, this path seems to be part of the default header search path).

PS for reference:

https://github.com/floooh/pacman.zig/blob/41dd8c28cc02eacb112ee9e455a18772c65583ca/build.zig#L7-L16

@jcelerier
Copy link

jcelerier commented May 29, 2021

Not related to zig, but if anyone stumbles on this issue with macOS's clang and CommandLineTools on a 10.15 machine, my fix is to run clang / cmake / whatever build tool is used with :

xcrun --sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk $the_build_tool

(replace MacOSX11.1.sdk with whatever's the latest on your machine, but for me, with Xcode 12, the 10.15 SDK gives me that error even if I'm on a 10.15 machine so I guess there's a bug in some internal Xcode or macOS thing)

@andrewrk
Copy link
Member Author

This is addressed by the new strategy now of shipping multiple versions via the "layers" system. Upstream issue: ziglang/zig#10215

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants