Loading package integer-gmp ... command line: can't load .so/.DLL for: libgmp.so (libgmp.so: cannot open shared object file: No such file or directory)

2014-05-11 Thread Mateusz Kowalczyk
Hi,

Trying to compile GHC in the source tree on NixOS and meeting with
failure with:

inplace/bin/ghc-stage2 -hisuf hi -osuf  o -hcsuf hc -static  -H32m -O
-Werror -Wall -H64m -O0-package-name vector-0.10.9.1
-hide-all-packages -i -ilibraries/vector/.
-ilibraries/vector/dist-install/build
-ilibraries/vector/dist-install/build/autogen
-Ilibraries/vector/dist-install/build
-Ilibraries/vector/dist-install/build/autogen -Ilibraries/vector/include
-Ilibraries/vector/internal   -optP-DVECTOR_BOUNDS_CHECKS -optP-include
-optPlibraries/vector/dist-install/build/autogen/cabal_macros.h -package
base-4.7.1.0 -package deepseq-1.3.0.2 -package ghc-prim-0.3.1.0 -package
primitive-0.5.2.1 -O2 -XHaskell98 -XCPP -XDeriveDataTypeable -O2 -O
-dcore-lint -fno-warn-deprecated-flags  -no-user-package-db -rtsopts
-Wwarn -odir libraries/vector/dist-install/build -hidir
libraries/vector/dist-install/build -stubdir
libraries/vector/dist-install/build  -dynamic-too -c
libraries/vector/./Data/Vector/Fusion/Stream/Monadic.hs -o
libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.o
-dyno
libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.dyn_o
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... command line: can't load .so/.DLL for:
libgmp.so (libgmp.so: cannot open shared object file: No such file or
directory)

While libgmp isn't anywhere obvious, below is my build.mk and content of
the pointed-to directories. Am I missing something here? Is something
ignoring the configure option maybe?

[shana@lenalee:~/programming/ghc/mk]$ cat build.mk
libraries/integer-gmp_CONFIGURE_OPTS +=
--configure-option=--with-gmp-libraries=/nix/store/qnkyas42nf0knps3va30y29y3zvmgy2v-gmp-5.1.3/lib
libraries/integer-gmp_CONFIGURE_OPTS +=
--configure-option=--with-gmp-includes=/nix/store/qnkyas42nf0knps3va30y29y3zvmgy2v-gmp-5.1.3/include
DYNAMIC_BY_DEFAULT = NO

[shana@lenalee:~/programming/ghc/mk]$ l
/nix/store/qnkyas42nf0knps3va30y29y3zvmgy2v-gmp-5.1.3/lib
total 604K
dr-xr-xr-x 2 root nixbld 4.0K Jan  1  1970 .
dr-xr-xr-x 5 root nixbld 4.0K Jan  1  1970 ..
-r-xr-xr-x 1 root nixbld  949 Jan  1  1970 libgmp.la
lrwxrwxrwx 1 root nixbld   16 Jan  1  1970 libgmp.so - libgmp.so.10.1.3
lrwxrwxrwx 1 root nixbld   16 Jan  1  1970 libgmp.so.10 - libgmp.so.10.1.3
-r-xr-xr-x 1 root nixbld 556K Jan  1  1970 libgmp.so.10.1.3
-r-xr-xr-x 1 root nixbld 1.1K Jan  1  1970 libgmpxx.la
lrwxrwxrwx 1 root nixbld   17 Jan  1  1970 libgmpxx.so - libgmpxx.so.4.3.3
lrwxrwxrwx 1 root nixbld   17 Jan  1  1970 libgmpxx.so.4 -
libgmpxx.so.4.3.3
-r-xr-xr-x 1 root nixbld  30K Jan  1  1970 libgmpxx.so.4.3.3

[shana@lenalee:~/programming/ghc/mk]$ l
/nix/store/qnkyas42nf0knps3va30y29y3zvmgy2v-gmp-5.1.3/include
total 204K
dr-xr-xr-x 2 root nixbld 4.0K Jan  1  1970 .
dr-xr-xr-x 5 root nixbld 4.0K Jan  1  1970 ..
-r--r--r-- 1 root nixbld  78K Jan  1  1970 gmp.h
-r--r--r-- 1 root nixbld 114K Jan  1  1970 gmpxx.h

-- 
Mateusz K.
___
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs


Re: Loading package integer-gmp ... command line: can't load .so/.DLL for: libgmp.so (libgmp.so: cannot open shared object file: No such file or directory)

2014-05-11 Thread Gergely Risko
Hi,

Interesting.  You're already using the libraries/integer-gmp_CONFIGURE_OPTS
magic that I wanted to advise.

I think you should record the configure and build output, so it's easy
to look around in it afterwards (and don't use -j for make, because then
the output is mixed).  I would look for gmp relevant bits in that, to
see if it found it alright.  You can also try --with-intree-gmp (or
something like that) to force a statically linked intree gmp, that will
just work.

Also, I think inplace/bin/ghc-stage2 --interactive will fail with the
same error message, and you can strace -f -e file that command to see
where the libgmp.so is searched for. It should definitely be searched
for in your /nix/store/qnky...  directory with your build.mk.  I use the
same strategy here:
https://github.com/nilcons/ceh/blob/master/README.compile-ghc-with-ceh

If you just want to quickly try something and not really interested in
figuring out what's wrong, then a quick and dirty fix is to
export 
LD_LIBRARY_PATH=/nix/store/qnkyas42nf0knps3va30y29y3zvmgy2v-gmp-5.1.3/lib
before the whole build or anytime afterwards when you want to use the
compiled GHC.

But I'd really like to understand what caused it, so if you have time,
please investigate!

Gergely

On Sun, 11 May 2014 16:27:01 +0200, Mateusz Kowalczyk fuuze...@fuuzetsu.co.uk 
writes:

 Hi,

 Trying to compile GHC in the source tree on NixOS and meeting with
 failure with:

 inplace/bin/ghc-stage2 -hisuf hi -osuf  o -hcsuf hc -static  -H32m -O
 -Werror -Wall -H64m -O0-package-name vector-0.10.9.1
 -hide-all-packages -i -ilibraries/vector/.
 -ilibraries/vector/dist-install/build
 -ilibraries/vector/dist-install/build/autogen
 -Ilibraries/vector/dist-install/build
 -Ilibraries/vector/dist-install/build/autogen -Ilibraries/vector/include
 -Ilibraries/vector/internal   -optP-DVECTOR_BOUNDS_CHECKS -optP-include
 -optPlibraries/vector/dist-install/build/autogen/cabal_macros.h -package
 base-4.7.1.0 -package deepseq-1.3.0.2 -package ghc-prim-0.3.1.0 -package
 primitive-0.5.2.1 -O2 -XHaskell98 -XCPP -XDeriveDataTypeable -O2 -O
 -dcore-lint -fno-warn-deprecated-flags  -no-user-package-db -rtsopts
 -Wwarn -odir libraries/vector/dist-install/build -hidir
 libraries/vector/dist-install/build -stubdir
 libraries/vector/dist-install/build  -dynamic-too -c
 libraries/vector/./Data/Vector/Fusion/Stream/Monadic.hs -o
 libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.o
 -dyno
 libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.dyn_o
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... command line: can't load .so/.DLL for:
 libgmp.so (libgmp.so: cannot open shared object file: No such file or
 directory)

 While libgmp isn't anywhere obvious, below is my build.mk and content of
 the pointed-to directories. Am I missing something here? Is something
 ignoring the configure option maybe?

 [shana@lenalee:~/programming/ghc/mk]$ cat build.mk
 libraries/integer-gmp_CONFIGURE_OPTS +=
 --configure-option=--with-gmp-libraries=/nix/store/qnkyas42nf0knps3va30y29y3zvmgy2v-gmp-5.1.3/lib
 libraries/integer-gmp_CONFIGURE_OPTS +=
 --configure-option=--with-gmp-includes=/nix/store/qnkyas42nf0knps3va30y29y3zvmgy2v-gmp-5.1.3/include
 DYNAMIC_BY_DEFAULT = NO

 [shana@lenalee:~/programming/ghc/mk]$ l
 /nix/store/qnkyas42nf0knps3va30y29y3zvmgy2v-gmp-5.1.3/lib
 total 604K
 dr-xr-xr-x 2 root nixbld 4.0K Jan  1  1970 .
 dr-xr-xr-x 5 root nixbld 4.0K Jan  1  1970 ..
 -r-xr-xr-x 1 root nixbld  949 Jan  1  1970 libgmp.la
 lrwxrwxrwx 1 root nixbld   16 Jan  1  1970 libgmp.so - libgmp.so.10.1.3
 lrwxrwxrwx 1 root nixbld   16 Jan  1  1970 libgmp.so.10 - libgmp.so.10.1.3
 -r-xr-xr-x 1 root nixbld 556K Jan  1  1970 libgmp.so.10.1.3
 -r-xr-xr-x 1 root nixbld 1.1K Jan  1  1970 libgmpxx.la
 lrwxrwxrwx 1 root nixbld   17 Jan  1  1970 libgmpxx.so - libgmpxx.so.4.3.3
 lrwxrwxrwx 1 root nixbld   17 Jan  1  1970 libgmpxx.so.4 -
 libgmpxx.so.4.3.3
 -r-xr-xr-x 1 root nixbld  30K Jan  1  1970 libgmpxx.so.4.3.3

 [shana@lenalee:~/programming/ghc/mk]$ l
 /nix/store/qnkyas42nf0knps3va30y29y3zvmgy2v-gmp-5.1.3/include
 total 204K
 dr-xr-xr-x 2 root nixbld 4.0K Jan  1  1970 .
 dr-xr-xr-x 5 root nixbld 4.0K Jan  1  1970 ..
 -r--r--r-- 1 root nixbld  78K Jan  1  1970 gmp.h
 -r--r--r-- 1 root nixbld 114K Jan  1  1970 gmpxx.h

