NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.1k stars 14.14k forks source link

cyrus-sasl doesnt cross compile #50539

Closed eburimu closed 5 years ago

eburimu commented 5 years ago

Issue description

cyrus sasl doesnt cross compile on build x86_64-linux, host armv6l-linux.

  9983 make  all-recursive
  9984 make[1]: Entering directory '/home/void/pi/cyrus-sasl-2.1.26'
  9985 Making all in include
  9986 make[2]: Entering directory '/home/void/pi/cyrus-sasl-2.1.26/include'
  9987 armv6l-unknown-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I. -I..   -DOBSOLETE_CRAM_ATTR\
       =1  -Wall -W -g -O2 -MT makemd5.o -MD -MP -MF .deps/makemd5.Tpo -c -o makemd5.o ma\
       kemd5.c
  9988 mv -f .deps/makemd5.Tpo .deps/makemd5.Po
  9989 /nix/store/r47p5pzx52m3n34vdgqpk5rvqgm0m24m-bash-4.4-p23/bin/bash ../libtool   --m\
       ode=link armv6l-unknown-linux-gnueabihf-gcc  -Wall -W -g -O2   -o makemd5 makemd5.\
       o  -lresolv
  9990 mkdir .libs
  9991 armv6l-unknown-linux-gnueabihf-gcc -Wall -W -g -O2 -o makemd5 makemd5.o -lresolv
  9992 rm -f md5global.h
  9993 ./makemd5 md5global.h
  9994 /nix/store/r47p5pzx52m3n34vdgqpk5rvqgm0m24m-bash-4.4-p23/bin/bash: ./makemd5: cann\
       ot execute binary file: Exec format error
  9995 make[2]: *** [Makefile:649: md5global.h] Error 126
  9996 make[2]: Leaving directory '/home/void/pi/cyrus-sasl-2.1.26/include'
  9997 make[1]: *** [Makefile:457: all-recursive] Error 1
  9998 make[1]: Leaving directory '/home/void/pi/cyrus-sasl-2.1.26'
  9999 make: *** [Makefile:364: all] Error 2

Steps to reproduce

nix-shell -E 'let pkgs = import <nixpkgs> { crossSystem = { system = "armv6l-linux"; }; }; in pkgs.stdenv.mkDerviation { name = "foo"; }' unzip cyrus-sasl-2.1.26, then, configure $configureFlags && make -j8

Technical details

The following link has a patch to solve makemd5 problem.

http://buildroot-busybox.2317881.n4.nabble.com/Cross-compiling-Cyrus-in-Buildroot-td1281.html

  9992  - system: `"x86_64-linux"`
  9993  - host os: `Linux 4.14.79, NixOS, 19.03pre159472.80738ed9dc0 (Koi)`
  9994  - multi-user?: `yes`
  9995  - sandbox: `yes`
  9996  - version: `nix-env (Nix) 2.1.3`
  9997  - channels(root): `"nixos-19.03pre159472.80738ed9dc0"`
  9998  - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
eburimu commented 5 years ago

The following fixes the makemd5 problem yet still has got other problems even after ./configure $configureFlags --with-saslauthd=no

cyrus-sasl-makemd5-fix.patch.gz

This patch tries to fix Makefile.am but autoreconf -ivf fails miserably (bitrot?). Maybe its better to fix Makefile.in directly also.

dtzWill commented 5 years ago

Was looking into this and noticed they made a new release (finally!), maybe it fixes your issue: #50546 .

And yes the autoconf/libtool bits in the last release (2.1.26) were very broken, this should be fixed now!

eburimu commented 5 years ago

Hello dtzWill,

Thnx for the update. Current situation is below.

 9947 [void@fermat:~/pi]$ nix-build -I nixpkgs=~/nixpkgs -E 'let t1 = import <nixpkgs> {}; in let pkgs = import <nixpkgs> { crossSystem = t1.lib.systems.examples.raspberryPi // { system = "armv6l-linux"; }; }; in pkgs.cyrus_sasl'
  9948 these derivations will be built:
  9949   /nix/store/lbvizl12gl6vglgaqmkkz9qkjq906p3s-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf.drv
  9950 building '/nix/store/lbvizl12gl6vglgaqmkkz9qkjq906p3s-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf.drv'...
  9951 unpacking sources
  9952 unpacking source archive /nix/store/3xfzqpybl544nfrahq1xzp77nd1hfk5p-cyrus-sasl-2.1.27.tar.gz
  9953 source root is cyrus-sasl-2.1.27
  9954 setting SOURCE_DATE_EPOCH to timestamp 1541700275 of file cyrus-sasl-2.1.27/man/sasl_verifyfile_t.3
  9955 patching sources
  9956 applying patch /nix/store/s88ghhri7aq8g4r2p955n71zsiwfmm8h-missing-size_t.patch
  9957 patching file include/sasl.h
  9958 Hunk #1 succeeded at 123 with fuzz 2 (offset 2 lines).
  9959 updateAutotoolsGnuConfigScriptsPhase
  9960 Updating Autotools / GNU config script to a newer upstream version: ./config/config.sub
  9961 Updating Autotools / GNU config script to a newer upstream version: ./config/config.guess
  9962 configuring
  9963 fixing libtool script ./config/ltmain.sh
  9964 configure flags: --disable-static --disable-dependency-tracking --prefix=/nix/store/a1q72z4w261frxhqpii694mqrnrg909l-cyrus-sasl-2.1.27-armv6\
       l-unknown-linux-gnueabihf --bindir=/nix/store/f5a2bnbi8523r3k2i89n2zfixs39xs51-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf-bin/bin --sb\
       indir=/nix/store/f5a2bnbi8523r3k2i89n2zfixs39xs51-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf-bin/sbin --includedir=/nix/store/dcfy8vs2\
       h05ilg7cfrmqhq89vjjs3xbq-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf-dev/include --oldincludedir=/nix/store/dcfy8vs2h05ilg7cfrmqhq89vjj\
       s3xbq-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf-dev/include --mandir=/nix/store/0cparb0n9syyj4q7drmhh0r0mx8nsn3c-cyrus-sasl-2.1.27-ar\
       mv6l-unknown-linux-gnueabihf-man/share/man --infodir=/nix/store/f5a2bnbi8523r3k2i89n2zfixs39xs51-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnue\
       abihf-bin/share/info --docdir=/nix/store/a1q72z4w261frxhqpii694mqrnrg909l-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf/share/doc/cyrus-sasl --libdir=/nix/store/a1q72z4w261frxhqpii694mqrnrg909l-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf/lib --libexecdir=/nix/store/a1q72z4w261frxhqpii694mqrnrg909l-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf/libexec --localedir=/nix/store/a1q72z4w261frxhqpii694mqrnrg909l-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf/share/locale --with-openssl=/nix/store/m55x5c3hgk9x2rsv7bvkaz7r6rz3df1j-openssl-1.0.2p-armv6l-unknown-linux-gnueabihf-dev --with-plugindir=/nix/store/a1q72z4w261frxhqpii694mqrnrg909l-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf/lib/sasl2 --with-saslauthd=/run/saslauthd --enable-login --enable-shared --build=x86_64-unknown-linux-gnu --host=armv6l-unknown-linux-gnuea\
       bihf
  9965 configure: creating cache ./config.cache
  9966 checking build system type... x86_64-unknown-linux-gnu
  9967 checking host system type... armv6l-unknown-linux-gnueabihf
  9968 checking target system type... armv6l-unknown-linux-gnueabihf
  9969 checking for a BSD-compatible install... /nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin/install -c
  9970 checking whether build environment is sane... yes
  9971 checking for armv6l-unknown-linux-gnueabihf-strip... armv6l-unknown-linux-gnueabihf-strip
  9972 checking for a thread-safe mkdir -p... /nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin/mkdir -p
  9973 checking for gawk... gawk
  9974 checking whether make sets $(MAKE)... yes
  9975 checking whether make supports nested variables... yes
  9976 checking whether UID '1000' is supported by ustar format... yes
  9977 checking whether GID '100' is supported by ustar format... yes
  9978 checking how to create a ustar tar archive... gnutar
  9979 checking for armv6l-unknown-linux-gnueabihf-gcc... armv6l-unknown-linux-gnueabihf-gcc
  9980 checking whether the C compiler works... yes
  9981 checking for C compiler default output file name... a.out
  9982 checking for suffix of executables...
  9983 checking whether we are cross compiling... yes
  9984 checking for suffix of object files... o
  9985 checking whether we are using the GNU C compiler... yes
  9986 checking whether armv6l-unknown-linux-gnueabihf-gcc accepts -g... yes
  9987 checking for armv6l-unknown-linux-gnueabihf-gcc option to accept ISO C89... none needed
  9988 checking whether armv6l-unknown-linux-gnueabihf-gcc understands -c and -o together... yes
  9989 checking for style of include used by make... GNU
  9990 checking dependency style of armv6l-unknown-linux-gnueabihf-gcc... none
  9991 checking how to run the C preprocessor... armv6l-unknown-linux-gnueabihf-gcc -E
  9992 checking for gcc... no
  9993 checking for cc... no
  9994 checking for cl.exe... no
  9995 configure: error: in `/build/cyrus-sasl-2.1.27':
  9996 configure: error: no acceptable C compiler found in $PATH
  9997 See `config.log' for more details
  9998 builder for '/nix/store/lbvizl12gl6vglgaqmkkz9qkjq906p3s-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf.drv' failed with exit code 1
  9999 error: build of '/nix/store/lbvizl12gl6vglgaqmkkz9qkjq906p3s-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf.drv' failed
 10000 

nixpkgs is at commit 9b9552346954e91cfbe2aeb1650c7fcb69758491 origin/master by the time. I've replaced the old derivation w/ your new cyrus-sasl v2.1.27 and I get the above.

Apparently, ./configure needs both build and host cc. I emulate this behaviour in the following shell:

  9993 let pkgs = import <nixpkgs> { crossSystem = { system = "armv6l-linux"; }; };
  9994     p = import <nixpkgs> {};
  9995     in pkgs.stdenv.mkDerivation {
  9996         name = "foo";
  9997         nativeBuildInputs = [p.autoconf p.automake p.libtool p.m4 p.gcc p.pkgconfig];
  9998         buildInputs = [pkgs.openssl];
  9999     }
 10000 

This works just fine. I am looking for info how to modify the derivation definition so that build stdenv has both cc's.

best.

eburimu commented 5 years ago

See this for build cc solution, thanks to @bennofs at #nixos

https://nixos.org/nixpkgs/manual/#cross-qa-build-c-program-in-build-environment

eburimu commented 5 years ago

Hello @dtzWill,

Addding depsBuildBuild = [ buildPackages.stdenv.cc ]; leads to the following:

Any ideas?


[void@fermat:~/pi]$ nix-build -I nixpkgs=~/nixpkgs -E 'let t1 = import <nixpkgs> {}; in let pkgs = import <nixpkgs> { crossSystem = t1.lib.systems.examples.raspberryPi // { system = "armv6l-linux"; }; }; in pkgs.cyrus_sasl'
these derivations will be built:
  /nix/store/3dryxjp3jcc8m0xr15xkcqq9m0f2yq6y-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf.drv
building '/nix/store/3dryxjp3jcc8m0xr15xkcqq9m0f2yq6y-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf.drv'...
unpacking sources
unpacking source archive /nix/store/3xfzqpybl544nfrahq1xzp77nd1hfk5p-cyrus-sasl-2.1.27.tar.gz
source root is cyrus-sasl-2.1.27
setting SOURCE_DATE_EPOCH to timestamp 1541700275 of file cyrus-sasl-2.1.27/man/sasl_verifyfile_t.3
patching sources
applying patch /nix/store/s88ghhri7aq8g4r2p955n71zsiwfmm8h-missing-size_t.patch
patching file include/sasl.h
Hunk #1 succeeded at 123 with fuzz 2 (offset 2 lines).
updateAutotoolsGnuConfigScriptsPhase
Updating Autotools / GNU config script to a newer upstream version: ./config/config.sub
Updating Autotools / GNU config script to a newer upstream version: ./config/config.guess
configuring
fixing libtool script ./config/ltmain.sh
configure flags: --disable-static --disable-dependency-tracking --prefix=/nix/store/1a8pgrw0lkqj0ssdz6d75wnkql4b34yf-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf --bindir=/nix/store/fxal38m4gm1pxg7q3jdmfr6fxvbalyd6-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf-bin/bin --sbindir=/nix/store/fxal38m4gm1pxg7q3jdmfr6fxvbalyd6-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf-bin/sbin --includedir=/nix/store/g53spwmgvh237kg7y8065yqgmfmjvcn5-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf-dev/include --oldincludedir=/nix/store/g53spwmgvh237kg7y8065yqgmfmjvcn5-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf-dev/include --mandir=/nix/store/yr0a8pyymnih535y08d2fk49s08h1dgl-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf-man/share/man --infodir=/nix/store/fxal38m4gm1pxg7q3jdmfr6fxvbalyd6-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf-bin/share/info --docdir=/nix/store/1a8pgrw0lkqj0ssdz6d75wnkql4b34yf-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf/share/doc/cyrus-sasl --libdir=/nix/store/1a8pgrw0lkqj0ssdz6d75wnkql4b34yf-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf/lib --libexecdir=/nix/store/1a8pgrw0lkqj0ssdz6d75wnkql4b34yf-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf/libexec --localedir=/nix/store/1a8pgrw0lkqj0ssdz6d75wnkql4b34yf-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf/share/locale --with-openssl=/nix/store/m55x5c3hgk9x2rsv7bvkaz7r6rz3df1j-openssl-1.0.2p-armv6l-unknown-linux-gnueabihf-dev --with-plugindir=/nix/store/1a8pgrw0lkqj0ssdz6d75wnkql4b34yf-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf/lib/sasl2 --with-saslauthd=/run/saslauthd --enable-login --enable-shared --build=x86_64-unknown-linux-gnu --host=armv6l-unknown-linux-gnueabihf
configure: creating cache ./config.cache
checking build system type... x86_64-unknown-linux-gnu
checking host system type... armv6l-unknown-linux-gnueabihf
checking target system type... armv6l-unknown-linux-gnueabihf
checking for a BSD-compatible install... /nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin/install -c
checking whether build environment is sane... yes
checking for armv6l-unknown-linux-gnueabihf-strip... armv6l-unknown-linux-gnueabihf-strip
checking for a thread-safe mkdir -p... /nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '1000' is supported by ustar format... yes
checking whether GID '100' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking for armv6l-unknown-linux-gnueabihf-gcc... armv6l-unknown-linux-gnueabihf-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether armv6l-unknown-linux-gnueabihf-gcc accepts -g... yes
checking for armv6l-unknown-linux-gnueabihf-gcc option to accept ISO C89... none needed
checking whether armv6l-unknown-linux-gnueabihf-gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of armv6l-unknown-linux-gnueabihf-gcc... none
checking how to run the C preprocessor... armv6l-unknown-linux-gnueabihf-gcc -E
checking for gcc... gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) none
checking how to run the C preprocessor... gcc -E
checking how to run the C preprocessor... armv6l-unknown-linux-gnueabihf-gcc -E
checking for gawk... (cached) gawk
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for grep that handles long lines and -e... /nix/store/a7pnidn0y95axmhhkpm3vh7ws54qa324-gnugrep-3.1/bin/grep
checking for egrep... /nix/store/a7pnidn0y95axmhhkpm3vh7ws54qa324-gnugrep-3.1/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for runpath switch... -R
checking how to print strings... printf
checking for a sed that does not truncate output... /nix/store/zj5pg6bcab6b5wllj87bmws432gh4sm6-gnused-4.5/bin/sed
checking for fgrep... /nix/store/a7pnidn0y95axmhhkpm3vh7ws54qa324-gnugrep-3.1/bin/grep -F
checking for ld used by armv6l-unknown-linux-gnueabihf-gcc... armv6l-unknown-linux-gnueabihf-ld
checking if the linker (armv6l-unknown-linux-gnueabihf-ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... armv6l-unknown-linux-gnueabihf-nm
checking the name lister (armv6l-unknown-linux-gnueabihf-nm) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-unknown-linux-gnu file names to armv6l-unknown-linux-gnueabihf format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for armv6l-unknown-linux-gnueabihf-ld option to reload object files... -r
checking for armv6l-unknown-linux-gnueabihf-objdump... armv6l-unknown-linux-gnueabihf-objdump
checking how to recognize dependent libraries... pass_all
checking for armv6l-unknown-linux-gnueabihf-dlltool... armv6l-unknown-linux-gnueabihf-dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for armv6l-unknown-linux-gnueabihf-ar... armv6l-unknown-linux-gnueabihf-ar
checking for archiver @FILE support... @
checking for armv6l-unknown-linux-gnueabihf-strip... (cached) armv6l-unknown-linux-gnueabihf-strip
checking for armv6l-unknown-linux-gnueabihf-ranlib... armv6l-unknown-linux-gnueabihf-ranlib
checking command to parse armv6l-unknown-linux-gnueabihf-nm output from armv6l-unknown-linux-gnueabihf-gcc object... ok
checking for sysroot... no
checking for a working dd... /nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin/dd
checking how to truncate binary pipes... /nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin/dd bs=4096 count=1
checking for armv6l-unknown-linux-gnueabihf-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if armv6l-unknown-linux-gnueabihf-gcc supports -fno-rtti -fno-exceptions... no
checking for armv6l-unknown-linux-gnueabihf-gcc option to produce PIC... -fPIC -DPIC
checking if armv6l-unknown-linux-gnueabihf-gcc PIC flag -fPIC -DPIC works... yes
checking if armv6l-unknown-linux-gnueabihf-gcc static flag -static works... no
checking if armv6l-unknown-linux-gnueabihf-gcc supports -c -o file.o... yes
checking if armv6l-unknown-linux-gnueabihf-gcc supports -c -o file.o... (cached) yes
checking whether the armv6l-unknown-linux-gnueabihf-gcc linker (armv6l-unknown-linux-gnueabihf-ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking ws2tcpip.h usability... no
checking ws2tcpip.h presence... no
checking for ws2tcpip.h... no
checking for socket... yes
checking for connect... yes
checking for res_search... no
checking for dn_expand... no
checking for dns_lookup... no
checking DB path to use... /etc/sasldb2
checking db.h usability... yes
checking db.h presence... yes
checking for db.h... yes
checking DB library to use... berkeley
checking if DB handle is kept open in SASLDB... no
checking for dlopen in -ldl... yes
checking PRNG to use... /dev/urandom
checking for nm... armv6l-unknown-linux-gnueabihf-nm
checking for underscore before symbols... no
checking for syslog... yes
checking if I should include saslauthd... /run/saslauthd
checking to include Courier authdaemond support... /dev/null
checking if I should include pwcheck... no
checking if I should include the alwaystrue verifier... no
checking if we should enable sasl_checkapop... enabled
checking CRAM-MD5... enabled
checking size of long... 4
checking what directory libraries are found in... lib
checking for RSAPublicEncrypt in -lrsaref... no
checking openssl/evp.h usability... yes
checking openssl/evp.h presence... yes
checking for openssl/evp.h... yes
checking for EVP_DigestInit in -lcrypto... yes
checking for SHA256 in -lcrypto... yes
checking for OpenSSL... yes
checking for des_cbc_encrypt in -lcrypto... no
checking for DES_cbc_encrypt in -lcrypto... yes
checking openssl/des.h usability... yes
checking openssl/des.h presence... yes
checking for openssl/des.h... yes
checking DIGEST-MD5... enabled
checking SCRAM... enabled
checking OTP... enabled
checking for opiechallenge in -lopie... no
checking for OPIE... no
checking SRP... disabled
checking KERBEROS_V4... disabled
checking for crypt... no
checking for crypt in -lcrypt... yes
checking gssapi.h usability... yes
checking gssapi.h presence... yes
checking for gssapi.h... yes
checking gssapi/gssapi_ext.h usability... yes
checking gssapi/gssapi_ext.h presence... yes
checking for gssapi/gssapi_ext.h... yes
checking for res_search in -lresolv... no
checking for gss_unwrap in -lgssapi... no
checking for gss_unwrap in -lgssapi_krb5... yes
checking GSSAPI... with implementation mit
checking for res_search in -lresolv... (cached) no
checking for gsskrb5_register_acceptor_identity... no
checking gssapi/gssapi_krb5.h usability... yes
checking gssapi/gssapi_krb5.h presence... yes
checking for gssapi/gssapi_krb5.h... yes
checking whether gsskrb5_register_acceptor_identity is declared... yes
checking for gss_decapsulate_token... yes
checking for gss_encapsulate_token... yes
checking for gss_oid_equal... yes
checking for gss_get_name_attribute... yes
checking for gss_inquire_sec_context_by_oid... yes
checking for SPNEGO support in GSSAPI libraries... configure: error: in `/build/cyrus-sasl-2.1.27':
configure: error: cannot run test program while cross compiling
See `config.log' for more details
builder for '/nix/store/3dryxjp3jcc8m0xr15xkcqq9m0f2yq6y-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf.drv' failed with exit code 1
error: build of '/nix/store/3dryxjp3jcc8m0xr15xkcqq9m0f2yq6y-cyrus-sasl-2.1.27-armv6l-unknown-linux-gnueabihf.drv' failed```
eburimu commented 5 years ago

OK, finally fixd it.

$ cat cyrus-sasl-ac-try-run-fix.patch 
--- a/m4/sasl2.m4   2018-11-18 22:33:29.902625600 +0300
+++ b/m4/sasl2.m4   2018-11-18 22:33:59.828746176 +0300
@@ -339,7 +339,8 @@
 ], 
    [ AC_DEFINE(HAVE_GSS_SPNEGO,,[Define if your GSSAPI implementation supports SPNEGO])
    AC_MSG_RESULT(yes) ],
-   AC_MSG_RESULT(no))
+   AC_MSG_RESULT(no),
+    AC_MSG_RESULT(no))
   LIBS="$cmu_save_LIBS"

 else
$ cat default.nix 
{ lib, stdenv, fetchurl, openssl, openldap, kerberos, db, gettext,
  pam, fixDarwinDylibNames, autoreconfHook, fetchpatch, enableLdap ? false,
  buildPackages, autoconf, automake, libtool }:

with stdenv.lib;
stdenv.mkDerivation rec {
  name = "cyrus-sasl-${version}${optionalString (kerberos == null) "-without-kerberos"}";
  version = "2.1.27";

  src = fetchurl {
    url = "ftp://ftp.cyrusimap.org/cyrus-sasl/${name}.tar.gz";
    sha256 = "1m85zcpgfdhm43cavpdkhb1s2zq1b31472hq1w1gs3xh94anp1i6";
  };

  outputs = [ "bin" "dev" "out" "man" "devdoc" ];
  depsBuildBuild = [ buildPackages.stdenv.cc ];
  #doCheck = true; # false; # stdenv.hostPlatform != stdenv.buildPlatform;

  nativeBuildInputs = [ stdenv.cc autoconf automake libtool ];
  buildInputs =
    [ openssl db gettext kerberos ]
    ++ lib.optional enableLdap openldap
    # ++ lib.optional stdenv.isFreeBSD autoreconfHook
    ++ [autoreconfHook]
    ++ lib.optional stdenv.isLinux pam
    ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;

  patches = [
    ./missing-size_t.patch # https://bugzilla.redhat.com/show_bug.cgi?id=906519
    ./cyrus-sasl-ac-try-run-fix.patch
  ] ++ lib.optional stdenv.isFreeBSD (
      fetchurl {
        url = "http://www.linuxfromscratch.org/patches/blfs/svn/cyrus-sasl-2.1.26-fixes-3.patch";
        sha256 = "1vh4pc2rxxm6yvykx0b7kg09jbcwcxwv5rs6yq2ag3y8p6a9x86w";
      }
    );

  configureFlags = [
    "--with-openssl=${openssl.dev}"
    "--with-plugindir=${placeholder "out"}/lib/sasl2"
    "--with-saslauthd=/run/saslauthd"
    "--enable-login"
    "--enable-shared"
  ] ++ lib.optional enableLdap "--with-ldap=${openldap.dev}";

  installFlags = lib.optional stdenv.isDarwin [ "framedir=$(out)/Library/Frameworks/SASL2.framework" ];

  postInstall = ''
    for f in $out/lib/*.la $out/lib/sasl2/*.la; do
      substituteInPlace $f --replace "${openssl.dev}/lib" "${openssl.out}/lib"
    done
  '';

  meta = {
    homepage = https://www.cyrusimap.org/sasl;
    description = "Library for adding authentication support to connection-based protocols";
    platforms = platforms.unix;
    license = licenses.bsdOriginal;
  };
}

Please close after merging the above if you'd like it.

best.

dtzWill commented 5 years ago

Should that fix be sent upstream?

Also, this seems to have been encountered a few times before?

http://lists.openembedded.org/pipermail/openembedded-devel/2013-June/091228.html

But I like your fix, although don't offhand recognize what it fixes -- presumably corrects the try run macro used...? Anyway if you can explain and especially if you send upstream, this is probably great. Regardless glad it's working for you!

eburimu commented 5 years ago

Hello @dtzWill,

The idea is basically to provide a default value when you are cross compiling. Its actually in the docs. See the last parameter of AC_TRY_RUN at https://web.mit.edu/gnu/doc/html/autoconf_5.html#SEC44

Prob, they thought nobody is going to cross compile so did not bother to add a cross default value.

Im working on the next bug in the cross compile chain, (libksba). I'll talk to cyrus guys if I get free time. Meanwhile, I'll be glad if you can make this into the nixpkgs stream.

best.

matthewbauer commented 5 years ago

Feel free to open a PR! I think we can avoid a mass rebuild if we make it conditional