[Haskell-cafe] strange link error

Brandon Allbery allbery.b at gmail.com
Mon Jan 10 10:54:58 UTC 2022


In that case you were missing part of the error message, since it came
up at 2 out of 3 compiled and referenced "command line" instead of an
object file, and comes before the "Linking" message.

Given the forced link stuff I wonder if you need -Wl,-u
-Wl,hkl_binoculars_cube_free (or some variant thereof).

On Mon, Jan 10, 2022 at 5:51 AM PICCA Frederic-Emmanuel
<frederic-emmanuel.picca at synchrotron-soleil.fr> wrote:
>
>
> ----- Brandon Allbery <allbery.b at gmail.com> a écrit :
> > That error message looks like it's coming from TH instead of final
> > link, so you may need to do something else to make it available to TH
> > during compile.
>
> I used the -v option in order to have detailed error message
>
> executable
> ---------------
>
> creating
> /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp
> /usr/bin/ghc --make -no-link -fbuilding-cabal-package -O -static -outputdir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -odir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -hidir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -stubdir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -i -i/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -i. -i/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/autogen -i/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/global-autogen -I/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/autogen -I/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/global-autogen -I/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -optP-include -optP/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/autogen/cabal_macros.h -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /home/picca/.cabal/store/ghc-8.8.4/package.db -package-db /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/packagedb/ghc-8.8.4 -package-db /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/package.conf.inplace -package-id attoparsec-0.13.2.4-Ab3vFYnVhC6LY7sYuAbpTr -package-id base-4.13.0.0 -package-id containers-0.6.2.1 -package-id dimensional-1.3-C8v0k83E9Py18UKTdF1oLh -package-id exceptions-0.10.4-9CfD2hJyZLFIbks3iYGf0k -package-id filepath-1.4.2.1 -package-id hkl-0.1.0.0-inplace -package-id monad-logger-0.3.34-CJMMf2yR5GpALmIIglLyst -package-id monad-loops-0.4.3-9fN6QF5xEO8BUJUobxjHs -package-id optparse-applicative-0.15.1.0-GiY4uo4FBQRKuBqOktTXko -package-id pipes-4.3.14-KiHrcdQOQdo1w0hHviOVEE -package-id text-1.2.4.0 -package-id transformers-0.5.6.2 -package-id vector-0.12.1.2-C2W44iPdAFeHo4yLU081Gd -XHaskell2010 ./app/Binoculars.hs -O2 -Wall -Werror -rtsopts -threaded -g -dcore-lint -debug -ddump-to-file -ddump-simpl -ddump-stg '-with-rtsopts=-N' -pgml gcc -optl-Wl,--allow-multiple-definition -optl-Wl,--whole-archive,../../hkl/.libs/libhkl.a,--no-whole-archive -optl-Wl,--whole-archive,../../binoculars/libhkl-binoculars.a,--no-whole-archive -hide-all-packages
>
> test
> -----
> /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/hkl-test-tmp
> /usr/bin/ghc --make -no-link -fbuilding-cabal-package -O -static -outputdir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/hkl-test-tmp -odir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/hkl-test-tmp -hidir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/hkl-test-tmp -stubdir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/hkl-test-tmp -i -i/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/hkl-test-tmp -itest -i/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/autogen -i/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/global-autogen -I/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/autogen -I/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/global-autogen -I/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/hkl-test-tmp -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -optP-include -optP/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/autogen/cabal_macros.h -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /home/picca/.cabal/store/ghc-8.8.4/package.db -package-db /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/packagedb/ghc-8.8.4 -package-db /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/package.conf.inplace -package-id attoparsec-0.13.2.4-Ab3vFYnVhC6LY7sYuAbpTr -package-id base-4.13.0.0 -package-id config-ini-0.2.4.0-D7dieWR57bgihPQO3mLYW -package-id dimensional-1.3-C8v0k83E9Py18UKTdF1oLh -package-id hkl-0.1.0.0-inplace -package-id hspec-2.7.1-5JvuKFX0Z3iFazfgnEEvF6 -package-id path-0.7.0-ItQkMO2BJUADmjR5L3rHpY -package-id text-1.2.4.0 -XHaskell2010 BinocularsSpec Paths_hkl test/Spec.hs -threaded '-rtsopts=all' '-with-rtsopts=-K1k' -O2 -Wall -Werror -rtsopts -threaded -g -dcore-lint -debug -ddump-to-file -ddump-simpl -ddump-stg '-with-rtsopts=-N' -pgml gcc -optl-Wl,--allow-multiple-definition -optl-Wl,--whole-archive,../../hkl/.libs/libhkl.a,--no-whole-archive -optl-Wl,--whole-archive,../../binoculars/libhkl-binoculars.a,--no-whole-archive -hide-all-packages
> [1 of 1] Compiling Main             ( app/Binoculars.hs, /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp/Main.o )
> [1 of 3] Compiling Paths_hkl        ( /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/autogen/Paths_hkl.hs, /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/hkl-test-tmp/Paths_hkl.o )
> [2 of 3] Compiling BinocularsSpec   ( test/BinocularsSpec.hs, /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/hkl-test/build/hkl-test/hkl-test-tmp/BinocularsSpec.o )
> <command line>: /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/build/libHShkl-0.1.0.0-inplace-ghc8.8.4.so: undefined symbol: hkl_binoculars_cube_free
> Linking...
> /usr/bin/ghc --make -fbuilding-cabal-package -O -static -outputdir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -odir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -hidir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -stubdir /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -i -i/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -i. -i/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/autogen -i/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/global-autogen -I/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/autogen -I/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/global-autogen -I/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng-tmp -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -optP-include -optP/home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/autogen/cabal_macros.h -lgobject-2.0 -lglib-2.0 -L/home/picca/src/repo.or.cz/hkl/binoculars/ -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /home/picca/.cabal/store/ghc-8.8.4/package.db -package-db /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/packagedb/ghc-8.8.4 -package-db /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/package.conf.inplace -package-id attoparsec-0.13.2.4-Ab3vFYnVhC6LY7sYuAbpTr -package-id base-4.13.0.0 -package-id containers-0.6.2.1 -package-id dimensional-1.3-C8v0k83E9Py18UKTdF1oLh -package-id exceptions-0.10.4-9CfD2hJyZLFIbks3iYGf0k -package-id filepath-1.4.2.1 -package-id hkl-0.1.0.0-inplace -package-id monad-logger-0.3.34-CJMMf2yR5GpALmIIglLyst -package-id monad-loops-0.4.3-9fN6QF5xEO8BUJUobxjHs -package-id optparse-applicative-0.15.1.0-GiY4uo4FBQRKuBqOktTXko -package-id pipes-4.3.14-KiHrcdQOQdo1w0hHviOVEE -package-id text-1.2.4.0 -package-id transformers-0.5.6.2 -package-id vector-0.12.1.2-C2W44iPdAFeHo4yLU081Gd -XHaskell2010 ./app/Binoculars.hs -o /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng -O2 -Wall -Werror -rtsopts -threaded -g -dcore-lint -debug -ddump-to-file -ddump-simpl -ddump-stg '-with-rtsopts=-N' -pgml gcc -optl-Wl,--allow-multiple-definition -optl-Wl,--whole-archive,../../hkl/.libs/libhkl.a,--no-whole-archive -optl-Wl,--whole-archive,../../binoculars/libhkl-binoculars.a,--no-whole-archive -hide-all-packages
> Linking /home/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/x/binoculars-ng/build/binoculars-ng/binoculars-ng ...
> CallStack (from HasCallStack):
>   die', called at ./Distribution/Client/ProjectOrchestration.hs:1035:55 in main:Distribution.Client.ProjectOrchestration
> cabal: Failed to build hkl-0.1.0.0-inplace-hkl-test.
>
>
> the difference is that there is no link phase for the executable binary (it has only one file).
>
> I see no reference to TH during the compilation of this part of the code. (It is true thaht I use TH in the librarie).
>
> Cheers
>
> Fred



-- 
brandon s allbery kf8nh
allbery.b at gmail.com


More information about the Haskell-Cafe mailing list