___
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs


Re: Loading package integer-gmp ... command line: can't load .so/.DLL for: libgmp.so (libgmp.so: cannot open shared object file: No such file or directory)

2014-05-11 Thread Gergely Risko
On Sun, 11 May 2014 21:42:45 +0200, Mateusz Kowalczyk fuuze...@fuuzetsu.co.uk 
writes:

 Are there any downsides to doing this except slightly bigger binary size?

There are license issues if you want to distribute the resulting stuff.
Have to ask your lawyers about lgpl + gmp + shipping binary only stuff.
On the technical side, there are no other downsides.

 Sorry, you're correct, I did not pass interactive. Find attached the
 strace with --interactive.

 [...]

 Actually, I'm doing this already:
 https://github.com/Fuuzetsu/nix-project-defaults/blob/master/ghc/default.nix

At the end of your strace, I see this:
Loading package integer-gmp ... [pid 10676] 
open(/home/shana/programming/ghc/libraries/haskeline/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/terminfo/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] open(/home/shana/programming/ghc/compiler/stage2/build/libgmp.so, 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/transformers/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/template-haskell/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/hpc/dist-install/build/libgmp.so, 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/hoopl/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/bin-package-db/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/binary/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/Cabal/Cabal/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/process/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/pretty/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/directory/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/unix/dist-install/build/libgmp.so, 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/time/dist-install/build/libgmp.so, 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/old-locale/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/filepath/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/containers/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/bytestring/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/deepseq/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/array/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/base/dist-install/build/libgmp.so, 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/integer-gmp/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] 
open(/home/shana/programming/ghc/libraries/ghc-prim/dist-install/build/libgmp.so,
 O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] open(/home/shana/programming/ghc/rts/dist/build/libgmp.so, 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 10676] open(/run/opengl-driver/lib/tls/libgmp.so, O_RDONLY|O_CLOEXEC) = 
-1 ENOENT (No such file or directory)
[pid 10676] open(/run/opengl-driver/lib/libgmp.so, O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 10676] open(/run/opengl-driver-32/lib/tls/libgmp.so, O_RDONLY|O_CLOEXEC) 
= -1 ENOENT (No such file or directory)
[pid 10676] open(/run/opengl-driver-32/lib/libgmp.so, O_RDONLY|O_CLOEXEC) = 
-1 ENOENT (No such file or directory)
[pid 10676]