Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dyplicate symbol definition failure #65

Open
TomMD opened this issue Dec 4, 2020 · 3 comments
Open

Dyplicate symbol definition failure #65

TomMD opened this issue Dec 4, 2020 · 3 comments

Comments

@TomMD
Copy link

TomMD commented Dec 4, 2020

When running doctest in the manner described in the readme (a custom setup etc) I get to the point of actually running the test:

cabal test --builddir=build <component>:doctests

This fails on my OS-X machine but works on the Linux based CI systems:

GHC runtime linker: fatal error: I found a duplicate definition for symbol                                    [161/779]
   __ZNK17double_conversion6VectorIcEixEi
whilst processing object file
   /Users/tommd/.cabal/store/ghc-8.10.1/dbl-cnvrsn-2.0.2.0-d1095495/lib/libHSdbl-cnvrsn-2.0.2.0-d1095495.a
The symbol was previously defined in
   /Users/tommd/.cabal/store/ghc-8.10.1/dbl-cnvrsn-2.0.2.0-d1095495/lib/libHSdbl-cnvrsn-2.0.2.0-d1095495.a(hs-double-co
nversion.o)
This could be caused by:
   * Loading two different object files which export the same symbol
   * Specifying the same object file twice on the GHCi command line
   * An incorrect `package.conf' entry, causing some object to be
     loaded twice.
doctests:
lookupSymbol failed in relocateSection (relocate external)
/Users/tommd/.cabal/store/ghc-8.10.1/dbl-cnvrsn-2.0.2.0-d1095495/lib/libHSdbl-cnvrsn-2.0.2.0-d1095495.a: unknown symbol
 `__ZN17double_conversion6StrtofENS_6VectorIKcEEi'
GHC runtime linker: fatal error: I found a duplicate definition for symbol
   __ZN17double_conversion7BitCastIdyEET_RKT0_
whilst processing object file
   /Users/tommd/.cabal/store/ghc-8.10.1/dbl-cnvrsn-2.0.2.0-d1095495/lib/libHSdbl-cnvrsn-2.0.2.0-d1095495.a
The symbol was previously defined in                                                                                      /Users/tommd/.cabal/store/ghc-8.10.1/dbl-cnvrsn-2.0.2.0-d1095495/lib/libHSdbl-cnvrsn-2.0.2.0-d1095495.a(double-conve
rsion.o)
This could be caused by:
   * Loading two different object files which export the same symbol
   * Specifying the same object file twice on the GHCi command line
   * An incorrect `package.conf' entry, causing some object to be
     loaded twice.

Is this a known issue? Should I reroute to GHC's issue tracker?

My last attempt to make a minimal example failed, but I can retry.

@phadej
Copy link
Collaborator

phadej commented Dec 4, 2020

The example doctest runner has

traverse_ putStrLn args

Does it print duplicate -package-id=db-cnvrsn-2.0.0.0-d1095495 for you? Or something else suspicious?

@TomMD
Copy link
Author

TomMD commented Dec 4, 2020

No, it looks good. And just to check I did:

% cat /tmp/doctest-args | sort | uniq | wc -l
      93
% wc -l /tmp/doctest-args
      93 /tmp/doctest-args

And that file has all the args emitted from the output, for example:

% tail /tmp/doctest-args
...
-package-id=dctst-0.17-fe3e7c72
-package-id=template-haskell-2.16.0.0

But it doesn't have even one mention of double conversion:

% grep cnvrsn /tmp/doctest-args
% grep trnsfrmrs /tmp/doctest-args
-package-id=trnsfrmrs-bs-0.4.5.2-0c7e5fc5

@phadej
Copy link
Collaborator

phadej commented Dec 4, 2020

Hmm. I think it might be issue in doctest. I see

% doctest src 
Loaded package environment from /code/public-haskell/hkd/.ghc.environment.x86_64-linux-8.6.5
Loaded package environment from /code/public-haskell/hkd/.ghc.environment.x86_64-linux-8.6.5
Examples: 0  Tried: 0  Errors: 0  Failures: 0

when I run doctest, i.e. it loads GHC twice, first to parse modules, and then to actually do testing.

I had no success to reproduce it on linux, having TH using double-conversion and then doctest. In fact, that would be bizarre - as a lot of stuff uses cbits. What particularly happens in your case, no idea.

There are issues close to this in spirit on GHC tracker, e.g. https://gitlab.haskell.org/ghc/ghc/-/issues/8942, but I doubt you would get anywhere without a reproducer. Issue can be anywhere, in GHC itself, Cabal, doctest, or in cabal-doctest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants