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

MacOS "stdlib.h" not found #122

Open
MitchellWeg opened this issue Jul 3, 2023 · 2 comments
Open

MacOS "stdlib.h" not found #122

MitchellWeg opened this issue Jul 3, 2023 · 2 comments

Comments

@MitchellWeg
Copy link

MitchellWeg commented Jul 3, 2023

I'm trying to compile my Julia library with CBinding. However, I cannot get it to compile:

Example:

c`-Wall

c"""
#include <stdlib.h>
"""

It errors with: "fatal error: 'stdlib.h' no such file or directory".

When I compile with verbose output, I notice it's looking for directories belonging to clang 14.0.6, but I only have clang 14.0.4 installed as my default MacOS clang. I installed clang 16 with brew, can I somehow link that?

Thanks in advance.

M1 Mac.
MacOS Ventura 13.4.1

@Ezgiiiiiiiii
Copy link

I'm trying to compile my Julia library with CBinding. However, I cannot get it to compile:

Example:

c`-Wall

c"""
#include <stdlib.h>
"""

It errors with: "fatal error: 'stdlib.h' no such file or directory".

When I compile with verbose output, I notice it's looking for directories belonging to clang 14.0.6, but I only have clang 14.0.4 installed as my default MacOS clang. I installed clang 16 with brew, can I somehow link that?

Thanks in advance.

M1 Mac. MacOS Ventura 13.4.1

@krrutkow
Copy link
Member

krrutkow commented Oct 9, 2023

I am not familiar with how MacOS handles compiler and system resources, but my best guess is that it should be possible to use the -isystem compiler flag when creating your compiler context to provide another location for the compiler infrastructure to find system resources, something like c`-isystem $(systemResourcesIncludeDir) -Wall` in your case. An example of where CBinding is already using the flag is here:

CBinding.jl/src/context.jl

Lines 258 to 260 in 38e76e5

pushfirst!(ctx.args,
"-isystem", includedir, # these -isystem args are needed since Clang_jll packaging seems to have clang's InstallDir not set/found correctly
"-isystem", joinpath(dirname(dirname(libclang_path())), "include"),

Also related to #117

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

3 participants