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

Provide override for standard headers in C++ #448

Merged
merged 1 commit into from
Dec 29, 2019

Conversation

robertu94
Copy link
Contributor

@robertu94 robertu94 commented Nov 22, 2019

Using Cxx on a system like Gentoo or some supercomputers with multiple
compilers installed in non-standard locations will result in Cxx not finding
the standard library. This change allows users to specify where to find
the system includes in a way that doesn't requiring forking Cxx to make
these changes. Since these systems are inherently non-standard, these
changes are unlikely to be fixed with a change to CollectLinuxHeaderPaths!
so providing anoverride is better.

This patch is an updated version of pull request #324 and #283 which no longer
compile with the current version of Cxx. It also serves as a solution to the issue
raised #315 that doesn't require a solution like VPetukhov suggested which
essentially forks Cxx for every user with these nonstandard locations.

Using Cxx on a system like Gentoo or some supercomputers with multiple
compilers will result in Cxx not finding the standard library.  This
change allows users to specify where to find the system includes in a
way that doesn't requiring forking Cxx to make these changes.  Since
these systems are inherently non-standard, these changes are unlikely to
be fixed with a change to `CollectLinuxHeaderPaths!` so providing an
override is better.
@Gnimuc
Copy link
Member

Gnimuc commented Dec 29, 2019

I think this is good to merge. Thanks for your contribution!

@Gnimuc Gnimuc merged commit 7f9c13e into JuliaInterop:master Dec 29, 2019
@schmrlng
Copy link
Contributor

I see that this was just merged, but how do we feel about moving these overrides up one line, i.e.,

function collectAllHeaders!(headers, nostdcxx)
    for header in split(get(ENV, "CXXJL_HEADER_DIRS", ""), ":")
        isempty(header) || push!(headers, (header, C_System))
    end
    nostdcxx || collectStdHeaders!(headers)
    collectClangHeaders!(headers)
    headers
end

Otherwise I'm finding (at least on my machine) that headers in "/usr/include" still take precedence over custom "system" headers specified in ENV["CXXJL_HEADER_DIRS"].

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

Successfully merging this pull request may close these issues.

3 participants