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

dontmerge: #209870 (external bootstrap) + #206907 (gcc12) #213931

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkgs/applications/audio/aether-lv2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ stdenv.mkDerivation rec {
lv2 libX11 libGL libGLU mesa
];

NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
"-Wno-error=stringop-overflow"
];

installPhase = ''
mkdir -p $out/lib/lv2
cp -r aether.lv2 $out/lib/lv2
Expand Down
6 changes: 6 additions & 0 deletions pkgs/applications/audio/furnace/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ stdenv.mkDerivation rec {
"-DWARNINGS_ARE_ERRORS=ON"
];

NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=mismatched-new-delete"
"-Wno-error=use-after-free"
];

postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
# Normal CMake install phase on Darwin only installs the binary, the user is expected to use CPack to build a
# bundle. That adds alot of overhead for not much benefit (CPack is currently abit broken, and needs impure access
Expand Down
5 changes: 5 additions & 0 deletions pkgs/applications/audio/mimic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ stdenv.mkDerivation rec {
pcre2
] ++ lib.optional pulseaudioSupport libpulseaudio;

NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=free-nonheap-object"
];

postInstall = ''
wrapProgram $out/bin/mimic \
--run "export ALSA_PLUGIN_DIR=${alsa-plugins}/lib/alsa-lib"
Expand Down
19 changes: 12 additions & 7 deletions pkgs/applications/editors/emacs/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,16 @@ assert withPgtk -> withGTK3 && !withX && gtk3 != null;
assert withXwidgets -> withGTK3 && webkitgtk != null;


let emacs = (if withMacport then llvmPackages_6.stdenv else stdenv).mkDerivation (lib.optionalAttrs nativeComp {
let
libGccJitLibraryPaths = [
"${lib.getLib libgccjit}/lib/gcc"
"${lib.getLib stdenv.cc.libc}/lib"
] ++ lib.optionals (stdenv.cc?cc.libgcc) [
"${lib.getLib stdenv.cc.cc.libgcc}/lib"
];
emacs = (if withMacport then llvmPackages_6.stdenv else stdenv).mkDerivation (lib.optionalAttrs nativeComp {
NATIVE_FULL_AOT = "1";
LIBRARY_PATH = "${lib.getLib stdenv.cc.libc}/lib";
LIBRARY_PATH = lib.concatStringsSep ":" libGccJitLibraryPaths;
} // {
pname = pname + lib.optionalString ( !withX && !withNS && !withMacport && !withGTK2 && !withGTK3 ) "-nox";
inherit version;
Expand All @@ -73,17 +80,15 @@ let emacs = (if withMacport then llvmPackages_6.stdenv else stdenv).mkDerivation
then ./native-comp-driver-options-28.patch
else ./native-comp-driver-options.patch;
backendPath = (lib.concatStringsSep " "
(builtins.map (x: ''"-B${x}"'') [
(builtins.map (x: ''"-B${x}"'') ([
# Paths necessary so the JIT compiler finds its libraries:
"${lib.getLib libgccjit}/lib"
"${lib.getLib libgccjit}/lib/gcc"
"${lib.getLib stdenv.cc.libc}/lib"

] ++ libGccJitLibraryPaths ++ [
# Executable paths necessary for compilation (ld, as):
"${lib.getBin stdenv.cc.cc}/bin"
"${lib.getBin stdenv.cc.bintools}/bin"
"${lib.getBin stdenv.cc.bintools.bintools}/bin"
]));
])));
})
];

