summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2019-09-08 20:44:26 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2019-09-08 20:44:26 +0200
commit5f4734b1dd8410d5287fe0f22b9c0f30850a2fc3 (patch)
treec999ad66361e4c4c5d3ad5443bf575422c41150d /pkgs
parentccc8c73ea00321318e9ac2cb75879f57bef328a7 (diff)
parente7297363c95415aa2376130583d6c74a85714ab5 (diff)
downloadnixpkgs-5f4734b1dd8410d5287fe0f22b9c0f30850a2fc3.tar
nixpkgs-5f4734b1dd8410d5287fe0f22b9c0f30850a2fc3.tar.gz
nixpkgs-5f4734b1dd8410d5287fe0f22b9c0f30850a2fc3.tar.bz2
nixpkgs-5f4734b1dd8410d5287fe0f22b9c0f30850a2fc3.tar.lz
nixpkgs-5f4734b1dd8410d5287fe0f22b9c0f30850a2fc3.tar.xz
nixpkgs-5f4734b1dd8410d5287fe0f22b9c0f30850a2fc3.tar.zst
nixpkgs-5f4734b1dd8410d5287fe0f22b9c0f30850a2fc3.zip
Merge remote-tracking branch 'upstream/gcc-8' into staging-next
Earlier the gcc8 branch was merged instead of the gcc-8 branch (note the dash)...
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/audio/amarok/default.nix10
-rw-r--r--pkgs/applications/graphics/gnuclad/default.nix2
-rw-r--r--pkgs/applications/misc/getxbook/default.nix4
-rw-r--r--pkgs/applications/misc/netsurf/libwapcaplet/default.nix2
-rw-r--r--pkgs/applications/networking/cluster/mesos/default.nix3
-rw-r--r--pkgs/applications/networking/instant-messengers/pidgin-plugins/telegram-purple/default.nix8
-rw-r--r--pkgs/applications/networking/irc/bip/default.nix2
-rw-r--r--pkgs/applications/science/biology/ants/default.nix10
-rw-r--r--pkgs/development/compilers/chez/default.nix2
-rw-r--r--pkgs/development/compilers/edk2/default.nix1
-rw-r--r--pkgs/development/compilers/iasl/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/3.8/D17533-1.patch60
-rw-r--r--pkgs/development/compilers/llvm/3.8/clang/default.nix81
-rw-r--r--pkgs/development/compilers/llvm/3.8/clang/purity.patch17
-rw-r--r--pkgs/development/compilers/llvm/3.8/default.nix59
-rw-r--r--pkgs/development/compilers/llvm/3.8/fix-llvm-config.patch11
-rw-r--r--pkgs/development/compilers/llvm/3.8/libc++/darwin.patch39
-rw-r--r--pkgs/development/compilers/llvm/3.8/libc++/default.nix53
-rw-r--r--pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh6
-rw-r--r--pkgs/development/compilers/llvm/3.8/libc++abi.nix52
-rw-r--r--pkgs/development/compilers/llvm/3.8/lldb.nix51
-rw-r--r--pkgs/development/compilers/llvm/3.8/llvm.nix116
-rw-r--r--pkgs/development/compilers/llvm/4/llvm.nix8
-rw-r--r--pkgs/development/compilers/llvm/5/llvm.nix8
-rw-r--r--pkgs/development/interpreters/gnu-apl/default.nix10
-rw-r--r--pkgs/development/libraries/agg/default.nix5
-rw-r--r--pkgs/development/libraries/belle-sip/default.nix9
-rw-r--r--pkgs/development/libraries/bzrtp/default.nix2
-rw-r--r--pkgs/development/libraries/cpp-hocon/default.nix2
-rw-r--r--pkgs/development/libraries/glibc/default.nix2
-rw-r--r--pkgs/development/libraries/leatherman/default.nix5
-rw-r--r--pkgs/development/libraries/libdynd/default.nix3
-rw-r--r--pkgs/development/libraries/libextractor/default.nix1
-rw-r--r--pkgs/development/libraries/libextractor/fix-gcc8-build.patch16
-rw-r--r--pkgs/development/libraries/libfaketime/default.nix2
-rw-r--r--pkgs/development/libraries/liboping/default.nix2
-rw-r--r--pkgs/development/libraries/libwhereami/default.nix3
-rw-r--r--pkgs/development/libraries/mediastreamer/default.nix8
-rw-r--r--pkgs/development/libraries/mps/default.nix1
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/default.nix2
-rw-r--r--pkgs/development/libraries/science/benchmark/papi/default.nix2
-rw-r--r--pkgs/development/libraries/smpeg/default.nix1
-rw-r--r--pkgs/development/libraries/smpeg/libx11.patch25
-rw-r--r--pkgs/development/libraries/uri/default.nix11
-rw-r--r--pkgs/development/libraries/vtk/default.nix6
-rw-r--r--pkgs/development/libraries/zeroc-ice/default.nix2
-rw-r--r--pkgs/development/libraries/zeroc-ice/makefile.patch9
-rw-r--r--pkgs/development/libraries/zookeeper_mt/default.nix31
-rw-r--r--pkgs/development/ocaml-modules/bap/default.nix10
-rw-r--r--pkgs/development/ocaml-modules/llvm/default.nix10
-rw-r--r--pkgs/development/ruby-modules/gem-config/default.nix15
-rw-r--r--pkgs/development/tools/misc/openocd/default.nix1
-rw-r--r--pkgs/os-specific/linux/mmc-utils/default.nix6
-rw-r--r--pkgs/os-specific/linux/setools/default.nix12
-rw-r--r--pkgs/os-specific/linux/usbip/default.nix5
-rw-r--r--pkgs/os-specific/linux/usbip/fix-snprintf-truncation.patch13
-rw-r--r--pkgs/servers/amqp/qpid-cpp/default.nix2
-rw-r--r--pkgs/servers/dict/libmaa.nix2
-rw-r--r--pkgs/servers/http/nginx/generic.nix5
-rw-r--r--pkgs/servers/mail/postfix/pfixtools.nix5
-rw-r--r--pkgs/servers/nosql/aerospike/default.nix2
-rw-r--r--pkgs/servers/nosql/arangodb/default.nix1
-rw-r--r--pkgs/tools/filesystems/blobfuse/default.nix4
-rw-r--r--pkgs/tools/filesystems/darling-dmg/default.nix18
-rw-r--r--pkgs/tools/filesystems/irods/default.nix6
-rw-r--r--pkgs/tools/networking/altermime/default.nix1
-rw-r--r--pkgs/tools/security/chaps/default.nix8
-rw-r--r--pkgs/tools/system/facter/default.nix2
-rw-r--r--pkgs/top-level/all-packages.nix31
-rw-r--r--pkgs/top-level/ocaml-packages.nix6
70 files changed, 275 insertions, 659 deletions
diff --git a/pkgs/applications/audio/amarok/default.nix b/pkgs/applications/audio/amarok/default.nix
index ff3c456c364..c72815d5ca2 100644
--- a/pkgs/applications/audio/amarok/default.nix
+++ b/pkgs/applications/audio/amarok/default.nix
@@ -6,18 +6,18 @@
 , curl, ffmpeg, gdk-pixbuf, libaio, libmtp, loudmouth, lzo, lz4, mysql57, pcre, snappy, taglib, taglib_extras
 }:
 
-mkDerivation {
+mkDerivation rec {
   pname = "amarok";
-  version = "2.9.0-20190731";
+  version = "2.9.0-20190824";
 
   src = fetchgit {
     # master has the Qt5 version as of April 2018 but a formal release has not
     # yet been made so change this back to the proper upstream when such a
     # release is out
     url    = git://anongit.kde.org/amarok.git;
-    # url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.CZ";
-    rev    = "783da6d8e93737f5e41a3bc017906dc1f94bb94f";
-    sha256 = "08bypxk5kaay98hbwz9pj3hwgiyk3qmn9qw99bnjkkkw9wzsxiy6";
+    # url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.xz";
+    rev    = "457fbda25a85a102bfda92aa7137e7ef5e4c8b00";
+    sha256 = "1ig2mg8pqany6m2zplkrvldcv4ibxwsypnyv5igm7nz7ax82cd5j";
   };
 
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
diff --git a/pkgs/applications/graphics/gnuclad/default.nix b/pkgs/applications/graphics/gnuclad/default.nix
index eb48333997c..2535f7514f1 100644
--- a/pkgs/applications/graphics/gnuclad/default.nix
+++ b/pkgs/applications/graphics/gnuclad/default.nix
@@ -10,6 +10,8 @@ stdenv.mkDerivation rec {
     sha256 = "0ka2kscpjff7gflsargv3r9fdaxhkf3nym9mfaln3pnq6q7fwdki";
   };
 
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=catch-value" ];
+
   nativeBuildInputs = [ pkgconfig ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/misc/getxbook/default.nix b/pkgs/applications/misc/getxbook/default.nix
index 265181d7db3..b2a992b850e 100644
--- a/pkgs/applications/misc/getxbook/default.nix
+++ b/pkgs/applications/misc/getxbook/default.nix
@@ -9,12 +9,12 @@ stdenv.mkDerivation rec {
     sha256 = "0ihwrx4gspj8l7fc8vxch6dpjrw1lvv9z3c19f0wxnmnxhv1cjvs";
   };
 
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=format-truncation" "-Wno-error=deprecated-declarations" ];
+
   buildInputs = [ openssl ];
 
   makeFlags = [ "PREFIX=$(out)" ];
 
-  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
-
   meta = with stdenv.lib; {
     description = "A collection of tools to download books from Google Books";
     homepage    = https://njw.me.uk/getxbook/;
diff --git a/pkgs/applications/misc/netsurf/libwapcaplet/default.nix b/pkgs/applications/misc/netsurf/libwapcaplet/default.nix
index a234af740f3..ad59b1be10e 100644
--- a/pkgs/applications/misc/netsurf/libwapcaplet/default.nix
+++ b/pkgs/applications/misc/netsurf/libwapcaplet/default.nix
@@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
     "NSSHARED=${buildsystem}/share/netsurf-buildsystem"
   ];
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cast-function-type";
+
   meta = with stdenv.lib; {
     homepage = http://www.netsurf-browser.org/;
     description = "String internment library for netsurf browser";
diff --git a/pkgs/applications/networking/cluster/mesos/default.nix b/pkgs/applications/networking/cluster/mesos/default.nix
index 0ffc7a1fb6f..1ad30335b94 100644
--- a/pkgs/applications/networking/cluster/mesos/default.nix
+++ b/pkgs/applications/networking/cluster/mesos/default.nix
@@ -61,6 +61,9 @@ in stdenv.mkDerivation rec {
   propagatedBuildInputs = [
     pythonProtobuf
   ];
+
+  NIX_CFLAGS_COMPILE = "-Wno-error=format-overflow -Wno-error=class-memaccess";
+
   preConfigure = ''
     # https://issues.apache.org/jira/browse/MESOS-6616
     configureFlagsArray+=(
diff --git a/pkgs/applications/networking/instant-messengers/pidgin-plugins/telegram-purple/default.nix b/pkgs/applications/networking/instant-messengers/pidgin-plugins/telegram-purple/default.nix
index df2665d8ce8..ef298883b1b 100644
--- a/pkgs/applications/networking/instant-messengers/pidgin-plugins/telegram-purple/default.nix
+++ b/pkgs/applications/networking/instant-messengers/pidgin-plugins/telegram-purple/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchgit, pkgconfig, pidgin, libwebp, libgcrypt, gettext } :
 
 let
-  version = "1.3.0";
+  version = "1.3.1";
 in
 stdenv.mkDerivation rec {
   pname = "telegram-purple";
@@ -9,10 +9,12 @@ stdenv.mkDerivation rec {
 
   src = fetchgit {
     url = "https://github.com/majn/telegram-purple";
-    rev = "0340e4f14b2480782db4e5b9242103810227c522";
-    sha256 = "1xb7hrgisbpx00dsrm5yz934bdd7nfzicd7k855iynk3hjzqj7k5";
+    rev = "v${version}";
+    sha256 = "0p93jpjpx7hszwffzgixw04zkrpsiyzz4za3gfr4j07krc4771fp";
   };
 
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=cast-function-type" ];
+
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ pidgin libwebp libgcrypt gettext ];
 
diff --git a/pkgs/applications/networking/irc/bip/default.nix b/pkgs/applications/networking/irc/bip/default.nix
index 0792aefe25f..249fdc958c8 100644
--- a/pkgs/applications/networking/irc/bip/default.nix
+++ b/pkgs/applications/networking/irc/bip/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  NIX_CFLAGS_COMPILE = [ "-Wno-error=unused-result" "-Wno-error=duplicate-decl-specifier" ];
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=unused-result" "-Wno-error=duplicate-decl-specifier" "-Wno-error=format-truncation" ];
 
   meta = {
     description = "An IRC proxy (bouncer)";
diff --git a/pkgs/applications/science/biology/ants/default.nix b/pkgs/applications/science/biology/ants/default.nix
index d1a990a5eb2..834d2497e8d 100644
--- a/pkgs/applications/science/biology/ants/default.nix
+++ b/pkgs/applications/science/biology/ants/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, makeWrapper, itk, vtk }:
+{ stdenv, fetchFromGitHub, fetchpatch, cmake, makeWrapper, itk, vtk }:
 
 stdenv.mkDerivation rec {
   _name    = "ANTs";
@@ -12,6 +12,14 @@ stdenv.mkDerivation rec {
     sha256 = "1hrdwv3m9xh3yf7l0rm2ggxc2xzckfb8srs88g485ibfszx7i03q";
   };
 
+  patches = [
+    # Fix build with gcc8
+    (fetchpatch {
+      url = "https://github.com/ANTsX/ANTs/commit/89af9b2694715bf8204993e032fa132f80cf37bd.patch";
+      sha256 = "1glkrwa1jmxxbmzihycxr576azjqby31jwpj165qc54c91pn0ams";
+    })
+  ];
+
   nativeBuildInputs = [ cmake makeWrapper ];
   buildInputs = [ itk vtk ];
 
diff --git a/pkgs/development/compilers/chez/default.nix b/pkgs/development/compilers/chez/default.nix
index 1bac7eb9b95..12d68f0265c 100644
--- a/pkgs/development/compilers/chez/default.nix
+++ b/pkgs/development/compilers/chez/default.nix
@@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=format-truncation";
+
   /*
   ** We patch out a very annoying 'feature' in ./configure, which
   ** tries to use 'git' to update submodules.
diff --git a/pkgs/development/compilers/edk2/default.nix b/pkgs/development/compilers/edk2/default.nix
index 2a90902df1e..97af433d606 100644
--- a/pkgs/development/compilers/edk2/default.nix
+++ b/pkgs/development/compilers/edk2/default.nix
@@ -26,6 +26,7 @@ edk2 = stdenv.mkDerivation {
   buildInputs = [ libuuid pythonEnv ];
 
   makeFlags = [ "-C BaseTools" ];
+  NIX_CFLAGS_COMPILE = "-Wno-return-type -Wno-error=stringop-truncation";
 
   hardeningDisable = [ "format" "fortify" ];
 
diff --git a/pkgs/development/compilers/iasl/default.nix b/pkgs/development/compilers/iasl/default.nix
index ab9fd23f508..1bcf4106a34 100644
--- a/pkgs/development/compilers/iasl/default.nix
+++ b/pkgs/development/compilers/iasl/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   pname = "iasl";
-  version = "20181213";
+  version = "20190108";
 
   src = fetchurl {
     url = "https://acpica.org/sites/acpica/files/acpica-unix-${version}.tar.gz";
-    sha256 = "1vgqlv9pvxc52faxixpgz7hi1awqmj88bw5vqn3bldf6fmkh147w";
+    sha256 = "0bqhr3ndchvfhxb31147z8gd81dysyz5dwkvmp56832d0js2564q";
   };
 
   NIX_CFLAGS_COMPILE = [
diff --git a/pkgs/development/compilers/llvm/3.8/D17533-1.patch b/pkgs/development/compilers/llvm/3.8/D17533-1.patch
deleted file mode 100644
index 79ca953d6e5..00000000000
--- a/pkgs/development/compilers/llvm/3.8/D17533-1.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-commit eb92f5a745014532b83abfba04602fce87ca8393
-Author: Chuang-Yu Cheng <cycheng@multicorewareinc.com>
-Date:   Fri Apr 8 12:04:32 2016 +0000
-
-    CXX_FAST_TLS calling convention: performance improvement for PPC64
-    
-    This is the same change on PPC64 as r255821 on AArch64. I have even borrowed
-    his commit message.
-    
-    The access function has a short entry and a short exit, the initialization
-    block is only run the first time. To improve the performance, we want to
-    have a short frame at the entry and exit.
-    
-    We explicitly handle most of the CSRs via copies. Only the CSRs that are not
-    handled via copies will be in CSR_SaveList.
-    
-    Frame lowering and prologue/epilogue insertion will generate a short frame
-    in the entry and exit according to CSR_SaveList. The majority of the CSRs will
-    be handled by register allcoator. Register allocator will try to spill and
-    reload them in the initialization block.
-    
-    We add CSRsViaCopy, it will be explicitly handled during lowering.
-    
-    1> we first set FunctionLoweringInfo->SplitCSR if conditions are met (the target
-       supports it for the given machine function and the function has only return
-       exits). We also call TLI->initializeSplitCSR to perform initialization.
-    2> we call TLI->insertCopiesSplitCSR to insert copies from CSRsViaCopy to
-       virtual registers at beginning of the entry block and copies from virtual
-       registers to CSRsViaCopy at beginning of the exit blocks.
-    3> we also need to make sure the explicit copies will not be eliminated.
-    
-    Author: Tom Jablin (tjablin)
-    Reviewers: hfinkel kbarton cycheng
-    
-    http://reviews.llvm.org/D17533
-    
-    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265781 91177308-0d34-0410-b5e6-96231b3b80d8
-
-diff --git a/lib/CodeGen/TargetFrameLoweringImpl.cpp b/lib/CodeGen/TargetFrameLoweringImpl.cpp
-index 679ade1..0a0e079 100644
---- a/lib/CodeGen/TargetFrameLoweringImpl.cpp
-+++ b/lib/CodeGen/TargetFrameLoweringImpl.cpp
-@@ -63,12 +63,15 @@ void TargetFrameLowering::determineCalleeSaves(MachineFunction &MF,
-   const TargetRegisterInfo &TRI = *MF.getSubtarget().getRegisterInfo();
-   const MCPhysReg *CSRegs = TRI.getCalleeSavedRegs(&MF);
- 
-+  // Resize before the early returns. Some backends expect that
-+  // SavedRegs.size() == TRI.getNumRegs() after this call even if there are no
-+  // saved registers.
-+  SavedRegs.resize(TRI.getNumRegs());
-+
-   // Early exit if there are no callee saved registers.
-   if (!CSRegs || CSRegs[0] == 0)
-     return;
- 
--  SavedRegs.resize(TRI.getNumRegs());
--
-   // In Naked functions we aren't going to save any registers.
-   if (MF.getFunction()->hasFnAttribute(Attribute::Naked))
-     return;
diff --git a/pkgs/development/compilers/llvm/3.8/clang/default.nix b/pkgs/development/compilers/llvm/3.8/clang/default.nix
deleted file mode 100644
index 0276393d840..00000000000
--- a/pkgs/development/compilers/llvm/3.8/clang/default.nix
+++ /dev/null
@@ -1,81 +0,0 @@
-{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python }:
-
-let
-  gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
-  self = stdenv.mkDerivation {
-    pname = "clang";
-    inherit version;
-
-    src = fetch "cfe" "1prc72xmkgx8wrzmrr337776676nhsp1qd3mw2bvb22bzdnq7lsc";
-
-    unpackPhase = ''
-      unpackFile $src
-      mv cfe-${version}.src clang
-      sourceRoot=$PWD/clang
-      unpackFile ${clang-tools-extra_src}
-      mv clang-tools-extra-* $sourceRoot/tools/extra
-    '';
-
-    nativeBuildInputs = [ cmake ];
-    buildInputs = [ libxml2 llvm python ];
-
-    cmakeFlags = [
-      "-DCMAKE_CXX_FLAGS=-std=c++11"
-    ] ++
-    # Maybe with compiler-rt this won't be needed?
-    (stdenv.lib.optional stdenv.isLinux "-DGCC_INSTALL_PREFIX=${gcc}") ++
-    (stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include");
-
-    patches = [ ./purity.patch ];
-
-    postPatch = ''
-      sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
-      sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
-    '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
-      sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/Tools.cpp
-    '';
-
-    outputs = [ "out" "lib" "python" ];
-
-    # Clang expects to find LLVMgold in its own prefix
-    # Clang expects to find sanitizer libraries in its own prefix
-    postInstall = ''
-      if [ -e ${llvm}/lib/LLVMgold.so ]; then
-        ln -sv ${llvm}/lib/LLVMgold.so $out/lib
-      fi
-
-      ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/
-      ln -sv $out/bin/clang $out/bin/cpp
-
-      # Move libclang to 'lib' output
-      moveToOutput "lib/libclang.*" "$lib"
-      substituteInPlace $out/share/clang/cmake/ClangTargets-release.cmake \
-          --replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang."
-
-      mkdir -p $python/bin $python/share/clang/
-      mv $out/bin/{git-clang-format,scan-view} $python/bin
-      if [ -e $out/bin/set-xcode-analyzer ]; then
-        mv $out/bin/set-xcode-analyzer $python/bin
-      fi
-      mv $out/share/clang/*.py $python/share/clang
-
-      rm $out/bin/c-index-test
-    '';
-
-    enableParallelBuilding = true;
-
-    passthru = {
-      isClang = true;
-      inherit llvm;
-    } // stdenv.lib.optionalAttrs stdenv.isLinux {
-      inherit gcc;
-    };
-
-    meta = {
-      description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
-      homepage    = http://llvm.org/;
-      license     = stdenv.lib.licenses.ncsa;
-      platforms   = stdenv.lib.platforms.all;
-    };
-  };
-in self
diff --git a/pkgs/development/compilers/llvm/3.8/clang/purity.patch b/pkgs/development/compilers/llvm/3.8/clang/purity.patch
deleted file mode 100644
index 2d1c68d865e..00000000000
--- a/pkgs/development/compilers/llvm/3.8/clang/purity.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- a/lib/Driver/Tools.cpp	2016-02-12 15:51:41.000000000 -0700
-+++ b/lib/Driver/Tools.cpp	2016-03-08 15:39:06.790111122 -0700
-@@ -8833,15 +8833,6 @@
-     CmdArgs.push_back("-shared");
-   }
- 
--  if (Arch == llvm::Triple::arm || Arch == llvm::Triple::armeb ||
--      Arch == llvm::Triple::thumb || Arch == llvm::Triple::thumbeb ||
--      (!Args.hasArg(options::OPT_static) &&
--       !Args.hasArg(options::OPT_shared))) {
--    CmdArgs.push_back("-dynamic-linker");
--    CmdArgs.push_back(Args.MakeArgString(
--        D.DyldPrefix + getLinuxDynamicLinker(Args, ToolChain)));
--  }
--
-   CmdArgs.push_back("-o");
-   CmdArgs.push_back(Output.getFilename());
diff --git a/pkgs/development/compilers/llvm/3.8/default.nix b/pkgs/development/compilers/llvm/3.8/default.nix
deleted file mode 100644
index a848c8b9252..00000000000
--- a/pkgs/development/compilers/llvm/3.8/default.nix
+++ /dev/null
@@ -1,59 +0,0 @@
-{ newScope, stdenv, libstdcxxHook, isl, fetchurl, overrideCC, wrapCCWith
-, buildLlvmTools # tools, but from the previous stage, for cross
-, targetLlvmLibraries # libraries, but from the next stage, for cross
-}:
-
-let
-  version = "3.8.1";
-
-  fetch = fetch_v version;
-  fetch_v = ver: name: sha256: fetchurl {
-    url = "https://releases.llvm.org/${ver}/${name}-${ver}.src.tar.xz";
-    inherit sha256;
-  };
-
-  compiler-rt_src = fetch "compiler-rt" "0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d";
-  clang-tools-extra_src = fetch "clang-tools-extra" "15n39r4ssphpaq4a0wzyjm7ilwxb0bch6nrapy8c5s8d49h5qjk6";
-
-  tools = stdenv.lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv isl version fetch; });
- in {
-    llvm = callPackage ./llvm.nix {
-      inherit compiler-rt_src;
-    };
-
-    clang-unwrapped = callPackage ./clang {
-      inherit clang-tools-extra_src;
-    };
-
-    libclang = tools.clang-unwrapped.lib;
-
-    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
-
-    libstdcxxClang = wrapCCWith {
-      cc = tools.clang-unwrapped;
-      extraPackages = [ libstdcxxHook ];
-    };
-
-    libcxxClang = wrapCCWith {
-      cc = tools.clang-unwrapped;
-      extraPackages = [ targetLlvmLibraries.libcxx targetLlvmLibraries.libcxxabi ];
-    };
-
-    lldb = callPackage ./lldb.nix {};
-  });
-
-  libraries = stdenv.lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv isl version fetch; });
-  in {
-
-    stdenv = overrideCC stdenv buildLlvmTools.clang;
-
-    libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
-
-    libcxx = callPackage ./libc++ {};
-
-    libcxxabi = callPackage ./libc++abi.nix {};
-  });
-
-in { inherit tools libraries; } // libraries // tools
diff --git a/pkgs/development/compilers/llvm/3.8/fix-llvm-config.patch b/pkgs/development/compilers/llvm/3.8/fix-llvm-config.patch
deleted file mode 100644
index 6e56c67c897..00000000000
--- a/pkgs/development/compilers/llvm/3.8/fix-llvm-config.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- llvm.org/utils/llvm-build/llvmbuild/main.py	2015-10-07 00:24:35.000000000 +0100
-+++ llvm/utils/llvm-build/llvmbuild/main.py	2017-06-16 17:08:39.866586578 +0100
-@@ -413,7 +413,7 @@
-             if library_name is None:
-                 library_name_as_cstr = 'nullptr'
-             else:
--                library_name_as_cstr = '"lib%s.a"' % library_name
-+                library_name_as_cstr = '"lib%s.so"' % library_name
-             if is_installed:
-                 is_installed_as_cstr = 'true'
-             else:
diff --git a/pkgs/development/compilers/llvm/3.8/libc++/darwin.patch b/pkgs/development/compilers/llvm/3.8/libc++/darwin.patch
deleted file mode 100644
index 6dd756f01cc..00000000000
--- a/pkgs/development/compilers/llvm/3.8/libc++/darwin.patch
+++ /dev/null
@@ -1,39 +0,0 @@
---- libcxx-3.8.0.src.org/lib/CMakeLists.txt	2015-12-16 15:41:05.000000000 -0800
-+++ libcxx-3.8.0.src/lib/CMakeLists.txt	2016-06-17 19:40:00.293394500 -0700
-@@ -94,30 +94,30 @@
-     add_definitions(-D__STRICT_ANSI__)
-     add_link_flags(
-       "-compatibility_version 1"
-       "-current_version 1"
--      "-install_name /usr/lib/libc++.1.dylib"
--      "-Wl,-reexport_library,/usr/lib/libc++abi.dylib"
-+      "-install_name ${LIBCXX_LIBCXXABI_LIB_PATH}/libc++.1.dylib"
-+      "-Wl,-reexport_library,${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib"
-       "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
-       "/usr/lib/libSystem.B.dylib")
-   else()
-     if ( ${CMAKE_OSX_SYSROOT} )
-       list(FIND ${CMAKE_OSX_ARCHITECTURES} "armv7" OSX_HAS_ARMV7)
-       if (OSX_HAS_ARMV7)
-         set(OSX_RE_EXPORT_LINE
--          "${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"
-+          "${CMAKE_OSX_SYSROOT}${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib"
-           "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp")
-       else()
-         set(OSX_RE_EXPORT_LINE
--          "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib")
-+          "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib")
-       endif()
-     else()
--      set(OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
-+      set(OSX_RE_EXPORT_LINE "${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
-     endif()
- 
-     add_link_flags(
-       "-compatibility_version 1"
--      "-install_name /usr/lib/libc++.1.dylib"
-+      "-install_name ${LIBCXX_LIBCXXABI_LIB_PATH}/libc++.1.dylib"
-       "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
-       "${OSX_RE_EXPORT_LINE}"
-       "-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/notweak.exp"
-       "-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/weak.exp")
diff --git a/pkgs/development/compilers/llvm/3.8/libc++/default.nix b/pkgs/development/compilers/llvm/3.8/libc++/default.nix
deleted file mode 100644
index 7c965926f2e..00000000000
--- a/pkgs/development/compilers/llvm/3.8/libc++/default.nix
+++ /dev/null
@@ -1,53 +0,0 @@
-{ lib, stdenv, fetch, cmake, libcxxabi, fixDarwinDylibNames, version }:
-
-stdenv.mkDerivation {
-  pname = "libc++";
-  inherit version;
-
-  src = fetch "libcxx" "1k7f9qk5bgwa02ksh6yr9hccwcbhmcdzl1fpbdw6s2c89iwg7mvp";
-
-  postUnpack = ''
-    unpackFile ${libcxxabi.src}
-  '';
-
-  preConfigure = ''
-    # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
-    cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$NIX_BUILD_TOP/libcxxabi-${version}.src/include")
-  '';
-
-  patches = [
-    # glibc 2.26 fix
-    ../../3.9/libc++/xlocale-glibc-2.26.patch
-  ]
-  ++ lib.optional stdenv.isDarwin ./darwin.patch
-  ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
-    ../../libcxx-0001-musl-hacks.patch
-    ../../libcxx-max_align_t.patch
-  ];
-
-  nativeBuildInputs = [ cmake ];
-
-  buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
-
-  cmakeFlags = [
-    "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
-    "-DLIBCXX_LIBCPPABI_VERSION=2"
-    "-DLIBCXX_CXX_ABI=libcxxabi"
-  ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
-
-  enableParallelBuilding = true;
-
-  linkCxxAbi = stdenv.isLinux;
-
-  setupHooks = [
-    ../../../../../build-support/setup-hooks/role.bash
-    ./setup-hook.sh
-  ];
-
-  meta = {
-    homepage = http://libcxx.llvm.org/;
-    description = "A new implementation of the C++ standard library, targeting C++11";
-    license = with stdenv.lib.licenses; [ ncsa mit ];
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh
deleted file mode 100644
index 6611259165a..00000000000
--- a/pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-# See pkgs/build-support/setup-hooks/role.bash
-getHostRole
-
-linkCxxAbi="@linkCxxAbi@"
-export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/3.8/libc++abi.nix b/pkgs/development/compilers/llvm/3.8/libc++abi.nix
deleted file mode 100644
index 80b069fff75..00000000000
--- a/pkgs/development/compilers/llvm/3.8/libc++abi.nix
+++ /dev/null
@@ -1,52 +0,0 @@
-{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
-
-stdenv.mkDerivation {
-  pname = "libc++abi";
-  inherit version;
-
-  src = fetch "libcxxabi" "1qfs2iis1i0ppv11jndc98cvd7s25pj46pq2sfyldmzswdxmzdg1";
-
-  nativeBuildInputs = [ cmake ];
-  buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
-
-  postUnpack = ''
-    unpackFile ${libcxx.src}
-    unpackFile ${llvm.src}
-    export NIX_CFLAGS_COMPILE+=" -I$PWD/include"
-    export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include"
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
-    export TRIPLE=x86_64-apple-darwin
-  '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
-    patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
-    patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch}
-  '';
-
-  installPhase = if stdenv.isDarwin
-    then ''
-      for file in lib/*.dylib; do
-        # this should be done in CMake, but having trouble figuring out
-        # the magic combination of necessary CMake variables
-        # if you fancy a try, take a look at
-        # http://www.cmake.org/Wiki/CMake_RPATH_handling
-        install_name_tool -id $out/$file $file
-      done
-      make install
-      install -d 755 $out/include
-      install -m 644 ../include/*.h $out/include
-    ''
-    else ''
-      install -d -m 755 $out/include $out/lib
-      install -m 644 lib/libc++abi.so.1.0 $out/lib
-      install -m 644 ../include/cxxabi.h $out/include
-      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
-      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
-    '';
-
-  meta = {
-    homepage = http://libcxxabi.llvm.org/;
-    description = "A new implementation of low level support for a standard C++ library";
-    license = with stdenv.lib.licenses; [ ncsa mit ];
-    maintainers = with stdenv.lib.maintainers; [ vlstill ];
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.8/lldb.nix b/pkgs/development/compilers/llvm/3.8/lldb.nix
deleted file mode 100644
index 985cd666385..00000000000
--- a/pkgs/development/compilers/llvm/3.8/lldb.nix
+++ /dev/null
@@ -1,51 +0,0 @@
-{ stdenv
-, fetch
-, cmake
-, zlib
-, ncurses
-, swig
-, which
-, libedit
-, llvm
-, clang-unwrapped
-, python
-, version
-}:
-
-stdenv.mkDerivation {
-  pname = "lldb";
-  inherit version;
-
-  src = fetch "lldb" "18z8vhfgh4m57hl66i83cp4d4mv3i86z2hjhbp5rvqs7d88li49l";
-
-  postUnpack = ''
-    # Hack around broken standalone builf as of 3.8
-    unpackFile ${llvm.src}
-    srcDir="$(ls -d lldb-*.src)"
-    mkdir -p "$srcDir/tools/lib/Support"
-    cp "$(ls -d llvm-*.src)/lib/Support/regex_impl.h" "$srcDir/tools/lib/Support/"
-  '';
-
-  buildInputs = [ cmake python which swig ncurses zlib libedit llvm ];
-
-  hardeningDisable = [ "format" ];
-
-  cmakeFlags = [
-    "-DLLDB_PATH_TO_LLVM_BUILD=${llvm}"
-    "-DLLVM_MAIN_INCLUDE_DIR=${llvm}/include"
-    "-DLLDB_PATH_TO_CLANG_BUILD=${clang-unwrapped}"
-    "-DCLANG_MAIN_INCLUDE_DIR=${clang-unwrapped}/include"
-    "-DPYTHON_VERSION_MAJOR=2"
-    "-DPYTHON_VERSION_MINOR=7"
-    "-DLLDB_DISABLE_LIBEDIT=1" # https://llvm.org/bugs/show_bug.cgi?id=28898
-  ];
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "A next-generation high-performance debugger";
-    homepage    = http://llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    platforms   = stdenv.lib.platforms.all;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/3.8/llvm.nix b/pkgs/development/compilers/llvm/3.8/llvm.nix
deleted file mode 100644
index bca8e7877ac..00000000000
--- a/pkgs/development/compilers/llvm/3.8/llvm.nix
+++ /dev/null
@@ -1,116 +0,0 @@
-{ stdenv
-, fetch
-, fetchpatch
-, perl
-, groff
-, cmake
-, python
-, libffi
-, libbfd
-, libxml2
-, ncurses
-, version
-, zlib
-, compiler-rt_src
-, debugVersion ? false
-, enableSharedLibraries ? true
-}:
-
-stdenv.mkDerivation {
-  pname = "llvm";
-  inherit version;
-
-  src = fetch "llvm" "1ybmnid4pw2hxn12ax5qa5kl1ldfns0njg8533y3mzslvd5cx0kf";
-
-  unpackPhase = ''
-    unpackFile $src
-    mv llvm-${version}.src llvm
-    sourceRoot=$PWD/llvm
-    unpackFile ${compiler-rt_src}
-    mv compiler-rt-* $sourceRoot/projects/compiler-rt
-  '';
-
-  buildInputs = [ perl groff cmake libxml2 python libffi ];
-
-  propagatedBuildInputs = [ ncurses zlib ];
-
-  # Fix a segfault in llc
-  # See http://lists.llvm.org/pipermail/llvm-dev/2016-October/106500.html
-  patches = [ ./D17533-1.patch ]
-   ++ stdenv.lib.optional (!stdenv.isDarwin) ./fix-llvm-config.patch
-   ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
-     ../TLI-musl.patch
-     ../dynamiclibrary-musl.patch
-   ];
-
-  # hacky fix: New LLVM releases require a newer macOS SDK than
-  # 10.9. This is a temporary measure until nixpkgs darwin support is
-  # updated.
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
-    sed -i 's/os_trace(\(.*\)");$/printf(\1\\n");/g' ./projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
-
-    substituteInPlace CMakeLists.txt \
-      --replace 'set(CMAKE_INSTALL_NAME_DIR "@rpath")' "set(CMAKE_INSTALL_NAME_DIR "$out/lib")" \
-      --replace 'set(CMAKE_INSTALL_RPATH "@executable_path/../lib")' ""
-  ''
-  + ''
-    (
-      cd projects/compiler-rt
-      patch -p1 < ${
-        fetchpatch {
-          name = "sigaltstack.patch"; # for glibc-2.26
-          url = https://github.com/llvm-mirror/compiler-rt/commit/8a5e425a68d.diff;
-          sha256 = "0h4y5vl74qaa7dl54b1fcyqalvlpd8zban2d1jxfkxpzyi7m8ifi";
-        }
-      }
-    )
-  '';
-
-  # hacky fix: created binaries need to be run before installation
-  preBuild = ''
-    mkdir -p $out/
-    ln -sv $PWD/lib $out
-  '';
-
-  cmakeFlags = with stdenv; [
-    "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
-    "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=ON"
-    "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_ENABLE_RTTI=ON"
-
-    "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
-  ] ++ stdenv.lib.optional enableSharedLibraries [
-    "-DLLVM_LINK_LLVM_DYLIB=ON"
-  ] ++ stdenv.lib.optional (!isDarwin)
-    "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
-    ++ stdenv.lib.optionals ( isDarwin) [
-    "-DLLVM_ENABLE_LIBCXX=ON"
-    "-DCAN_TARGET_i386=false"
-  ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
-    # Not yet supported
-    "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
-    "-DCOMPILER_RT_BUILD_XRAY=OFF"
-
-  ];
-
-  postBuild = ''
-    rm -fR $out
-  '';
-
-  postInstall = stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) ''
-    ln -s $out/lib/libLLVM.dylib $out/lib/libLLVM-${version}.dylib
-  '';
-
-  enableParallelBuilding = true;
-
-  meta = {
-    description = "Collection of modular and reusable compiler and toolchain technologies";
-    homepage    = http://llvm.org/;
-    license     = stdenv.lib.licenses.ncsa;
-    maintainers = with stdenv.lib.maintainers; [ lovek323 raskin ];
-    platforms   = stdenv.lib.platforms.all;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix
index 392ef427909..7e855995352 100644
--- a/pkgs/development/compilers/llvm/4/llvm.nix
+++ b/pkgs/development/compilers/llvm/4/llvm.nix
@@ -46,6 +46,14 @@ stdenv.mkDerivation ({
 
   propagatedBuildInputs = [ ncurses zlib ];
 
+  patches = [
+    (fetchpatch {
+      name = "0001-Fix-return-type-in-ORC-readMem-client-interface.patch";
+      url = "https://bugzilla.redhat.com/attachment.cgi?id=1389687";
+      sha256 = "0ga2123aclq3x9w72d0rm0az12m8c1i4r1106vh701hf4cghgbch";
+    })
+  ];
+
   # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
   # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
   # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
diff --git a/pkgs/development/compilers/llvm/5/llvm.nix b/pkgs/development/compilers/llvm/5/llvm.nix
index efe2022bedb..02db395db57 100644
--- a/pkgs/development/compilers/llvm/5/llvm.nix
+++ b/pkgs/development/compilers/llvm/5/llvm.nix
@@ -1,5 +1,6 @@
 { stdenv
 , fetch
+, fetchpatch
 , cmake
 , python
 , libffi
@@ -42,6 +43,13 @@ stdenv.mkDerivation ({
 
   propagatedBuildInputs = [ ncurses zlib ];
 
+  patches = [
+    (fetchpatch {
+      url = "https://bugzilla.redhat.com/attachment.cgi?id=1389687";
+      name = "llvm-gcc8-type-mismatch.patch";
+      sha256 = "0ga2123aclq3x9w72d0rm0az12m8c1i4r1106vh701hf4cghgbch";
+    })
+  ];
   postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
     substituteInPlace cmake/modules/AddLLVM.cmake \
       --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
diff --git a/pkgs/development/interpreters/gnu-apl/default.nix b/pkgs/development/interpreters/gnu-apl/default.nix
index 7f15c2b3184..94ec0244382 100644
--- a/pkgs/development/interpreters/gnu-apl/default.nix
+++ b/pkgs/development/interpreters/gnu-apl/default.nix
@@ -11,9 +11,13 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ readline gettext ncurses ];
 
-  # Needed with GCC 7
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isGNU "-Wno-error=int-in-bool-context"
-    + stdenv.lib.optionalString stdenv.cc.isClang "-Wno-error=null-dereference";
+  # Needed with GCC 8
+  NIX_CFLAGS_COMPILE = with stdenv.lib; (optionals stdenv.cc.isGNU [
+    "-Wno-error=int-in-bool-context"
+    "-Wno-error=class-memaccess"
+    "-Wno-error=restrict"
+    "-Wno-error=format-truncation"
+   ]) ++ optional stdenv.cc.isClang "-Wno-error=null-dereference";
 
   patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
     substituteInPlace src/LApack.cc --replace "malloc.h" "malloc/malloc.h"
diff --git a/pkgs/development/libraries/agg/default.nix b/pkgs/development/libraries/agg/default.nix
index c0539aeed47..69517817b59 100644
--- a/pkgs/development/libraries/agg/default.nix
+++ b/pkgs/development/libraries/agg/default.nix
@@ -10,6 +10,11 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ autoconf automake libtool freetype SDL libX11 ];
 
+  postPatch = ''
+    substituteInPlace include/agg_renderer_outline_aa.h \
+      --replace 'line_profile_aa& profile() {' 'const line_profile_aa& profile() {'
+  '';
+
   # fix build with new automake, from Gentoo ebuild
   preConfigure = ''
     sed -i '/^AM_C_PROTOTYPES/d' configure.in
diff --git a/pkgs/development/libraries/belle-sip/default.nix b/pkgs/development/libraries/belle-sip/default.nix
index 09ca4908d78..9c124a62601 100644
--- a/pkgs/development/libraries/belle-sip/default.nix
+++ b/pkgs/development/libraries/belle-sip/default.nix
@@ -18,7 +18,11 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ zlib ];
 
-  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
+  NIX_CFLAGS_COMPILE = [
+    "-Wno-error=deprecated-declarations"
+    "-Wno-error=format-truncation"
+    "-Wno-error=cast-function-type"
+  ];
 
   propagatedBuildInputs = [ antlr3_4 libantlr3c polarssl bctoolbox ];
 
@@ -26,7 +30,8 @@ stdenv.mkDerivation rec {
     "--with-polarssl=${polarssl}"
   ];
 
-  enableParallelBuilding = true;
+  # Fails to build with lots of parallel jobs
+  enableParallelBuilding = false;
 
   meta = with stdenv.lib; {
     homepage = http://www.linphone.org/index.php/eng;
diff --git a/pkgs/development/libraries/bzrtp/default.nix b/pkgs/development/libraries/bzrtp/default.nix
index 11b94a0181a..42453848066 100644
--- a/pkgs/development/libraries/bzrtp/default.nix
+++ b/pkgs/development/libraries/bzrtp/default.nix
@@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ bctoolbox sqlite ];
   nativeBuildInputs = [ cmake ];
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cast-function-type";
+
   meta = with stdenv.lib; {
     description = "BZRTP is an opensource implementation of ZRTP keys exchange protocol";
     homepage = https://github.com/BelledonneCommunications/bzrtp;
diff --git a/pkgs/development/libraries/cpp-hocon/default.nix b/pkgs/development/libraries/cpp-hocon/default.nix
index ea3eec825c7..d172ab55fa3 100644
--- a/pkgs/development/libraries/cpp-hocon/default.nix
+++ b/pkgs/development/libraries/cpp-hocon/default.nix
@@ -11,6 +11,8 @@ stdenv.mkDerivation rec {
     owner = "puppetlabs";
   };
 
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=catch-value" ];
+
   nativeBuildInputs = [ cmake ];
 
   buildInputs = [ boost curl leatherman ];
diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix
index 444d6c458fb..eda71af5978 100644
--- a/pkgs/development/libraries/glibc/default.nix
+++ b/pkgs/development/libraries/glibc/default.nix
@@ -40,6 +40,8 @@ callPackage ./common.nix { inherit stdenv; } {
     #      limit rebuilds by only disabling pie w/musl
       ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "pie";
 
+    NIX_CFLAGS_COMPILE = if withGd then "-Wno-error=stringop-truncation" else null;
+
     # When building glibc from bootstrap-tools, we need libgcc_s at RPATH for
     # any program we run, because the gcc will have been placed at a new
     # store path than that determined when built (as a source for the
diff --git a/pkgs/development/libraries/leatherman/default.nix b/pkgs/development/libraries/leatherman/default.nix
index f91612caca1..a84e6b5c08d 100644
--- a/pkgs/development/libraries/leatherman/default.nix
+++ b/pkgs/development/libraries/leatherman/default.nix
@@ -11,7 +11,10 @@ stdenv.mkDerivation rec {
     owner = "puppetlabs";
   };
 
-  buildInputs = [ boost cmake curl ruby ];
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=ignored-qualifiers" "-Wno-error=class-memaccess" "-Wno-error=catch-value" ];
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ boost curl ruby ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/libdynd/default.nix b/pkgs/development/libraries/libdynd/default.nix
index f8baa347914..249f3f4f21a 100644
--- a/pkgs/development/libraries/libdynd/default.nix
+++ b/pkgs/development/libraries/libdynd/default.nix
@@ -20,6 +20,9 @@ stdenv.mkDerivation {
   NIX_CFLAGS_COMPILE = [
     "-Wno-error=implicit-fallthrough"
     "-Wno-error=nonnull"
+    "-Wno-error=tautological-compare"
+    "-Wno-error=class-memaccess"
+    "-Wno-error=parentheses"
   ];
 
   buildInputs = [ cmake ];
diff --git a/pkgs/development/libraries/libextractor/default.nix b/pkgs/development/libraries/libextractor/default.nix
index 43e6abe1a39..8fd01dbd506 100644
--- a/pkgs/development/libraries/libextractor/default.nix
+++ b/pkgs/development/libraries/libextractor/default.nix
@@ -15,6 +15,7 @@ stdenv.mkDerivation rec {
   };
 
   patches = [
+    ./fix-gcc8-build.patch
     # Fixes build with exiv2 0.27
     (fetchpatch {
       name = "libextractor-exiv2-0.27.patch";
diff --git a/pkgs/development/libraries/libextractor/fix-gcc8-build.patch b/pkgs/development/libraries/libextractor/fix-gcc8-build.patch
new file mode 100644
index 00000000000..e04d09be899
--- /dev/null
+++ b/pkgs/development/libraries/libextractor/fix-gcc8-build.patch
@@ -0,0 +1,16 @@
+diff --git a/src/plugins/ole2_extractor.c b/src/plugins/ole2_extractor.c
+index 072ffc5..a105840 100644
+--- a/src/plugins/ole2_extractor.c
++++ b/src/plugins/ole2_extractor.c
+@@ -345,9 +345,8 @@ process_star_office (GsfInput *src,
+     gsf_input_read (src, size, (unsigned char*) buf);
+     if ( (buf[0] != 0x0F) ||
+ 	 (buf[1] != 0x0) ||
+-	 (0 != strncmp (&buf[2],
+-			"SfxDocumentInfo",
+-			strlen ("SfxDocumentInfo"))) ||
++	 (0 != strcmp (&buf[2],
++			"SfxDocumentInfo")) ||
+ 	 (buf[0x11] != 0x0B) ||
+ 	 (buf[0x13] != 0x00) || /* pw protected! */
+ 	 (buf[0x12] != 0x00) )
diff --git a/pkgs/development/libraries/libfaketime/default.nix b/pkgs/development/libraries/libfaketime/default.nix
index 62f1b087de5..10e9efed26a 100644
--- a/pkgs/development/libraries/libfaketime/default.nix
+++ b/pkgs/development/libraries/libfaketime/default.nix
@@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
   PREFIX = placeholder "out";
   LIBDIRNAME = "/lib";
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cast-function-type -Wno-error=format-truncation";
+
   checkInputs = [ perl ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/liboping/default.nix b/pkgs/development/libraries/liboping/default.nix
index ca026811d69..ff8f200a3bb 100644
--- a/pkgs/development/libraries/liboping/default.nix
+++ b/pkgs/development/libraries/liboping/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "1n2wkmvw6n80ybdwkjq8ka43z2x8mvxq49byv61b52iyz69slf7b";
   };
 
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=format-truncation" ];
+
   buildInputs = [ ncurses perl ];
 
   configureFlags = stdenv.lib.optional (perl == null) "--with-perl-bindings=no";
diff --git a/pkgs/development/libraries/libwhereami/default.nix b/pkgs/development/libraries/libwhereami/default.nix
index 18f6d37768a..cafd25ede0a 100644
--- a/pkgs/development/libraries/libwhereami/default.nix
+++ b/pkgs/development/libraries/libwhereami/default.nix
@@ -11,8 +11,7 @@ stdenv.mkDerivation rec {
     owner = "puppetlabs";
   };
 
-  # post gcc7, upstream bug: https://tickets.puppetlabs.com/browse/FACT-1828
-  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated";
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=catch-value" ];
 
   nativeBuildInputs = [ cmake ];
 
diff --git a/pkgs/development/libraries/mediastreamer/default.nix b/pkgs/development/libraries/mediastreamer/default.nix
index 4b69d5d0aaf..05494d1ad1a 100644
--- a/pkgs/development/libraries/mediastreamer/default.nix
+++ b/pkgs/development/libraries/mediastreamer/default.nix
@@ -34,8 +34,12 @@ stdenv.mkDerivation rec {
     openssl
   ];
 
-  NIX_CFLAGS_COMPILE = " -DGIT_VERSION=\"v2.14.0\" -Wno-error=deprecated-declarations ";
-  NIX_LDFLAGS = " -lXext -lssl ";
+  NIX_CFLAGS_COMPILE = [
+    "-DGIT_VERSION=\"v2.14.0\""
+    "-Wno-error=deprecated-declarations"
+    "-Wno-error=cast-function-type"
+  ];
+  NIX_LDFLAGS = "-lXext -lssl";
 
   meta = with stdenv.lib; {
     description = "A powerful and lightweight streaming engine specialized for voice/video telephony applications";
diff --git a/pkgs/development/libraries/mps/default.nix b/pkgs/development/libraries/mps/default.nix
index 3767b22ba0d..ec3b4e20147 100644
--- a/pkgs/development/libraries/mps/default.nix
+++ b/pkgs/development/libraries/mps/default.nix
@@ -16,6 +16,7 @@ stdenv.mkDerivation rec {
   NIX_CFLAGS_COMPILE = [
     "-Wno-implicit-fallthrough"
     "-Wno-error=clobbered"
+    "-Wno-error=cast-function-type"
   ];
 
 
diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix
index 530b500f9d8..71e8375ee00 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -48,6 +48,8 @@ stdenv.mkDerivation rec {
   prePatch = ''
     substituteInPlace configure --replace /bin/pwd pwd
     substituteInPlace src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls
+    substituteInPlace src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp \
+      --replace 'asm volatile' 'asm'
     sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i config.tests/*/*.test -i mkspecs/*/*.conf
   '' + lib.optionalString stdenv.isDarwin ''
     # remove impure reference to /usr/lib/libstdc++.6.dylib
diff --git a/pkgs/development/libraries/science/benchmark/papi/default.nix b/pkgs/development/libraries/science/benchmark/papi/default.nix
index 53d30019f28..35d0914e3f7 100644
--- a/pkgs/development/libraries/science/benchmark/papi/default.nix
+++ b/pkgs/development/libraries/science/benchmark/papi/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
     sha256 = "13mngf9kl0y2wfxqvkad0smdaag7k8fvw82b4312gx62nwhc1i6r";
   };
 
-  buildInputs = [ stdenv ];
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=format-truncation" ];
 
   preConfigure = ''
     cd src
diff --git a/pkgs/development/libraries/smpeg/default.nix b/pkgs/development/libraries/smpeg/default.nix
index 35d5075a949..e2866788302 100644
--- a/pkgs/development/libraries/smpeg/default.nix
+++ b/pkgs/development/libraries/smpeg/default.nix
@@ -13,6 +13,7 @@ stdenv.mkDerivation rec {
   patches = [
     ./format.patch
     ./gcc6.patch
+    ./libx11.patch
   ];
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/libraries/smpeg/libx11.patch b/pkgs/development/libraries/smpeg/libx11.patch
new file mode 100644
index 00000000000..8611073780f
--- /dev/null
+++ b/pkgs/development/libraries/smpeg/libx11.patch
@@ -0,0 +1,25 @@
+Index: smpeg-0.4.5+cvs20030824/Makefile.am
+===================================================================
+--- smpeg-0.4.5+cvs20030824.orig/Makefile.am
++++ smpeg-0.4.5+cvs20030824/Makefile.am
+@@ -74,7 +74,7 @@
+ 
+ # Sources for gtv
+ gtv_SOURCES = gtv.c gtv.h
+-gtv_LDADD = @GTK_LIBS@ libsmpeg.la
++gtv_LDADD = @GTK_LIBS@ @X11_LIBS@ libsmpeg.la
+ 
+ # Sources for glmovie
+ glmovie_SOURCES = glmovie-tile.c glmovie.c glmovie.h
+Index: smpeg-0.4.5+cvs20030824/configure.in
+===================================================================
+--- smpeg-0.4.5+cvs20030824.orig/configure.in
++++ smpeg-0.4.5+cvs20030824/configure.in
+@@ -215,6 +215,7 @@
+         CFLAGS="$CFLAGS $GTK_CFLAGS"
+     fi
+     AC_SUBST(GTK_LIBS)
++    PKG_CHECK_MODULES([X11], [x11])
+ fi
+ AM_CONDITIONAL(HAVE_GTK, test x$have_gtk = xyes)
+ 
diff --git a/pkgs/development/libraries/uri/default.nix b/pkgs/development/libraries/uri/default.nix
index 46eac0fb88b..61246748ac7 100644
--- a/pkgs/development/libraries/uri/default.nix
+++ b/pkgs/development/libraries/uri/default.nix
@@ -1,15 +1,18 @@
 { stdenv, fetchFromGitHub, cmake, doxygen }:
 
-stdenv.mkDerivation {
-  name = "uri-2017-07-16";
+stdenv.mkDerivation rec {
+  name = "uri-${version}";
+  version = "1.1.0";
 
   src = fetchFromGitHub {
     owner = "cpp-netlib";
     repo = "uri";
-    rev = "ac30f19cc7a4745667a8ebd3eac68d5e70b9a4a6";
-    sha256 = "0ys295ij071rilwkk3xq1p3sdzgb0gyybvd3f0cahh67kh8hyk6n";
+    rev = "v${version}";
+    sha256 = "148361pixrm94q6v04k13s1msa04bx9yc3djb0lxpa7dlw19vhcd";
   };
 
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=parentheses" ];
+
   nativeBuildInputs = [ cmake doxygen ];
 
   cmakeFlags = [
diff --git a/pkgs/development/libraries/vtk/default.nix b/pkgs/development/libraries/vtk/default.nix
index e2a82b7adcd..c0b8fd7d167 100644
--- a/pkgs/development/libraries/vtk/default.nix
+++ b/pkgs/development/libraries/vtk/default.nix
@@ -8,8 +8,8 @@ with stdenv.lib;
 
 let
   os = stdenv.lib.optionalString;
-  majorVersion = "7.0";
-  minorVersion = "0";
+  majorVersion = "7.1";
+  minorVersion = "1";
   version = "${majorVersion}.${minorVersion}";
 in
 
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   name = "vtk-${os (qtLib != null) "qvtk-"}${version}";
   src = fetchurl {
     url = "${meta.homepage}files/release/${majorVersion}/VTK-${version}.tar.gz";
-    sha256 = "1hrjxkcvs3ap0bdhk90vymz5pgvxmg7q6sz8ab3wsyddbshr1abq";
+    sha256 = "0nm7xwwj7rnsxjdv2ssviys8nhci4n9iiiqm2y14s520hl2dsp1d";
   };
 
   buildInputs = [ cmake ]
diff --git a/pkgs/development/libraries/zeroc-ice/default.nix b/pkgs/development/libraries/zeroc-ice/default.nix
index 9a69d3168c5..e4d0c0fde17 100644
--- a/pkgs/development/libraries/zeroc-ice/default.nix
+++ b/pkgs/development/libraries/zeroc-ice/default.nix
@@ -32,6 +32,8 @@ in stdenv.mkDerivation rec {
   buildInputs = [ zeroc_mcpp bzip2 expat openssl lmdb ]
     ++ lib.optionals stdenv.isDarwin [ darwin.cctools libiconv Security ];
 
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=class-memaccess" ];
+
   prePatch = lib.optional stdenv.isDarwin ''
     substituteInPlace Make.rules.Darwin \
         --replace xcrun ""
diff --git a/pkgs/development/libraries/zeroc-ice/makefile.patch b/pkgs/development/libraries/zeroc-ice/makefile.patch
deleted file mode 100644
index 6955bcd0a6d..00000000000
--- a/pkgs/development/libraries/zeroc-ice/makefile.patch
+++ /dev/null
@@ -1,9 +0,0 @@
---- a/src/Makefile
-+++ b/src/Makefile
-@@ -77,4 +77,6 @@ FreezeScript: Freeze
- Glacier2 IceGridLib Glacier2CryptPermissionsVerifier: Glacier2Lib
- 
-+Glacier2: IceSSL
-+
- IcePatch2: IcePatch2Lib
- 
diff --git a/pkgs/development/libraries/zookeeper_mt/default.nix b/pkgs/development/libraries/zookeeper_mt/default.nix
index bb5b602b64a..4f69c1c8079 100644
--- a/pkgs/development/libraries/zookeeper_mt/default.nix
+++ b/pkgs/development/libraries/zookeeper_mt/default.nix
@@ -1,20 +1,21 @@
 { stdenv, zookeeper, bash }:
 
-stdenv.mkDerivation {
-   name = "zookeeper_mt-${stdenv.lib.getVersion zookeeper}";
-   
-   src = zookeeper.src;
-   
-   setSourceRoot = "export sourceRoot=${zookeeper.name}/src/c";
+stdenv.mkDerivation rec {
+  name = "zookeeper_mt-${stdenv.lib.getVersion zookeeper}";
 
-   buildInputs = [ zookeeper bash ];
+  src = zookeeper.src;
 
-   meta = with stdenv.lib; {
-   	homepage = http://zookeeper.apache.org;
-   	description = "Apache Zookeeper";
-   	license = licenses.asl20;
-   	maintainers = [ maintainers.boothead ];	
-   	platforms = platforms.unix;	
-   };
-}
+  setSourceRoot = "export sourceRoot=${zookeeper.name}/src/c";
+
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=format-overflow" ];
 
+  buildInputs = [ zookeeper bash ];
+
+  meta = with stdenv.lib; {
+    homepage = http://zookeeper.apache.org;
+    description = "Apache Zookeeper";
+    license = licenses.asl20;
+    maintainers = [ maintainers.boothead ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/development/ocaml-modules/bap/default.nix b/pkgs/development/ocaml-modules/bap/default.nix
index 30e3687676a..5ddb9a46224 100644
--- a/pkgs/development/ocaml-modules/bap/default.nix
+++ b/pkgs/development/ocaml-modules/bap/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchFromGitHub, fetchurl
 , ocaml, findlib, ocamlbuild, ocaml_oasis,
- bitstring, camlzip, cmdliner, core_kernel, ezjsonm, fileutils, ocaml_lwt, ocamlgraph, ocurl, re, uri, zarith, piqi, piqi-ocaml, uuidm, llvm_38, frontc, ounit, ppx_jane, parsexp,
- utop,
+ bitstring, camlzip, cmdliner, core_kernel, ezjsonm, fileutils, ocaml_lwt, ocamlgraph, ocurl, re, uri, zarith, piqi, piqi-ocaml, uuidm, llvm, frontc, ounit, ppx_jane, parsexp,
+ utop, libxml2,
  ppx_tools_versioned,
  which, makeWrapper, writeText
 }:
@@ -31,8 +31,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ which makeWrapper ];
 
   buildInputs = [ ocaml findlib ocamlbuild ocaml_oasis
-                  llvm_38 ppx_tools_versioned
-                  utop ];
+                  llvm ppx_tools_versioned
+                  utop libxml2 ];
 
   propagatedBuildInputs = [ bitstring camlzip cmdliner ppx_jane core_kernel ezjsonm fileutils ocaml_lwt ocamlgraph ocurl re uri zarith piqi parsexp
                             piqi-ocaml uuidm frontc ounit ];
@@ -51,7 +51,7 @@ stdenv.mkDerivation rec {
 
   disableIda = "--disable-ida --disable-fsi-benchmark";
 
-  configureFlags = [ "--enable-everything ${disableIda}" "--with-llvm-config=${llvm_38}/bin/llvm-config" ];
+  configureFlags = [ "--enable-everything ${disableIda}" "--with-llvm-config=${llvm}/bin/llvm-config" ];
 
   BAPBUILDFLAGS = "-j $(NIX_BUILD_CORES)";
 
diff --git a/pkgs/development/ocaml-modules/llvm/default.nix b/pkgs/development/ocaml-modules/llvm/default.nix
index c91a5712137..3cebefb33ed 100644
--- a/pkgs/development/ocaml-modules/llvm/default.nix
+++ b/pkgs/development/ocaml-modules/llvm/default.nix
@@ -11,18 +11,20 @@ stdenv.mkDerivation {
   buildInputs = [ python cmake llvm ocaml findlib ctypes ];
 
   patches = [ (fetchpatch {
-    url = https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/llvm/llvm.3.9/files/cmake.patch;
-    sha256 = "1fcc6ylfiw1npdhx7mrsj7h0dx7cym7i9664kpr76zqazb52ikm9";
+    url = https://raw.githubusercontent.com/ocaml/opam-repository/2bdc193f5a9305ea93bf0f0dfc1fbc327c8b9306/packages/llvm/llvm.7.0.0/files/fix-shared.patch;
+    sha256 = "1p98j3b1vrryfn1xa7i50m6mmm4dyw5ldafq6kyh9sfmdihz4zsx";
   })];
 
-  cmakeFlags = [ "-DLLVM_OCAML_OUT_OF_TREE=TRUE" ];
+  cmakeFlags = [
+    "-DLLVM_OCAML_OUT_OF_TREE=TRUE"
+    "-DLLVM_OCAML_INSTALL_PATH=${placeholder "out"}/ocaml"
+  ];
 
   buildFlags = "ocaml_all";
 
   installFlags = "-C bindings/ocaml";
 
   postInstall = ''
-    mv $out/lib/ocaml $out/ocaml
     mkdir -p $OCAMLFIND_DESTDIR/
     mv $out/ocaml $OCAMLFIND_DESTDIR/llvm
     mv $OCAMLFIND_DESTDIR/llvm/META{.llvm,}
diff --git a/pkgs/development/ruby-modules/gem-config/default.nix b/pkgs/development/ruby-modules/gem-config/default.nix
index 7f6ca505fc1..68c2011205a 100644
--- a/pkgs/development/ruby-modules/gem-config/default.nix
+++ b/pkgs/development/ruby-modules/gem-config/default.nix
@@ -242,7 +242,20 @@ in
     nativeBuildInputs = [ pkgconfig ];
     buildInputs = [ openssl ];
     hardeningDisable = [ "format" ];
-    NIX_CFLAGS_COMPILE = [ "-Wno-error=stringop-overflow" "-Wno-error=implicit-fallthrough" ];
+    NIX_CFLAGS_COMPILE = [
+      "-Wno-error=stringop-overflow"
+      "-Wno-error=implicit-fallthrough"
+      "-Wno-error=sizeof-pointer-memaccess"
+      "-Wno-error=cast-function-type"
+      "-Wno-error=class-memaccess"
+      "-Wno-error=ignored-qualifiers"
+      "-Wno-error=tautological-compare"
+    ];
+    dontBuild = false;
+    postPatch = ''
+      substituteInPlace Makefile \
+        --replace '-Wno-invalid-source-encoding' ""
+    '';
   };
 
   hitimes = attrs: {
diff --git a/pkgs/development/tools/misc/openocd/default.nix b/pkgs/development/tools/misc/openocd/default.nix
index d85a05ca245..80203dd0df9 100644
--- a/pkgs/development/tools/misc/openocd/default.nix
+++ b/pkgs/development/tools/misc/openocd/default.nix
@@ -29,6 +29,7 @@ stdenv.mkDerivation rec {
     "-Wno-implicit-fallthrough"
     "-Wno-format-truncation"
     "-Wno-format-overflow"
+    "-Wno-error=tautological-compare"
   ];
 
   postInstall = lib.optionalString stdenv.isLinux ''
diff --git a/pkgs/os-specific/linux/mmc-utils/default.nix b/pkgs/os-specific/linux/mmc-utils/default.nix
index e0b87f2010a..297faa2a604 100644
--- a/pkgs/os-specific/linux/mmc-utils/default.nix
+++ b/pkgs/os-specific/linux/mmc-utils/default.nix
@@ -2,12 +2,12 @@
 
 stdenv.mkDerivation {
   pname = "mmc-utils";
-  version = "2018-03-27";
+  version = "2018-12-14";
 
   src = fetchgit {
     url = "git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git";
-    rev = "b4fe0c8c0e57a74c01755fa9362703b60d7ee49d";
-    sha256 = "01llwan5j40mv5p867f31lm87qh0hcyhy892say60y5pxc0mzpyn";
+    rev = "aef913e31b659462fe6b9320d241676cba97f67b";
+    sha256 = "1mak9rqjp6yvqk2h5hfil5a9gfx138h62n3cryckfbhr6fmaylm7";
   };
 
   makeFlags = "CC=${stdenv.cc.targetPrefix}cc";
diff --git a/pkgs/os-specific/linux/setools/default.nix b/pkgs/os-specific/linux/setools/default.nix
index 039d875060a..1e82c492159 100644
--- a/pkgs/os-specific/linux/setools/default.nix
+++ b/pkgs/os-specific/linux/setools/default.nix
@@ -8,13 +8,13 @@ with python3.pkgs;
 
 buildPythonApplication rec {
   pname = "setools";
-  version = "2017-11-10";
+  version = "4.2.0";
 
   src = fetchFromGitHub {
-    owner = "TresysTechnology";
+    owner = "SELinuxProject";
     repo = pname;
-    rev = "a1aa0f33f5c428d3f9fe82960ed5de36f38047f7";
-    sha256 = "0iyj35fff93cprjkzbkg9dn5xz8dg5h2kjx3476fl625nxxskndn";
+    rev = version;
+    sha256 = "1bjwcvr6rjx79cdcvaxn68bdrnl4f2a8gnnqsngdxhkhwpddksjy";
   };
 
   nativeBuildInputs = [ bison flex swig ];
@@ -34,8 +34,8 @@ buildPythonApplication rec {
   '';
 
   meta = {
-    description = "SELinux Tools";
-    homepage = https://github.com/TresysTechnology/setools/wiki;
+    description = "SELinux Policy Analysis Tools";
+    homepage = https://github.com/SELinuxProject/setools;
     license = licenses.gpl2;
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/usbip/default.nix b/pkgs/os-specific/linux/usbip/default.nix
index 1bb92d7dce1..61f2c454046 100644
--- a/pkgs/os-specific/linux/usbip/default.nix
+++ b/pkgs/os-specific/linux/usbip/default.nix
@@ -5,6 +5,11 @@ stdenv.mkDerivation {
 
   src = kernel.src;
 
+  patches = [
+    # fixes build with gcc8
+    ./fix-snprintf-truncation.patch
+  ];
+
   nativeBuildInputs = [ autoconf automake libtool ];
   buildInputs = [ udev ];
 
diff --git a/pkgs/os-specific/linux/usbip/fix-snprintf-truncation.patch b/pkgs/os-specific/linux/usbip/fix-snprintf-truncation.patch
new file mode 100644
index 00000000000..63fca9ddbfe
--- /dev/null
+++ b/pkgs/os-specific/linux/usbip/fix-snprintf-truncation.patch
@@ -0,0 +1,13 @@
+diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c
+index 8159fd98680b..7d6eb3e3fe1e 100644
+--- a/tools/usb/usbip/libsrc/vhci_driver.c
++++ b/tools/usb/usbip/libsrc/vhci_driver.c
+@@ -111,7 +111,7 @@ static int parse_status(const char *value)
+ static int refresh_imported_device_list(void)
+ {
+ 	const char *attr_status;
+-	char status[MAX_STATUS_NAME+1] = "status";
++	char status[MAX_STATUS_NAME+2] = "status";
+ 	int i, ret;
+ 
+ 	for (i = 0; i < vhci_driver->ncontrollers; i++) {
diff --git a/pkgs/servers/amqp/qpid-cpp/default.nix b/pkgs/servers/amqp/qpid-cpp/default.nix
index 8446578507d..c63b234031b 100644
--- a/pkgs/servers/amqp/qpid-cpp/default.nix
+++ b/pkgs/servers/amqp/qpid-cpp/default.nix
@@ -38,6 +38,8 @@ let
       "-Wno-error=int-in-bool-context"
       "-Wno-error=maybe-uninitialized"
       "-Wno-error=unused-function"
+      "-Wno-error=ignored-qualifiers"
+      "-Wno-error=catch-value"
     ];
   };
 
diff --git a/pkgs/servers/dict/libmaa.nix b/pkgs/servers/dict/libmaa.nix
index d9f831c862f..4ac4328c35f 100644
--- a/pkgs/servers/dict/libmaa.nix
+++ b/pkgs/servers/dict/libmaa.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ libtool ];
   # configureFlags = [ "--datadir=/run/current-system/share/dictd" ];
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=format-truncation";
+
   meta = with stdenv.lib; {
     description = "Dict protocol server and client";
     maintainers = [ ];
diff --git a/pkgs/servers/http/nginx/generic.nix b/pkgs/servers/http/nginx/generic.nix
index e74d2f84d62..3edbed22b6b 100644
--- a/pkgs/servers/http/nginx/generic.nix
+++ b/pkgs/servers/http/nginx/generic.nix
@@ -70,7 +70,10 @@ stdenv.mkDerivation {
     ++ optional (with stdenv.hostPlatform; isLinux || isFreeBSD) "--with-file-aio"
     ++ map (mod: "--add-module=${mod.src}") modules;
 
-  NIX_CFLAGS_COMPILE = [ "-I${libxml2.dev}/include/libxml2" ] ++ optional stdenv.isDarwin "-Wno-error=deprecated-declarations";
+  NIX_CFLAGS_COMPILE = [
+    "-I${libxml2.dev}/include/libxml2"
+    "-Wno-error=implicit-fallthrough"
+  ] ++ optional stdenv.isDarwin "-Wno-error=deprecated-declarations";
 
   configurePlatforms = [];
 
diff --git a/pkgs/servers/mail/postfix/pfixtools.nix b/pkgs/servers/mail/postfix/pfixtools.nix
index 890cd188053..8a92843e43e 100644
--- a/pkgs/servers/mail/postfix/pfixtools.nix
+++ b/pkgs/servers/mail/postfix/pfixtools.nix
@@ -42,7 +42,10 @@ stdenv.mkDerivation {
                       --replace /bin/bash ${bash}/bin/bash;
   '';
 
-  NIX_CFLAGS_COMPILE = "-Wno-error=unused-result -Wno-error=nonnull-compare";
+  NIX_CFLAGS_COMPILE = [
+    "-Wno-error=unused-result" "-Wno-error=nonnull-compare"
+    "-Wno-error=format-truncation"
+  ];
 
   makeFlags = "DESTDIR=$(out) prefix=";
 
diff --git a/pkgs/servers/nosql/aerospike/default.nix b/pkgs/servers/nosql/aerospike/default.nix
index ccd8a9b0237..d3b80aa00fe 100644
--- a/pkgs/servers/nosql/aerospike/default.nix
+++ b/pkgs/servers/nosql/aerospike/default.nix
@@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoconf automake libtool ];
   buildInputs = [ openssl zlib ];
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=format-truncation";
+
   preBuild = ''
     patchShebangs build/gen_version
     substituteInPlace build/gen_version --replace 'git describe' 'echo ${version}'
diff --git a/pkgs/servers/nosql/arangodb/default.nix b/pkgs/servers/nosql/arangodb/default.nix
index 871e335628c..52e6c787bef 100644
--- a/pkgs/servers/nosql/arangodb/default.nix
+++ b/pkgs/servers/nosql/arangodb/default.nix
@@ -53,7 +53,6 @@ let
     };
   };
 in {
-  arangodb_3_2 = common { version = "3.2.18";     sha256 = "05mfrx1g6dh1bzzqs23nvk0rg3v8y2dhdam4lym55pzlhqa7lf0x"; };
   arangodb_3_3 = common { version = "3.3.23.1";   sha256 = "0bnbiispids7jcgrgcmanf9jqgvk0vaflrvgalz587jwr2zf21k8"; };
   arangodb_3_4 = common { version = "3.4.7";      sha256 = "1wr2xvi5lnl6f2ryyxdwn4wnfiaz0rrf58ja1k19m7b6w3264iim"; };
   arangodb_3_5 = common { version = "3.5.0-rc.7"; sha256 = "1sdmbmyml9d3ia3706bv5901qqmh4sxk7js5b9hyfjqpcib10d1k"; };
diff --git a/pkgs/tools/filesystems/blobfuse/default.nix b/pkgs/tools/filesystems/blobfuse/default.nix
index 067f200e201..6fc0e3a7f21 100644
--- a/pkgs/tools/filesystems/blobfuse/default.nix
+++ b/pkgs/tools/filesystems/blobfuse/default.nix
@@ -11,6 +11,8 @@ stdenv.mkDerivation rec {
     sha256 = "1qh04z1fsj1l6l12sz9yl2sy9hwlrnzac54hwrr7wvsgv90n9gbp";
   };
 
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=catch-value" ];
+
   buildInputs = [ curl gnutls libgcrypt libuuid fuse ];
   nativeBuildInputs = [ cmake pkgconfig ];
 
@@ -20,4 +22,4 @@ stdenv.mkDerivation rec {
     maintainers = with maintainers; [ jbgi ];
     platforms = platforms.linux;
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/tools/filesystems/darling-dmg/default.nix b/pkgs/tools/filesystems/darling-dmg/default.nix
index 4d40d61b570..0890db67fe7 100644
--- a/pkgs/tools/filesystems/darling-dmg/default.nix
+++ b/pkgs/tools/filesystems/darling-dmg/default.nix
@@ -1,24 +1,18 @@
-{ stdenv, fetchFromGitHub, fetchpatch, cmake, fuse, zlib, bzip2, openssl, libxml2, icu } :
+{ stdenv, fetchFromGitHub, cmake, fuse, zlib, bzip2, openssl, libxml2, icu } :
 
 stdenv.mkDerivation rec {
   pname = "darling-dmg";
-  version = "1.0.4";
+  version = "1.0.4+git20180914";
 
   src = fetchFromGitHub {
     owner = "darlinghq";
     repo = "darling-dmg";
-    rev = "v${version}";
-    sha256 = "0x285p16zfnp0p6injw1frc8krif748sfgxhdd7gb75kz0dfbkrk";
+    rev = "97a92a6930e43cdbc9dedaee62716e3223deb027";
+    sha256 = "1bngr4827qnl4s2f7z39wjp13nfm3zzzykjshb43wvjz536bnqdj";
   };
 
-  patches = [
-    (fetchpatch {
-      url = "https://github.com/darlinghq/darling-dmg/commit/cbb0092264b5c5cf3e92d6c2de23f02d859ebf44.patch";
-    sha256 = "05fhgn5c09f1rva6bvbq16nhlkblrhscbf69k04ajwdh7y98sw39";
-     })
-  ];
-
-  buildInputs = [ cmake fuse openssl zlib bzip2 libxml2 icu ];
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ fuse openssl zlib bzip2 libxml2 icu ];
 
   # compat with icu61+ https://github.com/unicode-org/icu/blob/release-64-2/icu4c/readme.html#L554
   CXXFLAGS = [ "-DU_USING_ICU_NAMESPACE=1" ];
diff --git a/pkgs/tools/filesystems/irods/default.nix b/pkgs/tools/filesystems/irods/default.nix
index 031c1440fcf..14790ae7087 100644
--- a/pkgs/tools/filesystems/irods/default.nix
+++ b/pkgs/tools/filesystems/irods/default.nix
@@ -30,6 +30,12 @@ in rec {
     #                         but we don't use /usr with nix, so remove only 2 items.
     patches = [ ./irods_root_path.patch ];
 
+    NIX_CFLAGS_COMPILE = [
+      # fix build with recent llvm versions
+      "-Wno-deprecated-register"
+      "-Wno-deprecated-declarations"
+    ];
+
     preConfigure = common.preConfigure + ''
       patchShebangs ./test
       substituteInPlace plugins/database/CMakeLists.txt --replace "COMMAND cpp" "COMMAND ${gcc.cc}/bin/cpp"
diff --git a/pkgs/tools/networking/altermime/default.nix b/pkgs/tools/networking/altermime/default.nix
index a77fd56f673..e9091086ed9 100644
--- a/pkgs/tools/networking/altermime/default.nix
+++ b/pkgs/tools/networking/altermime/default.nix
@@ -14,6 +14,7 @@ stdenv.mkDerivation rec {
     "-Wno-error=format-truncation"
     "-Wno-error=pointer-compare"
     "-Wno-error=memset-elt-size"
+    "-Wno-error=restrict"
   ];
 
   postPatch = ''
diff --git a/pkgs/tools/security/chaps/default.nix b/pkgs/tools/security/chaps/default.nix
index 1270423e928..e81567c3ed8 100644
--- a/pkgs/tools/security/chaps/default.nix
+++ b/pkgs/tools/security/chaps/default.nix
@@ -31,8 +31,12 @@ stdenv.mkDerivation rec {
     sha256 = "0chk6pnn365d5kcz6vfqx1d0383ksk97icc0lzg0vvb0kvyj0ff1";
   };
 
-  # readdir_r(3) is deprecated in glibc >= 2.24
-  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
+  NIX_CFLAGS_COMPILE = [
+    # readdir_r(3) is deprecated in glibc >= 2.24
+    "-Wno-error=deprecated-declarations"
+    # gcc8 catching polymorphic type error
+    "-Wno-error=catch-value"
+  ];
 
   patches = [ ./fix_absolute_path.patch  ./fix_environment_variables.patch  ./fix_scons.patch  ./insert_prefetches.patch ];
 
diff --git a/pkgs/tools/system/facter/default.nix b/pkgs/tools/system/facter/default.nix
index 6b84f7d69a5..ee9cdf36129 100644
--- a/pkgs/tools/system/facter/default.nix
+++ b/pkgs/tools/system/facter/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     owner = "puppetlabs";
   };
 
-  CXXFLAGS = "-fpermissive";
+  CXXFLAGS = "-fpermissive -Wno-error=catch-value";
   NIX_LDFLAGS = "-lblkid";
 
   cmakeFlags = [ "-DFACTER_RUBY=${ruby}/lib/libruby.so" ];
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d47121eaf08..05658e24286 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -608,7 +608,7 @@ in
 
   arandr = callPackage ../tools/X11/arandr { };
 
-  inherit (callPackages ../servers/nosql/arangodb { }) arangodb_3_2 arangodb_3_3 arangodb_3_4 arangodb_3_5;
+  inherit (callPackages ../servers/nosql/arangodb { }) arangodb_3_3 arangodb_3_4 arangodb_3_5;
   arangodb = arangodb_3_4;
 
   arcanist = callPackage ../development/tools/misc/arcanist {};
@@ -3825,8 +3825,6 @@ in
 
   highlight = callPackage ../tools/text/highlight ({
     lua = lua5;
-  } // lib.optionalAttrs stdenv.isDarwin {
-    inherit (llvmPackages_38) stdenv;
   });
 
   holochain-go = callPackage ../servers/holochain-go { };
@@ -3914,8 +3912,8 @@ in
   idevicerestore = callPackage ../tools/misc/idevicerestore { };
 
   inherit (callPackages ../tools/filesystems/irods rec {
-            stdenv = llvmPackages_38.libcxxStdenv;
-            libcxx = llvmPackages_38.libcxx;
+            stdenv = llvmPackages.libcxxStdenv;
+            libcxx = llvmPackages.libcxx;
             boost = boost160.override { inherit stdenv; };
             avro-cpp_llvm = avro-cpp.override { inherit stdenv boost; };
           })
@@ -7427,7 +7425,6 @@ in
   clang_5  = llvmPackages_5.clang;
   clang_4  = llvmPackages_4.clang;
   clang_39 = llvmPackages_39.clang;
-  clang_38 = llvmPackages_38.clang;
   clang_35 = wrapCC llvmPackages_35.clang;
 
   clang-tools = callPackage ../development/tools/clang-tools {
@@ -7509,9 +7506,8 @@ in
   gerbil = callPackage ../development/compilers/gerbil { stdenv = gccStdenv; };
   gerbil-unstable = callPackage ../development/compilers/gerbil/unstable.nix { stdenv = gccStdenv; };
 
-  gccFun = callPackage ../development/compilers/gcc/7;
-  # Temporary solution until #40038 is fixed
-  gcc = if stdenv.isDarwin then gcc7 else gcc8;
+  gccFun = callPackage ../development/compilers/gcc/8;
+  gcc = gcc8;
   gcc-unwrapped = gcc.cc;
 
   gccStdenv = if stdenv.cc.isGNU then stdenv else stdenv.override {
@@ -7746,6 +7742,14 @@ in
     profiledCompiler = false;
   });
 
+  gfortran8 = wrapCC (gcc8.cc.override {
+    name = "gfortran";
+    langFortran = true;
+    langCC = false;
+    langC = false;
+    profiledCompiler = false;
+  });
+
   gcj = gcj6;
   gcj6 = wrapCC (gcc6.cc.override {
     name = "gcj";
@@ -8115,7 +8119,6 @@ in
   llvm_5  = llvmPackages_5.llvm;
   llvm_4  = llvmPackages_4.llvm;
   llvm_39 = llvmPackages_39.llvm;
-  llvm_38 = llvmPackages_38.llvm;
   llvm_35 = llvmPackages_35.llvm;
 
   llvmPackages = recurseIntoAttrs llvmPackages_7;
@@ -8126,14 +8129,6 @@ in
     stdenv = gcc6Stdenv;
   });
 
-  llvmPackages_38 = callPackage ../development/compilers/llvm/3.8 ({
-    inherit (stdenvAdapters) overrideCC;
-    buildLlvmTools = buildPackages.llvmPackages_38.tools;
-    targetLlvmLibraries = targetPackages.llvmPackages_38.libraries;
-  } // stdenv.lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) {
-    stdenv = gcc6Stdenv;
-  });
-
   llvmPackages_39 = callPackage ../development/compilers/llvm/3.9 ({
     inherit (stdenvAdapters) overrideCC;
     buildLlvmTools = buildPackages.llvmPackages_39.tools;
diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix
index 37203614744..af3f446cb25 100644
--- a/pkgs/top-level/ocaml-packages.nix
+++ b/pkgs/top-level/ocaml-packages.nix
@@ -57,7 +57,9 @@ let
 
     base64 = callPackage ../development/ocaml-modules/base64 { };
 
-    bap = callPackage ../development/ocaml-modules/bap { };
+    bap = callPackage ../development/ocaml-modules/bap {
+      llvm = pkgs.llvm_8;
+    };
 
     batteries = callPackage ../development/ocaml-modules/batteries { };
 
@@ -395,7 +397,7 @@ let
     linenoise = callPackage ../development/ocaml-modules/linenoise { };
 
     llvm = callPackage ../development/ocaml-modules/llvm {
-      llvm = pkgs.llvm_39;
+      llvm = pkgs.llvm_8;
     };
 
     logs = callPackage ../development/ocaml-modules/logs {