[Haskell-cafe] strange link error
Brandon Allbery
allbery.b at gmail.com
Mon Jan 10 10:15:53 UTC 2022
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.
On Mon, Jan 10, 2022 at 3:50 AM PICCA Frederic-Emmanuel
<frederic-emmanuel.picca at synchrotron-soleil.fr> wrote:
>
> Hello, I try to build a project which use C libraries.
>
> during the developpement I want to link directly with the work in progress libraries.
> So I added this in cabal.
>
> executable binoculars-ng
> [...]
>
> if flag(useHklDev)
> pkgconfig-depends: gobject-2.0
> ghc-options: -pgml
> ghc-options: gcc
> ghc-options: "-optl-Wl,--allow-multiple-definition"
> ghc-options: "-optl-Wl,--whole-archive,../../hkl/.libs/libhkl.a,--no-whole-archive"
> ghc-options: "-optl-Wl,--whole-archive,../../binoculars/libhkl-binoculars.a,--no-whole-archive"
>
> at the end I have a working executable.
>
> Building executable 'binoculars-ng' for hkl-0.1.0.0..
> [1 of 1] Compiling Main ( app/Binoculars.hs, /home/experiences/instrumentation/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 )
> Linking /home/experiences/instrumentation/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 ...
>
>
> But now I would like to create an unit test so I added this in cabal
>
> test-suite hkl-test
> [...]
> if flag(useHklDev)
> pkgconfig-depends: gobject-2.0
> ghc-options: -pgml
> ghc-options: gcc
> ghc-options: "-optl-Wl,--allow-multiple-definition"
> ghc-options: "-optl-Wl,--whole-archive,../../hkl/.libs/libhkl.a,--no-whole-archive"
> ghc-options: "-optl-Wl,--whole-archive,../../binoculars/libhkl-binoculars.a,--no-whole-archive"
>
> but this time during the compilation I end up with this error message
>
> [1 of 3] Compiling Paths_hkl ( /home/experiences/instrumentation/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/t/hkl-test/build/hkl-test/autogen/Paths_hkl.hs, /home/experiences/instrumentation/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/t/hkl-test/build/hkl-test/hkl-test-tmp/Paths_hkl.o )
> [2 of 3] Compiling BinocularsSpec ( test/BinocularsSpec.hs, /home/experiences/instrumentation/picca/src/repo.or.cz/hkl/contrib/haskell/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hkl-0.1.0.0/t/hkl-test/build/hkl-test/hkl-test-tmp/BinocularsSpec.o )
> <command line>: /home/experiences/instrumentation/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
>
> both the executable and the test use this hkl_binoculars_cube_free function.
>
> So are you aware of a difference between test suit and executable during the build.
>
> more precisely are both executables compiled differently ?
>
> thanks for you help
>
> Frederic
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
--
brandon s allbery kf8nh
allbery.b at gmail.com
More information about the Haskell-Cafe
mailing list