Expand Down
4 changes: 4 additions & 0 deletions pkgs/applications/emulators/mame/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ stdenv.mkDerivation rec {
--subst-var-by mamePath "$out/opt/mame"
'';

NIX_CFLAGS_COMPILE = [
"-Wno-error=use-after-free"
];

desktopItems = [
(makeDesktopItem {
name = "MAME";
Expand Down
5 changes: 5 additions & 0 deletions pkgs/applications/graphics/foxotron/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ stdenv.mkDerivation rec {
++ lib.optionals stdenv.hostPlatform.isLinux [ libX11 libXrandr libXinerama libXcursor libXi libXext alsa-lib fontconfig libGLU ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ AVFoundation Carbon Cocoa CoreAudio Kernel OpenGL ];

NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
];

installPhase = ''
runHook preInstall

Expand Down
6 changes: 6 additions & 0 deletions pkgs/applications/graphics/goxel/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [ scons pkg-config wrapGAppsHook ];
buildInputs = [ glfw3 gtk3 libpng12 ];

NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=format-truncation"
];

NIX_LDFLAGS = "-lpthread";

buildPhase = ''
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub
{ lib, stdenv, fetchFromGitHub, fetchpatch
, pkg-config, cmake, ninja, yasm
, libjpeg, openssl_1_1, libopus, ffmpeg, alsa-lib, libpulseaudio, protobuf
, openh264, usrsctp, libevent, libvpx
Expand Down Expand Up @@ -31,6 +31,14 @@ stdenv.mkDerivation {
mesa libepoxy libglvnd
];

patches = [
# GCC 12 Fix
(fetchpatch {
url = "https://github.com/desktop-app/tg_owt/pull/101/commits/86d2bcd7afb8706663d29e30f65863de5a626142.patch";
hash = "sha256-iWS0mB8R0vqPU/0qf6Ax54UCAKYDVCPac2mi/VHbFm0=";
})
];

cmakeFlags = [
# Building as a shared library isn't officially supported and may break at any time.
"-DBUILD_SHARED_LIBS=OFF"
Expand Down
5 changes: 5 additions & 0 deletions pkgs/applications/science/biology/octopus/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ stdenv.mkDerivation rec {
sha256 = "sha256-VaUr63v7mzhh4VBghH7a7qrqOYwl6vucmmKzTi9yAjY=";
}) ];

NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=deprecated-declarations"
];

postInstall = ''
mkdir $out/bin
mv $out/octopus $out/bin
Expand Down
10 changes: 7 additions & 3 deletions pkgs/applications/science/logic/cbmc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ stdenv.mkDerivation rec {
--prefix PATH : "$out/share/cbmc" \
'';

# fix "argument unused during compilation"
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang
"-Wno-unused-command-line-argument";
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=maybe-uninitialized"
] ++ lib.optionals stdenv.cc.isClang [
# fix "argument unused during compilation"
"-Wno-unused-command-line-argument"
];

# TODO: add jbmc support
cmakeFlags = [ "-DWITH_JBMC=OFF" "-Dsat_impl=cadical" "-Dcadical_INCLUDE_DIR=${cadical.dev}/include" ];
Expand Down
6 changes: 6 additions & 0 deletions pkgs/applications/science/math/mxnet/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ stdenv.mkDerivation rec {
] else [ "-DUSE_CUDA=OFF" ])
++ lib.optional (!cudnnSupport) "-DUSE_CUDNN=OFF";

NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=maybe-uninitialized"
"-Wno-error=uninitialized"
];

postPatch = ''
substituteInPlace 3rdparty/mkldnn/tests/CMakeLists.txt \
--replace "/bin/bash" "${bash}/bin/bash"
Expand Down
5 changes: 5 additions & 0 deletions pkgs/applications/version-management/fnc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ stdenv.mkDerivation rec {

makeFlags = [ "PREFIX=$(out)" ];

NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=maybe-uninitialized"
];

preInstall = ''
mkdir -p $out/bin
'';
Expand Down
1 change: 1 addition & 0 deletions pkgs/build-support/bintools-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ stdenv.mkDerivation {
outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (bintools ? info) "info");

passthru = {
inherit (bintools.passthru) isFromBootstrapFiles;
inherit targetPrefix suffixSalt;
inherit bintools libc nativeTools nativeLibc nativePrefix isGNU isLLVM;

Expand Down
6 changes: 4 additions & 2 deletions pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
, lib
, stdenvNoCC
, cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell
, gccForLibs ? null
, gccForLibs ? if useCcForLibs then cc else null
, zlib ? null
, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
, propagateDoc ? cc != null && cc ? man
Expand All @@ -18,6 +18,7 @@
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
, buildPackages ? {}
, libcxx ? null
, useCcForLibs ? isClang || (cc.passthru.enableExternalBootstrap or false)
}:

with lib;
Expand Down Expand Up @@ -63,7 +64,7 @@ let
then import ../expand-response-params { inherit (buildPackages) stdenv; }
else "";

useGccForLibs = isClang
useGccForLibs = useCcForLibs
&& libcxx == null
&& !stdenv.targetPlatform.isDarwin
&& !(stdenv.targetPlatform.useLLVM or false)
Expand Down Expand Up @@ -155,6 +156,7 @@ stdenv.mkDerivation {
inherit expand-response-params;

inherit nixSupport;
inherit (cc.passthru) isFromBootstrapFiles;
};

dontBuild = true;
Expand Down
6 changes: 4 additions & 2 deletions pkgs/build-support/emacs/wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ runCommand
# Store all paths we want to add to emacs here, so that we only need to add
# one path to the load lists
deps = runCommand "emacs-packages-deps"
{
({
inherit explicitRequires lndir emacs;
nativeBuildInputs = lib.optional nativeComp gcc;
}
} // lib.optionalAttrs nativeComp {
inherit (emacs) LIBRARY_PATH;
})
''
findInputsOld() {
local pkg="$1"; shift
Expand Down
3 changes: 2 additions & 1 deletion pkgs/build-support/setup-hooks/reproducible-builds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# derivation and not easily collide with other builds.
# We also truncate the hash so that it cannot cause reference cycles.
NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE:-} -frandom-seed=$(
outbase="${out##*/}"
randSeed=${NIX_OUTPATH_USED_AS_RANDOM_SEED:-$out}
outbase="${randSeed##*/}"
randomseed="${outbase:0:10}"
echo $randomseed
)"
Expand Down
24 changes: 21 additions & 3 deletions pkgs/development/compilers/gcc/11/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
, buildPackages
, libxcrypt
, nukeReferences
, callPackage
, enableGdbPlugin ? enablePlugin
, enableExternalBootstrap
? (with stdenv; targetPlatform == hostPlatform && hostPlatform == buildPlatform)
&& stdenv.enableGccExternalBootstrapForStdenv or false
, enableLibGccOutput
? (with stdenv; targetPlatform == hostPlatform)
}:

# Make sure we get GNU sed.
Expand Down Expand Up @@ -91,7 +99,7 @@ let majorVersion = "11";

in

stdenv.mkDerivation ({
lib.pipe (stdenv.mkDerivation ({
pname = "${crossNameAddon}${name}";
inherit version;

Expand Down Expand Up @@ -165,7 +173,7 @@ stdenv.mkDerivation ({
libcCross crossMingw;

depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ texinfo which gettext ]
nativeBuildInputs = [ texinfo which gettext nukeReferences ]
++ (optional (perl != null) perl)
++ (optional langAda gnatboot)
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with
Expand Down Expand Up @@ -220,6 +228,8 @@ stdenv.mkDerivation ({
enableMultilib
enablePlugin
enableShared
enableGdbPlugin
enableExternalBootstrap

langC
langD
Expand Down Expand Up @@ -306,4 +316,12 @@ stdenv.mkDerivation ({
}

// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
)
))
(callPackage ../common/external-bootstrap.nix {
inherit
version
langC langCC langJit
enablePlugin
profiledCompiler
enableExternalBootstrap enableLibGccOutput;
}).mkDerivationOverrides
25 changes: 22 additions & 3 deletions pkgs/development/compilers/gcc/12/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
, buildPackages
, libxcrypt
, nukeReferences
, callPackage
, enableGdbPlugin ? enablePlugin
, enableExternalBootstrap
? (with stdenv; targetPlatform == hostPlatform && hostPlatform == buildPlatform)
&& stdenv.enableGccExternalBootstrapForStdenv or false
, enableLibGccOutput
? (with stdenv; targetPlatform == hostPlatform)
}:

# Make sure we get GNU sed.
Expand Down Expand Up @@ -125,7 +133,7 @@ let majorVersion = "12";

in

stdenv.mkDerivation ({
lib.pipe (stdenv.mkDerivation ({
pname = "${crossNameAddon}${name}";
inherit version;

Expand Down Expand Up @@ -199,7 +207,7 @@ stdenv.mkDerivation ({
libcCross crossMingw;

depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ texinfo which gettext ]
nativeBuildInputs = [ texinfo which gettext nukeReferences ]
++ (optional (perl != null) perl)
++ (optional langAda gnatboot)
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with
Expand Down Expand Up @@ -256,6 +264,8 @@ stdenv.mkDerivation ({
enableMultilib
enablePlugin
enableShared
enableGdbPlugin
enableExternalBootstrap

langC
langD
Expand Down Expand Up @@ -342,4 +352,13 @@ stdenv.mkDerivation ({
}

// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
)
))
(callPackage ../common/external-bootstrap.nix {
inherit
version
langC langCC langJit
enablePlugin
profiledCompiler
enableExternalBootstrap enableLibGccOutput;
}).mkDerivationOverrides

1 change: 1 addition & 0 deletions pkgs/development/compilers/gcc/9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ stdenv.mkDerivation ({
passthru = {
inherit langC langCC langObjC langObjCpp langAda langFortran langGo langD version;
isGNU = true;
isFromBootstrapFiles = false;
};

enableParallelBuilding = true;
Expand Down
Loading