Skip to content

Regression test T4025 fails (macOS) #7610

Open
@andreasabel

Description

@andreasabel

The regression test for #4025 fails for me (macOS Mojave). The report is:

stderr:
*** Exception: Command /cabal-testsuite/PackageTests/Regression/T4025/setup.dist/work/./dist/build/exe/exe succeeded.
Output:
23

The intention of the test is to build an executable using --enable-executable-dynamic that is then not supposed to run because it is not supposed to find a dynamic component.

However, on my system the executable does run successfully and prints its output 23.

$ cd cabal-testsuite/PackageTests/Regression/T4025
$ echo "packages: ." > cabal.project
$ cabal run --enable-executable-dynamic
Resolving dependencies...
Build profile: -w ghc-8.10.6 -O1
In order, the following will be built (use -v for more details):
 - T4025-1.0 (lib) (first run)
 - T4025-1.0 (exe:exe) (first run)
Configuring library for T4025-1.0..
Preprocessing library for T4025-1.0..
Building library for T4025-1.0..
[1 of 1] Compiling A                ( A.hs, cabal-testsuite/PackageTests/Regression/T4025/dist-newstyle/build/x86_64-osx/ghc-8.10.6/T4025-1.0/build/A.o, cabal-testsuite/PackageTests/Regression/T4025/dist-newstyle/build/x86_64-osx/ghc-8.10.6/T4025-1.0/build/A.dyn_o )
Configuring executable 'exe' for T4025-1.0..
Preprocessing executable 'exe' for T4025-1.0..
Building executable 'exe' for T4025-1.0..
[1 of 1] Compiling Main             ( exe/Main.hs, cabal-testsuite/PackageTests/Regression/T4025/dist-newstyle/build/x86_64-osx/ghc-8.10.6/T4025-1.0/x/exe/build/exe/exe-tmp/Main.dyn_o )
Linking cabal-testsuite/PackageTests/Regression/T4025/dist-newstyle/build/x86_64-osx/ghc-8.10.6/T4025-1.0/x/exe/build/exe/exe ...
23

(The rest of the cabal-testsuite passes...)

The test script explains the purpose of the test:

-- Test that we don't accidentally add the inplace directory to
-- an executable RPATH. Don't test on Windows, which doesn't
-- support RPATH.
main = setupAndCabalTest $ do
skipIfWindows
setup "configure" ["--enable-executable-dynamic"]
setup "build" []
-- This should fail as it we should NOT be able to find the
-- dynamic library for the internal library (since we didn't
-- install it). If we incorrectly encoded our local dist
-- dir in the RPATH, this will succeed.
recordMode DoNotRecord . fails $ runExe "exe" []

Just to make sure, the generated exe does depend on the dylib:

$ otool -L ./dist-newstyle/build/x86_64-osx/ghc-8.10.6/T4025-1.0/x/exe/build/exe/exe
...
	@rpath/libHST4025-1.0-inplace-ghc8.10.6.dylib (compatibility version 0.0.0, current version 0.0.0)
...

I am however puzzled why such an innocent looking project should not just work with --enable-executable-dynamic:

name: T4025
version: 1.0
build-type: Simple
cabal-version: >= 1.10
library
default-language: Haskell2010
build-depends: base
exposed-modules: A
executable exe
default-language: Haskell2010
build-depends: T4025, base
hs-source-dirs: exe
main-is: Main.hs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions