Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libksba doesn't cross compile #50629

Closed
eburimu opened this issue Nov 18, 2018 · 3 comments
Closed

libksba doesn't cross compile #50629

eburimu opened this issue Nov 18, 2018 · 3 comments

Comments

@eburimu
Copy link
Contributor

eburimu commented Nov 18, 2018

Issue description

[void@fermat:~/pi]$ sh ./libksba.sh
these derivations will be built:
  /nix/store/g3n5dybgakx8c18vwhwd8lwzflfvq78c-libksba-1.3.5-armv6l-unknown-linux-gnueabihf.drv
building '/nix/store/g3n5dybgakx8c18vwhwd8lwzflfvq78c-libksba-1.3.5-armv6l-unknown-linux-gnueabihf.drv'...
unpacking sources
unpacking source archive /nix/store/5d9x7xpljfsrhv0c4f5my8yyrsc9swyc-libksba-1.3.5.tar.bz2
source root is libksba-1.3.5
setting SOURCE_DATE_EPOCH to timestamp 1471859846 of file libksba-1.3.5/ChangeLog
patching sources
updateAutotoolsGnuConfigScriptsPhase
Updating Autotools / GNU config script to a newer upstream version: ./build-aux/config.sub
Updating Autotools / GNU config script to a newer upstream version: ./build-aux/config.guess
configuring
fixing libtool script ./build-aux/ltmain.sh
configure flags: --disable-static --disable-dependency-tracking --prefix=/nix/store/r6mxl1mn9fj88dwgvvip5dds7hz4pxnl-libksba-1.3.5-armv6l-unknown-linux-gnueabihf --bindir=/nix/store/r6mxl1mn9fj88dwgvvip5dds7hz4pxnl-libksba-1.3.5-armv6l-unknown-linux-gnueabihf/bin --sbindir=/nix/store/r6mxl1mn9fj88dwgvvip5dds7hz4pxnl-libksba-1.3.5-armv6l-unknown-linux-gnueabihf/sbin --includedir=/nix/store/z9jhab586z4sh8fpl7krl6b6g1c3qvvj-libksba-1.3.5-armv6l-unknown-linux-gnueabihf-dev/include --oldincludedir=/nix/store/z9jhab586z4sh8fpl7krl6b6g1c3qvvj-libksba-1.3.5-armv6l-unknown-linux-gnueabihf-dev/include --mandir=/nix/store/r6mxl1mn9fj88dwgvvip5dds7hz4pxnl-libksba-1.3.5-armv6l-unknown-linux-gnueabihf/share/man --infodir=/nix/store/l1yfg5iif0rpfriwpn97v3gmmxz4qvi9-libksba-1.3.5-armv6l-unknown-linux-gnueabihf-info/share/info --docdir=/nix/store/r6mxl1mn9fj88dwgvvip5dds7hz4pxnl-libksba-1.3.5-armv6l-unknown-linux-gnueabihf/share/doc/libksba --libdir=/nix/store/r6mxl1mn9fj88dwgvvip5dds7hz4pxnl-libksba-1.3.5-armv6l-unknown-linux-gnueabihf/lib --libexecdir=/nix/store/r6mxl1mn9fj88dwgvvip5dds7hz4pxnl-libksba-1.3.5-armv6l-unknown-linux-gnueabihf/libexec --localedir=/nix/store/r6mxl1mn9fj88dwgvvip5dds7hz4pxnl-libksba-1.3.5-armv6l-unknown-linux-gnueabihf/share/locale --build=x86_64-unknown-linux-gnu --host=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 build system type... x86_64-unknown-linux-gnu
checking host system type... armv6l-unknown-linux-gnueabihf
configure: autobuild project... libksba
configure: autobuild revision... 1.3.5
./configure: line 3220: hostname: command not found
configure: autobuild timestamp... 20181118-211346
checking for style of include used by make... GNU
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 dependency style of armv6l-unknown-linux-gnueabihf-gcc... none
checking how to run the C preprocessor... armv6l-unknown-linux-gnueabihf-gcc -E
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 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 whether ln -s works... yes
checking the maximum length of command line arguments... 32768
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
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 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 for armv6l-unknown-linux-gnueabihf-windres... armv6l-unknown-linux-gnueabihf-windres
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... (cached) yes
checking for gawk... (cached) gawk
checking for armv6l-unknown-linux-gnueabihf-gcc... (cached) armv6l-unknown-linux-gnueabihf-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether armv6l-unknown-linux-gnueabihf-gcc accepts -g... (cached) yes
checking for armv6l-unknown-linux-gnueabihf-gcc option to accept ISO C89... (cached) none needed
checking whether armv6l-unknown-linux-gnueabihf-gcc understands -c and -o together... (cached) yes
checking dependency style of armv6l-unknown-linux-gnueabihf-gcc... (cached) none
checking how to run the C preprocessor... armv6l-unknown-linux-gnueabihf-gcc -E
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for bison... no
checking for byacc... no
checking for inline... inline
checking for cc for build... cc
checking if gcc supports -Wpointer-arith... yes
checking if gcc supports -Wno-pointer-sign... yes
checking whether the visibility attribute is supported... yes
checking for broken visibility attribute... no
checking for broken alias attribute... no
checking if gcc supports -fvisibility=hidden... yes
checking for gpg-error-config... no
checking for GPG Error - version >= 1.8... no
configure: error: libgpg-error is needed.
                See ftp://ftp.gnupg.org/gcrypt/libgpg-error/ .
