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

cannot find normal object file #1266

Closed
UnkindPartition opened this issue Apr 12, 2013 · 26 comments
Closed

cannot find normal object file #1266

UnkindPartition opened this issue Apr 12, 2013 · 26 comments
Assignees

Comments

@UnkindPartition
Copy link
Contributor

I cannot build traverse-with-class with GHC 7.7.20130407. Following #1207, I built Cabal master (which includes Mikhail's patch), but I get the same error:

% ./Setup -v build 
Component build order: library
creating dist/build
creating dist/build/autogen
Building traverse-with-class-0.1...
Preprocessing library traverse-with-class-0.1...
Building library...
/home/feuerbach/source/ghc/inplace/bin/ghc --info
creating dist/build
/home/feuerbach/source/ghc/inplace/bin/ghc --make -fbuilding-cabal-package -O -static -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -i. -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -package-name traverse-with-class-0.1 -hide-all-packages -no-user-package-db -package-db dist/package.conf.inplace -package-id base-4.7.0.0-inplace -package-id template-haskell-2.9.0.0-inplace -package-id transformers-0.3.0.0-inplace -XHaskell2010 Data.Generics.Traversable Data.Generics.Traversable.TH Data.Generics.Traversable.Core Data.Generics.Traversable.Instances
[3 of 4] Compiling Data.Generics.Traversable.Instances ( Data/Generics/Traversable/Instances.hs, dist/build/Data/Generics/Traversable/Instances.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package array-0.4.0.2 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Data/Generics/Traversable/Instances.hs:1:1:
    cannot find normal object file ‛dist/build/Data/Generics/Traversable/Core.dyn_o’
    while linking an interpreted expression
@23Skidoo
Copy link
Member

Yes, I haven't tested with GHC 7.7. Unfortunately, I don't have time to do it right now.

Related: #1252.

@23Skidoo
Copy link
Member

Tried building traverse-with-class with Cabal HEAD and GHC HEAD. Works fine for me.

@23Skidoo
Copy link
Member

Should be fixed in HEAD. Please reopen if this still happens.

@Fuuzetsu
Copy link
Member

This seems to still be broken. We can not run Template Haskell HTML tests in Haddock through cabal. It works just fine if you run these files directly using Haddock.

[snip]
  89% ( 54 / 61) in 'Test'
   0% (  0 /  7) in 'Bug8'
   0% (  0 /  2) in 'TH'
html-test/src/TH2.hs:1:1:
    cannot find normal object file ‛/tmp/.haddock-18731/TH.dyn_o’
    while linking an interpreted expression
*** Haddock run failed! Exiting.

Haddock version: 

GHC version: 

Running tests...
Test suite html-test: FAIL
Test suite logged to: dist/test/haddock-2.13.2-html-test.log
0 of 1 test suites (0 of 1 test cases) passed.
~/programming/haddock $ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.7.20130830
~/programming/haddock $ cabal --version
cabal-install version 1.18.0
using version 1.18.0 of the Cabal library 

Steps to reproduce:

git clone [email protected]:ghc/haddock.git
cd haddock
cabal configure --enable-tests && cabal build && cabal test html-test

Please re-open.

@23Skidoo 23Skidoo reopened this Aug 31, 2013
@ghost ghost assigned 23Skidoo Aug 31, 2013
@23Skidoo
Copy link
Member

23Skidoo commented Sep 1, 2013

@Fuuzetsu

I'm getting the following error while trying to build haddock:

$ cabal build       
Building haddock-2.13.2...
Preprocessing library haddock-2.13.2...
[ 3 of 31] Compiling Haddock.Convert  ( src/Haddock/Convert.hs, dist/build/Haddock/Convert.o )

src/Haddock/Convert.hs:123:43:
    Not in scope: data constructor ‛HsTyVarBndr’

src/Haddock/Convert.hs:279:40:
    Not in scope: data constructor ‛HsTyVarBndr’

src/Haddock/Convert.hs:280:40:
    Not in scope: data constructor ‛HsTyVarBndr’

Does this mean I need a more recent GHC HEAD snapshot?

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.7.20130720

@23Skidoo
Copy link
Member

23Skidoo commented Sep 1, 2013

Aha, this was a recent change: ghc/haddock@34d2aa5

Fixed by reverting to ghc/haddock@9f356e8.

@23Skidoo
Copy link
Member

23Skidoo commented Sep 1, 2013

OK, have to run, will finish later.

@Fuuzetsu
Copy link
Member

Fuuzetsu commented Sep 1, 2013

That means your GHC was too old. We tightly couple with GHC API. The error should persist with older Haddock so it should persist with your revert.

@23Skidoo
Copy link
Member

23Skidoo commented Sep 1, 2013

@Fuuzetsu

OK, now I am getting

<command line>: can't load .so/.DLL for: /home/gman/bin/ghc-head/lib/ghc-7.7.20130711/ghc-prim-0.3.1.0/libHSghc-prim-0.3.1.0-ghc7.7.20130711.so (/home/gman/bin/ghc-head/lib/ghc-7.7.20130711/ghc-prim-0.3.1.0/libHSghc-prim-0.3.1.0-ghc7.7.20130711.so: undefined symbol: stg_forkOnzh)
*** Haddock run failed! Exiting.

when trying to run cabal test.

Any idea how to fix this?

@23Skidoo
Copy link
Member

23Skidoo commented Sep 1, 2013

Managed to reproduce this with traverse-with-class:

$ cabal haddock --with-haddock ~/bin/ghc-head/bin/haddock
Running Haddock for traverse-with-class-0.1...
Preprocessing library traverse-with-class-0.1...
Haddock coverage:
   0% (  0 /  2) in 'Data.Generics.Traversable.Core'
 100% (  3 /  3) in 'Data.Generics.Traversable.TH'
dist/build/tmp-7984/Data/Generics/Traversable/Instances.hs:1:1:
    cannot find normal object file ‛/tmp/.haddock-7993/Data/Generics/Traversable/Core.dyn_o’
    while linking an interpreted expression

@Fuuzetsu
Copy link
Member

Fuuzetsu commented Sep 1, 2013

Ah, that old error. I don't remember the fix but I'm glad that you managed to reproduce on traverse. I suggest you use that for testing as Haddock behaviour depends heavily on the GHC you're using &c which is hard to control and reproduce.

@23Skidoo
Copy link
Member

23Skidoo commented Sep 2, 2013

@Fuuzetsu

This problem is caused by the fact that when GHC is dynamic-by-default, the modules loaded during the TH phase must use the same ABI. That's why it complains about the missing .dyn_o. So the error can be fixed by passing --haddock-options=--optghc=-dynamic-too to cabal haddock.

To fix this in Cabal, we need to be able to find out whether the GHC that haddock is compiled with is dynamic-by-default (i.e. get the ghc --info output). Perhaps we can query the GHC that we were configured with.

However, wouldn't it be better to fix Haddock itself to produce .dyn_o when the GHC it is linked against is dynamic-by-default? This can be done by passing -dynamic or -dynamic-too (when it's supported) to GHC. That way, haddock will still work for libraries that use TH when run in standalone mode (i.e., not driven by Cabal).

@Fuuzetsu
Copy link
Member

Fuuzetsu commented Sep 3, 2013

Unfortunately I'm unsure how this would look on our end, ping @sol for input on this.

@23Skidoo
Copy link
Member

23Skidoo commented Sep 3, 2013

@Fuuzetsu

You need to parse the output of ghc --info, and if GHC itself uses dynamic linking (there's a ("GHC Dynamic","YES") tuple in the output), you should pass GHC the -dynamic option so it generates .dyn_o instead of .o. If GHC supports -dynamic-too, you can also use that instead.

@23Skidoo
Copy link
Member

23Skidoo commented Sep 3, 2013

Created a ticket on the Haddock bug tracker.

@tibbe
Copy link
Member

tibbe commented Sep 3, 2013

Can this be postponed to after 1.18?

@23Skidoo
Copy link
Member

23Skidoo commented Sep 3, 2013

@tibbe Yes, and I think we can actually close this ticket since it's a Haddock issue.

@Fuuzetsu Please reopen if you disagree.

@23Skidoo 23Skidoo closed this as completed Sep 3, 2013
@Fuuzetsu
Copy link
Member

Fuuzetsu commented Sep 3, 2013

Alright, thanks for looking into it!

@UnkindPartition
Copy link
Contributor Author

Hmm, I'm still getting the exact same error with Cabal & cabal-install from git master, and ghc-7.7.20131012.

% cabal install -v traverse-with-class
Using a sandbox located at /home/feuerbach/tmp/sandboxes/ghc78/.cabal-sandbox
Reading available packages...
Reading available packages...
Reading installed packages...
'/home/feuerbach/source/ghc/inplace/bin/ghc-pkg' 'dump' '--package-db=/home/feuerbach/tmp/sandboxes/ghc78/.cabal-sandbox/i386-linux-ghc-7.7.20131012-packages.conf.d' '-v0'
'/home/feuerbach/source/ghc/inplace/bin/ghc' '--print-libdir'
Reading available packages...
Choosing modular solver.
Resolving dependencies...
Ready to install traverse-with-class-0.1.1
Waiting for install task to finish...
Extracting
/home/feuerbach/.cabal/packages/hackage.haskell.org/traverse-with-class/0.1.1/traverse-with-class-0.1.1.tar.gz
to /tmp/traverse-with-class-0.1.1-32694...
Updating traverse-with-class.cabal with the latest revision from the index.
Configuring traverse-with-class-0.1.1...
Dependency base ==4.7.0.0: using base-4.7.0.0
Dependency template-haskell ==2.9.0.0: using template-haskell-2.9.0.0
Dependency transformers ==0.3.0.0: using transformers-0.3.0.0
Using Cabal-1.19.0 compiled by ghc-7.6
Using compiler: ghc-7.7.20131012
Using install prefix: /home/feuerbach/tmp/sandboxes/ghc78/.cabal-sandbox
Binaries installed in: /home/feuerbach/tmp/sandboxes/ghc78/.cabal-sandbox/bin
Libraries installed in:
/home/feuerbach/tmp/sandboxes/ghc78/.cabal-sandbox/lib/i386-linux-ghc-7.7.20131012/traverse-with-class-0.1.1
Private binaries installed in:
/home/feuerbach/tmp/sandboxes/ghc78/.cabal-sandbox/libexec
Data files installed in:
/home/feuerbach/tmp/sandboxes/ghc78/.cabal-sandbox/share/i386-linux-ghc-7.7.20131012/traverse-with-class-0.1.1
Documentation installed in:
/home/feuerbach/tmp/sandboxes/ghc78/.cabal-sandbox/share/doc/i386-linux-ghc-7.7.20131012/traverse-with-class-0.1.1
Configuration files installed in:
/home/feuerbach/tmp/sandboxes/ghc78/.cabal-sandbox/etc
Using alex version 3.1.0 found on system at: /home/feuerbach/bin/alex
Using ar found on system at: /usr/bin/ar
Using c2hs version 0.16.4 found on system at: /usr/bin/c2hs
Using cpphs version 1.17.1 found on system at: /home/feuerbach/bin/cpphs
No ffihugs found
Using gcc version 4.8 found on system at: /usr/bin/gcc
Using ghc version 7.7.20131012 found on system at:
/home/feuerbach/source/ghc/inplace/bin/ghc
Using ghc-pkg version 7.7.20131012 found on system at:
/home/feuerbach/source/ghc/inplace/bin/ghc-pkg
No greencard found
Using haddock version 2.13.2 found on system at: /opt/ghc763/bin/haddock
Using happy version 1.19.0 found on system at: /home/feuerbach/bin/happy
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.67 found on system at:
/home/feuerbach/source/ghc/inplace/bin/hpc
Using hsc2hs version 0.67 found on system at:
/home/feuerbach/source/ghc/inplace/bin/hsc2hs
Using hscolour version 1.19 found on system at: /home/feuerbach/bin/HsColour
No hugs found
No jhc found
Using ld found on system at: /usr/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
Using pkg-config version 0.26 found on system at: /usr/bin/pkg-config
Using ranlib found on system at: /usr/bin/ranlib
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /bin/tar
No uhc found
Component build order: library
creating dist/dist-sandbox-dc7937a3/build
creating dist/dist-sandbox-dc7937a3/build/autogen
Building traverse-with-class-0.1.1...
Preprocessing library traverse-with-class-0.1.1...
Building library...
creating dist/dist-sandbox-dc7937a3/build
/home/feuerbach/source/ghc/inplace/bin/ghc --make -fbuilding-cabal-package -O -outputdir dist/dist-sandbox-dc7937a3/build -odir dist/dist-sandbox-dc7937a3/build -hidir dist/dist-sandbox-dc7937a3/build -stubdir dist/dist-sandbox-dc7937a3/build -i -idist/dist-sandbox-dc7937a3/build -i. -idist/dist-sandbox-dc7937a3/build/autogen -Idist/dist-sandbox-dc7937a3/build/autogen -Idist/dist-sandbox-dc7937a3/build -optP-include -optPdist/dist-sandbox-dc7937a3/build/autogen/cabal_macros.h -package-name traverse-with-class-0.1.1 -hide-all-packages -no-user-package-db -package-db /home/feuerbach/tmp/sandboxes/ghc78/.cabal-sandbox/i386-linux-ghc-7.7.20131012-packages.conf.d -package-db dist/dist-sandbox-dc7937a3/package.conf.inplace -package-id base-4.7.0.0-inplace -package-id template-haskell-2.9.0.0-inplace -package-id transformers-0.3.0.0-inplace -XHaskell2010 Data.Generics.Traversable Data.Generics.Traversable.TH Data.Generics.Traversable.Core Data.Generics.Traversable.Instances
[1 of 4] Compiling Data.Generics.Traversable.Core ( Data/Generics/Traversable/Core.hs, dist/dist-sandbox-dc7937a3/build/Data/Generics/Traversable/Core.o )
[2 of 4] Compiling Data.Generics.Traversable.TH ( Data/Generics/Traversable/TH.hs, dist/dist-sandbox-dc7937a3/build/Data/Generics/Traversable/TH.o )
[3 of 4] Compiling Data.Generics.Traversable.Instances ( Data/Generics/Traversable/Instances.hs, dist/dist-sandbox-dc7937a3/build/Data/Generics/Traversable/Instances.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package containers-0.5.3.1 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Data/Generics/Traversable/Instances.hs:1:1:
    cannot find normal object file ‛dist/dist-sandbox-dc7937a3/build/Data/Generics/Traversable/Core.dyn_o’
    while linking an interpreted expression
Failed to install traverse-with-class-0.1.1
World file is already up to date.
cabal: Error: some packages failed to install:
traverse-with-class-0.1.1 failed during the building phase. The exception was:
ExitFailure 1

@23Skidoo
Copy link
Member

@feuerbach

Strange, works fine here with GHC 7.7.20130711:

$ ~/bin/ghc-head/bin/ghc --version 
The Glorious Glasgow Haskell Compilation System, version 7.7.20130711

$ $CABAL_ROOT_DIR/cabal-install/dist/build/cabal/cabal get traverse-with-class
$ $CABAL_ROOT_DIR/cabal-install/dist/build/cabal/cabal sandbox init

$ $CABAL_ROOT_DIR/cabal-install/dist/build/cabal/cabal install -w ~/bin/ghc-head/bin/ghc
Resolving dependencies...
Configuring traverse-with-class-0.1.1...
Building traverse-with-class-0.1.1...
Preprocessing library traverse-with-class-0.1.1...
[1 of 4] Compiling Data.Generics.Traversable.Core ( Data/Generics/Traversable/Core.hs, dist/dist-sandbox-bb6ca62f/build/Data/Generics/Traversable/Core.o )
[2 of 4] Compiling Data.Generics.Traversable.TH ( Data/Generics/Traversable/TH.hs, dist/dist-sandbox-bb6ca62f/build/Data/Generics/Traversable/TH.o )
[3 of 4] Compiling Data.Generics.Traversable.Instances ( Data/Generics/Traversable/Instances.hs, dist/dist-sandbox-bb6ca62f/build/Data/Generics/Traversable/Instances.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package array-0.4.0.2 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
[4 of 4] Compiling Data.Generics.Traversable ( Data/Generics/Traversable.hs, dist/dist-sandbox-bb6ca62f/build/Data/Generics/Traversable.o )
In-place registering traverse-with-class-0.1.1...
Installing library in
/home/gman/test/traverse-with-class-0.1.1/.cabal-sandbox/lib/i386-linux-ghc-7.7.20130711/traverse-with-class-0.1.1
Registering traverse-with-class-0.1.1...
Installed traverse-with-class-0.1.1

@23Skidoo
Copy link
Member

@feuerbach
What is the output of ghc --info on your machine?

@UnkindPartition
Copy link
Contributor Author

I found what triggers the bug. It's shared: False in my ~/.cabal/config. If I change it to shared: True, it installs fine.

@23Skidoo
Copy link
Member

That makes sense. I'll investigate why the value of shared is not ignored in this case (as it should be).

@23Skidoo
Copy link
Member

@feuerbach

You need to add default-extensions: TemplateHaskell to the library stanza. Then it will work even with shared: False in .cabal/config. Otherwise, Cabal has no way to detect that Template Haskell is used.

@UnkindPartition
Copy link
Contributor Author

That worked (even with other-extensions), thank you!

@23Skidoo
Copy link
Member

Hmm, yes, other-extensions is more appropriate here.

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

4 participants