Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 533660 - mail-mta/exim with sys-libs/musl - x86_64-gentoo-linux-musl-gcc -o buildconfig buildconfig.c -lnsl -lcrypt -lm // ld: cannot find -lnsl
Summary: mail-mta/exim with sys-libs/musl - x86_64-gentoo-linux-musl-gcc -o buildcon...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Fabian Groffen
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: musl-porting
  Show dependency tree
 
Reported: 2014-12-27 05:41 UTC by James Taylor
Modified: 2016-09-19 21:46 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (file_533660.txt,3.55 KB, text/plain)
2014-12-27 05:41 UTC, James Taylor
Details
fix_musl_build.patch (file_533660.txt,1.01 KB, patch)
2014-12-27 06:28 UTC, James Taylor
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Taylor 2014-12-27 05:41:07 UTC
Created attachment 392490 [details]
build.log

exim fails to build under musl-libc because there are no checks to disable -lnsl and "HAVE_ICONV=yes" in the template Makefile

Steps to reproduce:
1. Make a system with musl-libc
2. emerge mail-mta/exim

Expected result:
Exim should compile, with the flags patched out

Actual results:
Build fails (see attached build.log)

Reproducible: Always
Comment 1 James Taylor 2014-12-27 06:28:18 UTC
Created attachment 392492 [details, diff]
fix_musl_build.patch
Comment 2 Fabian Groffen gentoo-dev 2014-12-29 09:03:21 UTC
Regarding the -lnsl, that's something necessary for Solaris, so I think some logic/detection is wrong, which I'd love to fix instead of slamming it.
Comment 3 James Taylor 2014-12-29 09:18:14 UTC
Anything that prevents -lnsl being passed when building for sys-libs/musl would be great. I just hacked that patch up without consideration for other platforms, though.
Comment 4 Felix Janda 2014-12-29 12:58:54 UTC
-lnsl is necessary for NIS (but possibly unnecessary when built without
NIS support). I would expect the build to fail horribly on elibc_musl
with USE=nis because of missing RPC headers,... in musl libc.
Comment 5 James Taylor 2014-12-29 13:09:57 UTC
NIS isn't supported anyway, so that point is moot.

http://wiki.musl-libc.org/wiki/Open_Issues#NIS.2FLDAP.2Fother_user_databases
Comment 6 Felix Janda 2014-12-29 14:39:42 UTC
The point is that very likely exim can be fixed (without breaking
anything else) by making it only link with libnsl if NIS (or NIS+) is
enabled.
Comment 7 Anthony Basile gentoo-dev 2015-05-13 17:32:30 UTC
(In reply to Fabian Groffen from comment #2)
> Regarding the -lnsl, that's something necessary for Solaris, so I think some
> logic/detection is wrong, which I'd love to fix instead of slamming it.

I agree this needs better logic before it goes to the main tree.  For the time being I've added it to the overlay so people can use it.  There is a bug upstream but it doesn't look like they're interested.
Comment 8 Fabian Groffen gentoo-dev 2015-05-14 06:01:43 UTC
If you have a somewhat sane patch that you apply conditional for musl, feel free to apply to the main tree (for the time being).  I just haven't had the time (and priority) to come up with something up till now.  My main concern is that it looks like the current patch changes the scenario for existing installs, and I don't really like that.
Comment 9 Anthony Basile gentoo-dev 2016-09-19 21:26:32 UTC
(In reply to Fabian Groffen from comment #8)
> If you have a somewhat sane patch that you apply conditional for musl, feel
> free to apply to the main tree (for the time being).  I just haven't had the
> time (and priority) to come up with something up till now.  My main concern
> is that it looks like the current patch changes the scenario for existing
> installs, and I don't really like that.

Here's a sane patch which I'll commit in a sec as exim-4.87-r1.ebuild.  I don't want to add it directly to exim-4.87.ebuild since the latter is stable, although the patch is totally safe:

--- exim-4.87.ebuild	2016-09-19 16:31:30.915281413 -0400
+++ exim-4.87-r1.ebuild	2016-09-19 17:23:43.263334081 -0400
@@ -25,7 +25,7 @@
 
 SLOT="0"
 LICENSE="GPL-2"
-KEYWORDS="alpha amd64 ~arm hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd ~x86-solaris"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-solaris"
 
 COMMON_DEPEND=">=sys-apps/sed-4.0.5
 	>=sys-libs/db-3.2:=
@@ -128,6 +128,11 @@
 		-e "s:COMPRESS_COMMAND=.*$:COMPRESS_COMMAND=${EPREFIX}/bin/gzip:" \
 		src/EDITME > Local/Makefile
 
+	if use elibc_musl; then
+		sed -e 's/^LIBS = -lnsl/LIBS =/g' \
+		-i OS/Makefile-Linux
+	fi
+
 	cd Local
 
 	cat >> Makefile <<- EOC
@@ -138,7 +143,7 @@
 	EOC
 
 	# if we use libiconv, now is the time to tell so
-	use !elibc_glibc && echo "EXTRALIBS_EXIM=-liconv" >> Makefile
+	use !elibc_glibc && use !elibc_musl && echo "EXTRALIBS_EXIM=-liconv" >> Makefile
 
 	# support for IPv6
 	if use ipv6; then
Comment 10 Anthony Basile gentoo-dev 2016-09-19 21:46:37 UTC
i've tested on both glibc and musl.  we should be good here.