builder for '/nix/store/g3n5dybgakx8c18vwhwd8lwzflfvq78c-libksba-1.3.5-armv6l-unknown-linux-gnueabihf.drv' failed with exit code 1
error: build of '/nix/store/g3n5dybgakx8c18vwhwd8lwzflfvq78c-libksba-1.3.5-armv6l-unknown-linux-gnueabihf.drv' failed

Steps to reproduce

[void@fermat:~/pi]$ cat libksba.sh
#!/bin/sh
nix-build -I nixpkgs=/home/void/nixpkgs -E 'let t1 = import <nixpkgs> {}; in let pkgs = import <nixpkgs> { crossSystem = t1.lib.systems.examples.raspberryPi // { system = "armv6l-linux"; }; }; in pkgs.libksba'
@matthewbauer
Copy link
Member

matthewbauer commented Nov 18, 2018

I haven't tried this, but usually you just need to get gpg-error-config in your path. You can do this by adding the following line to libksba:

  nativeBuildInputs = [ libgpgerror.dev ];

@eburimu
Copy link
Contributor Author

eburimu commented Nov 18, 2018

Hello @matthewbauer ,

I first get the following.

9912 checking for gpg-error-config... /nix/store/xd6kz4ixgzklh6v11f5ma2pz39w3lcqf-libgpg-error-1.32-dev/bin/gpg-error-config
 9913 checking for GPG Error - version >= 1.8... yes (1.32)
 9914 configure: WARNING:
 9915 ***
 9916 *** The config script /nix/store/xd6kz4ixgzklh6v11f5ma2pz39w3lcqf-libgpg-error-1.32-dev/bin/gpg-error-config was
 9917 *** built for x86_64-pc-linux-gnu and thus may not match the
 9918 *** used host armv6l-unknown-linux-gnueabihf.
 9919 *** You may want to use the configure option --with-gpg-error-prefix
 9920 *** to specify a matching config script or use $SYSROOT.
 9921 ***

Then it gets funnier:)

 9984 Making all in src
  9985 make[2]: Entering directory '/build/libksba-1.3.5/src'
  9986 cc -I. -DBUILD_GENTOOLS -o asn1-gentables \
  9987         ./asn1-gentables.c \
  9988                 `test -f 'asn1-parse.c' || echo './'`asn1-parse.c  \
  9989                 ./asn1-func.c      \
  9990                 ./gen-help.c
  9991 /nix/store/r47p5pzx52m3n34vdgqpk5rvqgm0m24m-bash-4.4-p23/bin/bash: cc: command not found
  9992 make[2]: *** [Makefile:1058: asn1-gentables] Error 127
  9993 make[2]: Leaving directory '/build/libksba-1.3.5/src'
  9994 make[1]: *** [Makefile:452: all-recursive] Error 1
  9995 make[1]: Leaving directory '/build/libksba-1.3.5'
  9996 make: *** [Makefile:383: all] Error 2

@exarkun
Copy link
Contributor

exarkun commented Nov 18, 2018

Huh I encountered this today as well. I believe I have a fix, will create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants