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

gcc darwin fixes #18327

Closed
wants to merge 6 commits into from
Closed

Conversation

matthewbauer
Copy link
Member

@matthewbauer matthewbauer commented Sep 5, 2016

Motivation for this change

These changes seem to get gcc48, gcc5, and gcc6 working on Darwin. I need to verify that Linux gcc's still work though.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • OS X
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@matthewbauer, thanks for your PR! By analyzing the annotation information on this pull request, we identified @dezgeg, @dguibert and @peti to be potential reviewers

@@ -470,7 +472,7 @@ stdenv.mkDerivation ({

LIBRARY_PATH = concatStrings
(intersperse ":" (map (x: x + "/lib")
(optionals (zlib != null) [ zlib ]
(optionals (zlib != null) [ zlib.out ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concatStrings (intersperse ":" (map (x: x + "/lib") should be able to be shortened to lib.makeLibraryPath, then .out from zlib.out should be able to be dropped.

(I actually wonder how this even works on current master since these resolve to e.g. ${gmp.dev}/lib).

@matthewbauer matthewbauer changed the title Gcc darwin fixes gcc darwin fixes Sep 5, 2016
@LnL7 LnL7 added the 6.topic: darwin Running or building packages on Darwin label Sep 6, 2016
@globin
Copy link
Member

globin commented Sep 6, 2016

Still getting:

The directory that should contain system headers does not exist:
  /usr/include
make[3]: *** [Makefile:2829: stmp-fixinc] Error 1

@LnL7
Copy link
Member

LnL7 commented Sep 6, 2016

The versions you mentioned still build on linux.

@@ -359,6 +359,8 @@ stdenv.mkDerivation ({
}
${if (stdenv ? glibc && cross == null)
then " --with-native-system-header-dir=${stdenv.glibc.dev}/include"
else if (stdenv ? libc && cross == null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to change the existing check to

     ${if cross == null
        then " --with-native-system-header-dir=${lib.getDev stdenv.libc}/include"

which should do the right thing for all platforms.

@vcunat vcunat added the 1.severity: mass-rebuild This PR causes a large number of packages to rebuild label Sep 11, 2016
@matthewbauer
Copy link
Member Author

Ok so I've got my Macbook running without the Command Line Tools. I'll see what is fixable.

@matthewbauer
Copy link
Member Author

Does anyone know if gcc 4.6 can be deleted? It's not reachable right now in the code AFAICT.

This seems to be working now. ISL needs to be disable for it to build
completely though.
This should get gcc48, gcc5, and gcc6 working again.

Also: use makeLibraryPath, and makeSearchPathOutput for LIBRARY_PATH and
CPATH. This is a refactor but it also fixes an issue with zlib.
gcc needs to be able find system headers. Without this, gcc fails to build because
/usr/include is not available.

Note: stdenv.libc should be available for all stdenv's, I think.
This isn't available from all-packages, so I think it's okay to
remove. It's unclear how to keep this updated with the changes.
Darwin systems need to be able to find CoreFoundation headers as well as
libc headers. Somehow, gcc doesn't accept any "framework" parameters
that would normally be used to include CoreFoundation in this
situation.

HACK: Instead, this adds a derivation that combines the two. The result
works but probably not a good long term solution.

ALTERNATIVES: Maybe sending patches in to GCC to allow
"native-system-framework" configure flag to get this found.
@dezgeg
Copy link
Contributor

dezgeg commented Sep 15, 2016

Most likely yes, probably cbb055c forgot to remove it by mistake.

@matthewbauer matthewbauer changed the base branch from staging to master September 16, 2016 01:10
@vcunat
Copy link
Member

vcunat commented Sep 16, 2016

stdenv.libc doesn't exist on Linux. Still, stdenv.cc.libc should be portable AFAIK.

Copy link
Member

@vcunat vcunat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the evaluation problem it looks OK and default version builds fine on x86_64-linux.

@vcunat
Copy link
Member

vcunat commented Sep 16, 2016

(Note: in any case, it shouldn't be merged to master directly.)

@vcunat vcunat self-assigned this Sep 16, 2016
vcunat added a commit that referenced this pull request Sep 16, 2016
@vcunat
Copy link
Member

vcunat commented Sep 16, 2016

Staged.

vcunat added a commit that referenced this pull request Sep 17, 2016
@matthewbauer matthewbauer deleted the gcc-darwin-fixes branch February 22, 2019 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.severity: mass-rebuild This PR causes a large number of packages to rebuild 6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants