treewide: remove -ldl linker flags

With all libcs I'm aware of, libdl is now either empty (Glibc, musl,
uclibc, illumos), a symlink to libc or equivalent (Apple), or does not
exist (FreeBSD, NetBSD).  So explicitly linking libdl now does nothing
for the former platforms, and breaks the build for the latter
platforms.

With this patch I've removed -ldl from all overridden linker flags for
all free packages in Nixpkgs.  Everything still seems to build.
This commit is contained in:
Alyssa Ross 2023-01-23 15:34:53 +00:00
parent c5c7778f09
commit 12d2821bf5
No known key found for this signature in database
GPG key ID: F9DBED4859B271C0
20 changed files with 18 additions and 24 deletions

View file

@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libjack2 ladspaH gtk2 alsa-lib libxml2 lrdf ];
NIX_LDFLAGS = "-ldl -lm -lpthread";
NIX_LDFLAGS = "-lm -lpthread";
meta = {
description = ''An effects "rack" for the JACK low latency audio API'';

View file

@ -21,8 +21,6 @@ stdenv.mkDerivation rec {
# `l_notebook1'; jamin-callbacks.o:/build/jamin-0.95.0/src/hdeq.h:64: first defined here
NIX_CFLAGS_COMPILE = "-fcommon";
NIX_LDFLAGS = "-ldl";
postInstall = ''
wrapProgram $out/bin/jamin --set LADSPA_PATH ${ladspaPlugins}/lib/ladspa
'';

View file

@ -46,14 +46,14 @@ else stdenv.mkDerivation rec {
-L${llvmPackages_13.clang.libc}/lib \
-Wl,-install_name,$libName \
-Wall -std=c99 -O3 -fPIC libredirect.c \
-ldl -shared -o "$libName"
-shared -o "$libName"
'' else if stdenv.isDarwin then ''
$CC -Wall -std=c99 -O3 -fPIC libredirect.c \
-Wl,-install_name,$out/lib/$libName \
-ldl -shared -o "$libName"
-shared -o "$libName"
'' else ''
$CC -Wall -std=c99 -O3 -fPIC libredirect.c \
-ldl -shared -o "$libName"
-shared -o "$libName"
''}
if [ -n "$doInstallCheck" ]; then

View file

@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
wrapGAppsHook
];
buildInputs = [ libxml2 gtk shared-mime-info libSM ];
NIX_LDFLAGS = "-ldl -lm";
NIX_LDFLAGS = "-lm";
patches = [
./rox-filer-2.11-in-source-build.patch

View file

@ -181,7 +181,7 @@ stdenv.mkDerivation ({
depsTargetTarget = optional (!crossStageStatic && threadsCross != {} && threadsCross.package != null) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
preConfigure = (import ../common/pre-configure.nix {
inherit lib;

View file

@ -185,7 +185,7 @@ stdenv.mkDerivation ({
depsTargetTarget = optional (!crossStageStatic && threadsCross != {} && threadsCross.package != null) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
preConfigure = (import ../common/pre-configure.nix {
inherit lib;

View file

@ -228,7 +228,7 @@ stdenv.mkDerivation ({
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
preConfigure = (import ../common/pre-configure.nix {

View file

@ -219,7 +219,7 @@ stdenv.mkDerivation ({
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
preConfigure = import ../common/pre-configure.nix {
inherit lib;

View file

@ -187,7 +187,7 @@ stdenv.mkDerivation ({
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package;
NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument";
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
preConfigure = import ../common/pre-configure.nix {
inherit lib;

View file

@ -169,7 +169,7 @@ stdenv.mkDerivation ({
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
preConfigure = import ../common/pre-configure.nix {
inherit lib;

View file

@ -182,7 +182,7 @@ stdenv.mkDerivation ({
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
preConfigure = import ../common/pre-configure.nix {
inherit lib;

View file

@ -38,7 +38,6 @@ stdenv.mkDerivation rec {
"-L${variables.libdir}"
"-Wl,--rpath ${variables.libdir}"
"-ltcc"
"-ldl"
];
variables = rec {
prefix = "${placeholder "out"}";

View file

@ -21,7 +21,6 @@ stdenv.mkDerivation rec {
'';
NIX_CFLAGS_COMPILE = "-fpermissive";
NIX_LDFLAGS = "-ldl";
meta = {
homepage = "http://www.bergo.eng.br/eboard/";

View file

@ -64,8 +64,8 @@ stdenv.mkDerivation rec {
${lib.optionalString enableMySQL ''
s:^# \(LOOKUP_MYSQL=yes\)$:\1:
s:^# \(LOOKUP_MYSQL_PC=libmysqlclient\)$:\1:
s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lmysqlclient -L${libmysqlclient}/lib/mysql -lssl -ldl -lm -lpthread -lz:
s:^# \(LOOKUP_LIBS\)=.*:\1=-lmysqlclient -L${libmysqlclient}/lib/mysql -lssl -ldl -lm -lpthread -lz:
s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lmysqlclient -L${libmysqlclient}/lib/mysql -lssl -lm -lpthread -lz:
s:^# \(LOOKUP_LIBS\)=.*:\1=-lmysqlclient -L${libmysqlclient}/lib/mysql -lssl -lm -lpthread -lz:
s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${libmysqlclient.dev}/include/mysql/:
''}
${lib.optionalString enableAuthDovecot ''

View file

@ -15,7 +15,6 @@ stdenv.mkDerivation rec {
configureFlags = [ "--localstatedir=/var/lib/nagios" ];
buildFlags = [ "all" ];
CFLAGS = "-ldl";
# Do not create /var directories
preInstall = ''

View file

@ -33,7 +33,7 @@ let
Version: ${libflux_version}
Description: Library for the InfluxData Flux engine
Cflags: -I/out/include
Libs: -L/out/lib -lflux -ldl -lpthread
Libs: -L/out/lib -lflux -lpthread
'';
passAsFile = [ "pkgcfg" ];
postInstall = ''

View file

@ -51,7 +51,7 @@ let
Version: ${libflux_version}
Description: Library for the InfluxData Flux engine
Cflags: -I/out/include
Libs: -L/out/lib -lflux -ldl -lpthread
Libs: -L/out/lib -lflux -lpthread
'';
passAsFile = [ "pkgcfg" ];
postInstall = ''

View file

@ -89,7 +89,6 @@ stdenv.mkDerivation {
)
'' + optionalString withTsm ''
export XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I${tsm-client}/lib64/sample -DXBSA_TSMLIB=\\\"${tsm-client}/lib64/libApiTSM64.so\\\""
export XBSA_XLIBS="-ldl"
'';
buildFlags = [ "all_nolibafs" ];

View file

@ -85,7 +85,7 @@ stdenv.mkDerivation rec {
LINKFLAGS +=
${lib.concatStringsSep " " (map (x: "-L${x}/lib") buildInputs)}
-ldl -lrt -lX11 -lXext -lXxf86vm -lXinerama -lXrandr -lXau -lXdmcp -lXss
-lrt -lX11 -lXext -lXxf86vm -lXinerama -lXrandr -lXau -lXdmcp -lXss
-ljpeg -ltiff -lpng -lssl ;
'';
in ''

View file

@ -60,7 +60,7 @@ in gcc9Stdenv.mkDerivation rec {
nativeBuildInputs = [ autoreconfHook rpcsvc-proto ];
buildInputs = [ glib pcap libtirpc libnsl ];
NIX_CFLAGS_LINK = "-lglib-2.0 -lpthread -ldl -ltirpc";
NIX_CFLAGS_LINK = "-lglib-2.0 -lpthread -ltirpc";
NIX_CFLAGS_COMPILE = [ "-I${libtirpc.dev}/include/tirpc" ];
postPatch = ''
for patch in debian/patches/*.patch; do