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 Big Sur, during CoreFX 3.1: "EXEC : error : include location '/usr/local/include' is unsafe for cross-compilation" #1794

Closed
hrytskivr opened this issue Oct 9, 2020 · 5 comments
Labels
area-upstream-fix Needs a change in a contributing repo

Comments

@hrytskivr
Copy link

Hey, trying to build on macOS and have this error, no clue what to do.

...
    /Users/metal/Downloads/source-build/artifacts/src/corefx.3009a1fc20d9cb47d117399040d31c23f7b23e02/src/Native/build-native.sh x64 Release OSX outconfig netcoreapp-OSX-Release-x64 -portable
    Setting up directories for build
    Checking pre-requisites...
    Commencing build of corefx native components for OSX.x64.Release
    Invoking "/Users/metal/Downloads/source-build/artifacts/src/corefx.3009a1fc20d9cb47d117399040d31c23f7b23e02/src/Native/Unix/gen-buildsys-clang.sh" "/Users/metal/Downloads/source-build/artifacts/src/corefx.3009a1fc20d9cb47d117399040d31c23f7b23e02/src/Native/Unix" "3" "9" "x64" "RELEASE" " -DFEATURE_DISTRO_AGNOSTIC_SSL=0 -DCMAKE_STATIC_LIB_LINK=0"
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/metal/Downloads/source-build/artifacts/src/corefx.3009a1fc20d9cb47d117399040d31c23f7b23e02/artifacts/obj/native/netcoreapp-OSX-Release-x64
    Executing make install -j 1
    [ 14%] Built target System.IO.Compression.Native-Static
    [ 28%] Built target System.IO.Compression.Native
    [ 30%] Built target System.IO.Ports.Native
    [ 32%] Built target System.IO.Ports.Native-Static
    [ 33%] Building C object System.Native/CMakeFiles/System.Native-Static.dir/pal_console.c.o
  EXEC : error : include location '/usr/local/include' is unsafe for cross-compilation [-Werror,-Wpoison-system-directories] [/Users/metal/Downloads/source-build/artifacts/src/corefx.3009a1fc20d9cb47d117399040d31c23f7b23e02/src/Native/build-native.proj]
  ##vso[task.logissue type=error;sourcepath=EXEC;linenumber=0;columnnumber=0;code=;]include location '/usr/local/include' is unsafe for cross-compilation [-Werror,-Wpoison-system-directories%5D
    1 error generated.
    Failed to build corefx native components.
    make[2]: *** [System.Native/CMakeFiles/System.Native-Static.dir/pal_console.c.o] Error 1
    make[1]: *** [System.Native/CMakeFiles/System.Native-Static.dir/all] Error 2
    make: *** [all] Error 2
  /Users/metal/Downloads/source-build/artifacts/src/corefx.3009a1fc20d9cb47d117399040d31c23f7b23e02/src/Native/build-native.proj(36,5): error MSB3073: The command ""/Users/metal/Downloads/source-build/artifacts/src/corefx.3009a1fc20d9cb47d117399040d31c23f7b23e02/src/Native/build-native.sh" x64 Release OSX outconfig netcoreapp-OSX-Release-x64 -portable" exited with code 1.
  ##vso[task.logissue type=error;sourcepath=/Users/metal/Downloads/source-build/artifacts/src/corefx.3009a1fc20d9cb47d117399040d31c23f7b23e02/src/Native/build-native.proj;linenumber=36;columnnumber=5;code=MSB3073;]The command ""/Users/metal/Downloads/source-build/artifacts/src/corefx.3009a1fc20d9cb47d117399040d31c23f7b23e02/src/Native/build-native.sh" x64 Release OSX outconfig netcoreapp-OSX-Release-x64 -portable" exited with code 1.

  Build FAILED.
...
@dagood
Copy link
Member

dagood commented Oct 9, 2020

I haven't seen anything like this before, and search results for the error point at cross-architecture compilation scenarios, which seems pretty odd to run into on macOS (without doing so very intentionally). My understanding is it's pretty uniformly x86-64 at the moment.

Can you give some more context about how you're building?

  • Where did you download /Users/metal/Downloads/source-build/ from exactly?
  • What build command did you run?
  • What version of macOS are you using?
  • Where did you get the build dependencies you're using?
    • If you can think of a way to summarize this. I'm not the most familiar with macOS setups.

@hrytskivr
Copy link
Author

hrytskivr commented Oct 9, 2020

@dagood thanks for reply 👍

  1. I downloaded this repo
  2. ./build.sh
  3. Big Sur Beta (20A5384c)
  4. Homebrew package manager

I've managed to overcome this issue by deleting includes from /usr/local/include from this file: ./artifacts/src/corefx.3009a1fc20d9cb47d117399040d31c23f7b23e02/src/Native/Unix/configure.cmake

@dagood
Copy link
Member

dagood commented Oct 9, 2020

Interesting... somehow, search wasn't able to find it for me with just the error message, but including Big Sur got me to this issue that appears to be the same as what you hit: dotnet/runtime#41095. It looks like this is a known issue on a Clang 12 beta on macOS. I'd suggest trying to build https://github.com/dotnet/corefx/tree/release/3.1 without source-build (to confirm you also get the problem without the complicated source-build infra involved), and report it on that issue to alert the CoreFX owners.

Once it's fixed in CoreFX (our upstream) we'll get the fix in source-build as part of the next release.

Glad you were able to find a workaround for now, though.

@dagood dagood closed this as completed Oct 9, 2020
@dagood
Copy link
Member

dagood commented Oct 9, 2020

Reopening: I suppose there's no need to close this--it seems like a good idea to keep it open here to track it for anyone hitting it in the future, which is more likely to happen in source-build than CoreFX itself. When Big Sur goes out of beta, this might become higher priority, for example.

@dagood dagood reopened this Oct 9, 2020
@dagood dagood added the area-upstream-fix Needs a change in a contributing repo label Oct 9, 2020
@dagood dagood changed the title EXEC : error : include location '/usr/local/include' is unsafe for cross-compilation macOS Big Sur, during CoreFX 3.1: "EXEC : error : include location '/usr/local/include' is unsafe for cross-compilation" Oct 9, 2020
@MichaelSimons
Copy link
Member

MichaelSimons commented Oct 20, 2022

[Triage] MacOS support is being officially added/tracked with #2909

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-upstream-fix Needs a change in a contributing repo
Projects
None yet
Development

No branches or pull requests

4 participants