
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