Ticket #7234 (closed bug: invalid)

Opened 8 months ago

Last modified 8 months ago

Linker spews useless error message and failes.

Reported by: timthelion Owned by:
Priority: normal Milestone:
Component: Build System Version: 7.4.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

This is with ImplicitCAD as installed by way of

git clone https://github.com/colah/ImplicitCAD.git
cd ImplicitCad
cabal install

All other packages work. Only ImplicitCAD is broken.

[timothy@timothy chassi]$ ghc f.hs
[1 of 1] Compiling Main             ( f.hs, f.o )
Linking f ...
/home/timothy/.cabal/lib/implicit-0.0.2/ghc-7.4.2/libHSimplicit-0.0.2.a(PolylineFormats.o): In function `sVY1_info':
(.text+0x4322): undefined reference to `implicitzm0zi0zi2_GraphicsziImplicitziExportziTextBuilderUtils_zdwbuildTruncFloat_info'
/home/timothy/.cabal/lib/implicit-0.0.2/ghc-7.4.2/libHSimplicit-0.0.2.a(PolylineFormats.o): In function `sVY2_info':
(.text+0x439a): undefined reference to `implicitzm0zi0zi2_GraphicsziImplicitziExportziTextBuilderUtils_zdwbuildTruncFloat_info'
/home/timothy/.cabal/lib/implicit-0.0.2/ghc-7.4.2/libHSimplicit-0.0.2.a(PolylineFormats.o): In function `rUUt_srt':
(.data+0x910): undefined reference to `implicitzm0zi0zi2_GraphicsziImplicitziExportziTextBuilderUtils_zdwbuildTruncFloat_closure'
collect2: error: ld returned 1 exit status

[timothy@timothy chassi]$ cat f.hs
import Graphics.Implicit
main=do
 writeSTL 0 "foo.stl" $ rect3R 0 (0,0,0) (1,1,1)
 return ()

[timothy@timothy chassi]$ ghc -v
Glasgow Haskell Compiler, Version 7.4.2, stage 2 booted by GHC version 7.4.1
Using binary package database: /usr/lib/ghc-7.4.2/package.conf.d/package.cache
Using binary package database: /home/timothy/.ghc/x86_64-linux-7.4.2/package.conf.d/package.cache
hiding package stm-2.3 to avoid conflict with later version stm-2.4
hiding package her-lexer-0.1 to avoid conflict with later version her-lexer-0.1.1
wired-in package ghc-prim mapped to ghc-prim-0.2.0.0-7d3c2c69a5e8257a04b2c679c40e2fa7
wired-in package integer-gmp mapped to integer-gmp-0.4.0.0-af3a28fdc4138858e0c7c5ecc2a64f43
wired-in package base mapped to base-4.5.1.0-6e4c9bdc36eeb9121f27ccbbcb62e3f3
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.7.0.0-2bd128e15c2d50997ec26a1eaf8b23bf
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags: -static
*** Deleting temp files:
Deleting: 
*** Deleting temp dirs:
Deleting: 
ghc: no input files
Usage: For basic information, try the `--help' option.
[timothy@timothy chassi]$ 

I know that this kind of bug report isn't very useful, as it's usually system specific :( . But you need to be aware that there are kinks.

Proposed fix:

When ld returns 1, post an error message with suggestions as to how to fix the error. So far, I've received link errors in two cases. Once, deleting the .o file fixed it. This time, I have yet to figure out a work around. Once I do, I will post the work around to this bug report.

Change History

Changed 8 months ago by timthelion

I can tell you, deleting ~/.cabal and ~/.ghc and starting over didn't help. Will try on another computer later tonight.

Changed 8 months ago by timthelion

And the link error appears to only affect the version in git, and not the version in hackage. There must be something about the package in git that is causing a problem. I don't know enough to tell you what.

Changed 8 months ago by timthelion

After working with mcstar on IRC for a few hours(He was able to confirm the bug. He is also using 7.4.2). He found the following work around for building programs with this package:

[timothy@timothy implicitCAD]$ cat implicitTest.hsimport Graphics.Implicit

main = do
 writeSTL 1 "foo.stl" $ rect3R 0 (0,0,0) (0,0,0)
 return ()
[timothy@timothy implicitCAD]$ ghc implicitTest.hs Linking implicitTest ...
/home/timothy/.cabal/lib/implicit-0.0.2/ghc-7.4.2/libHSimplicit-0.0.2.a(PolylineFormats.o): In function `sWQt_info':
(.text+0x4322): undefined reference to `implicitzm0zi0zi2_GraphicsziImplicitziExportziTextBuilderUtils_zdwbuildTruncFloat_info'
/home/timothy/.cabal/lib/implicit-0.0.2/ghc-7.4.2/libHSimplicit-0.0.2.a(PolylineFormats.o): In function `sWQu_info':
(.text+0x439a): undefined reference to `implicitzm0zi0zi2_GraphicsziImplicitziExportziTextBuilderUtils_zdwbuildTruncFloat_info'
/home/timothy/.cabal/lib/implicit-0.0.2/ghc-7.4.2/libHSimplicit-0.0.2.a(PolylineFormats.o): In function `rVMV_srt':
(.data+0x910): undefined reference to `implicitzm0zi0zi2_GraphicsziImplicitziExportziTextBuilderUtils_zdwbuildTruncFloat_closure'
collect2: error: ld returned 1 exit status
[timothy@timothy implicitCAD]$ ghc --make implicitTest.hs ~/resources/software-other/ImplicitCAD/dist/build/Graphics/Implicit/Export/TextBuilderUtils.o 
Linking implicitTest ...
[timothy@timothy implicitCAD]$ 

Changed 8 months ago by colah

  • status changed from new to closed
  • resolution set to invalid

This isn't a GHC bug but an ImplicitCAD one. It's the result of me being sloppy when merging someone's work into master: they created a file (Graphics.Implicit.Export.TextBuilderUtils?) and I forgot to add it to ImplicitCAD's cabal file. Thus cabal didn't install that module and so ImplicitCAD seems to install fine, but if you try to build something using ImplicitCAD, part of it is missing and so it fails in linking.

If you look carefully at the error messages from ld, you'll see:

implicitzm0zi0zi2_GraphicsziImplicitziExportziTextBuilderUtils_zdwbuildTruncFloat_closure
                  Graphics  Implicit  Export  TextBuilderUtils    buildTruncFloat
                  Graphics.Implicit.Export.TextBuilderUtils (buildTruncFloat)

which is the missing file and exports a function buildTruncFloat.

You don't see this if you work in the ImplicitCAD folder because it uses the local copy, so this didn't get caught earlier.

Sorry about any confusion and thanks for catching this bug!

Note: See TracTickets for help on using tickets.