Opened 8 years ago

Closed 8 years ago

#5399 closed bug (fixed)

GHC 7.0.3 produces corrupt .hi files for qtHaskell

Reported by: ian.duncan Owned by:
Priority: normal Milestone: 7.4.1
Component: Compiler Version: 7.0.4
Keywords: Cc:
Operating System: MacOS X Architecture: x86
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonpj)

I installed qtHaskell 1.1.4 by installing Qt 4.7.3 through brew. I ran ./build --enable-shared for qtHaskell, which failed after compiling and installing all of the C bindings. I then ran cabal install --disable-library-for-ghci, per http://hackage.haskell.org/trac/hackage/ticket/791 .

I can successfully build, but I get the following warnings:

[1 of 1] Compiling Main             ( Main.hs, dist/build/qtTest/qtTest-tmp/Main.o )
/Users/ian/Library/Haskell/ghc-7.0.3/lib/qt-1.1.4/lib/Qtc/Gui/QWidget.hi
Declaration for $wa227
Unfolding of Qtc.Gui.QWidget.$wa227
Unfolding of eta:
  Iface id out of scope:  qtc_QWidget_setWindowTitle
/Users/ian/Library/Haskell/ghc-7.0.3/lib/qt-1.1.4/lib/Qtc/Gui/QLabel.hi
Declaration for $wa141
Unfolding of Qtc.Gui.QLabel.$wa141
Unfolding of eta:
  Iface id out of scope:  qtc_QLabel_setText

When I run the compiled program, labels do not show up properly, and I'm pretty sure that it's due to these issues.

Attachments (1)

compilerbug.hs (1.3 KB) - added by ian.duncan 8 years ago.
File for reproducing issue.

Download all attachments as: .zip

Change History (10)

Changed 8 years ago by ian.duncan

Attachment: compilerbug.hs added

File for reproducing issue.

comment:1 Changed 8 years ago by ian.duncan

Here are some relevant warnings (errors?) from building qtHaskell:

[651 of 662] Compiling Qtc.Core.Attributes ( Qtc/Core/Attributes.hs, dist/build/Qtc/Core/Attributes.p_o )
The interface for `qt-1.1.4:Qtc.Gui.QAbstractButton'
Declaration for $wa147
Unfolding of Qtc.Gui.QAbstractButton.$wa147
Unfolding of eta:
  Iface id out of scope:  qtc_QAbstractButton_setText
The interface for `qt-1.1.4:Qtc.Core.QSettings'
Declaration for $wa45
Unfolding of Qtc.Core.QSettings.$wa45
Unfolding of eta:
  Iface id out of scope:  qtc_QSettings_value
[652 of 662] Compiling Qtc.Core         ( Qtc/Core.hs, dist/build/Qtc/Core.p_o )
[653 of 662] Compiling Qtc.Tools.QUiLoader_h ( Qtc/Tools/QUiLoader_h.hs, dist/build/Qtc/Tools/QUiLoader_h.p_o )
[654 of 662] Compiling Qtc.Tools        ( Qtc/Tools.hs, dist/build/Qtc/Tools.p_o )
[655 of 662] Compiling Qth.Core.Line    ( Qth/Core/Line.hs, dist/build/Qth/Core/Line.p_o )
[656 of 662] Compiling Qth.Core         ( Qth/Core.hs, dist/build/Qth/Core.p_o )
[657 of 662] Compiling Qt.Arthur.Style  ( Qt/Arthur/Style.hs, dist/build/Qt/Arthur/Style.p_o )
The interface for `qt-1.1.4:Qtc.Gui.QFontMetrics'
Declaration for $wa40
Unfolding of Qtc.Gui.QFontMetrics.$wa40
Unfolding of eta:
  Iface id out of scope:  qtc_QFontMetrics_width1
[658 of 662] Compiling Qt.Arthur.Frame  ( Qt/Arthur/Frame.hs, dist/build/Qt/Arthur/Frame.p_o )
The interface for `qt-1.1.4:Qtc.Core.Base'
Declaration for $wa6
Unfolding of Qtc.Core.Base.$wa6
Unfolding of eta:
  Iface id out of scope:  qtc_emitSignal_bool
The interface for `qt-1.1.4:Qtc.Gui.QTextDocument'
Declaration for $wa54
Unfolding of Qtc.Gui.QTextDocument.$wa54
Unfolding of eta:
  Iface id out of scope:  qtc_QTextDocument_setHtml
The interface for `qt-1.1.4:Qtc.Gui.QTextEdit'
Declaration for $wa168
Unfolding of Qtc.Gui.QTextEdit.$wa168
Unfolding of eta:
  Iface id out of scope:  qtc_QTextEdit_setHtml

comment:2 Changed 8 years ago by simonpj

Description: modified (diff)

This is all very odd. Can you give from-scratch instructions for how to reproduce your problem? I fell at the first fence

bash$ cabal update
Downloading the latest package list from hackage.haskell.org
simonpj@cam-04-unx:~/tmp$ cabal unpack qt-1.1.4
cabal: There is no package named 'qt'.
You may need to run 'cabal update' to get the latest list of available
packages.

Also I don't have MacOS -- which may mean I can't run your program, but I hope I can still compile it.

comment:3 Changed 8 years ago by ian.duncan

Version: 7.0.37.0.4

You'll need to have Qt installed, which you can find here: http://qt.nokia.com/products/platform/qt-for-windows/ You can find qtHaskell here: http://qthaskell.berlios.de/

In the qtHaskell-1.1.4 directory, I ran ./build and after building the necessary C libs, the build script errored out due to cabal not supporting the --make flag anymore for compiling Haskell code. According to the online qtHaskell documentation, at this point it was safe to run cabal install as an alternative, which I did, and which produced the issues mentioned above.

If you can get qtHaskell to compile, there shouldn't be any reason why the attached program won't run for you. Also, I've since the initial bug report verified that the problem exists on both x86 & x86_64 OS X platforms. I'm not sure about other systems.

comment:4 Changed 8 years ago by simonpj

OK, I did the following on my Windows machine

Then I tried to build:

cabal install --extra-lib-dirs=c:/fp/QtSDK/mingw/lib --extra-lib-dirs=c:/fp/QtSDK/mingw/include
Resolving dependencies...
Configuring qt-1.1.4...
cabal.exe: Missing dependencies on foreign libraries:
* Missing C libraries: qtc_core, qtc_gui, qtc_network, qtc_opengl, qtc_tools,
qtc_script
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
cabal.exe: Error: some packages failed to install:
qt-1.1.4 failed during the configure step. The exception was:
ExitFailure 1

I gave it the --extra-lib-dirs flag so that it could find the Qt installation. However this did not work. So I'm stuck on reproducing. If you can give a sequence of commands to reproduce, I'll gladly execute them!

Simon

PS: a verbose run of the same attempt is below

bash$ cd qtHaskell-1.1.4
bash$ cabal install -v --extra-lib-dirs=c:/fp/QtSDK/mingw/lib --extra-lib-dirs=c:/fp/QtSDK/mingw/include
c:\fp\HP-2010.2.0.0\bin\ghc.exe --numeric-version
looking for package tool: ghc-pkg near compiler in c:\fp\HP-2010.2.0.0\bin
found package tool in c:\fp\HP-2010.2.0.0\bin\ghc-pkg.exe
c:\fp\HP-2010.2.0.0\bin\ghc-pkg.exe --version
c:\fp\HP-2010.2.0.0\bin\ghc.exe --supported-languages
Reading installed packages...
c:\fp\HP-2010.2.0.0\bin\ghc-pkg.exe dump --global
c:\fp\HP-2010.2.0.0\bin\ghc-pkg.exe dump --user
c:\fp\HP-2010.2.0.0\bin\ghc.exe --print-libdir
Reading available packages...
Resolving dependencies...
selecting qt-1.1.4 (hackage)
selecting haskell98-1.0.1.1 (installed or hackage) and discarding
haskell98-1.0, 1.0.1.0, 1.1.0.0 and 1.1.0.1
selecting random-1.0.0.2 (installed or hackage) and discarding random-1.0.0.0,
1.0.0.1 and 1.0.0.3
selecting time-1.1.4 (installed or hackage) and discarding time-1.0, 1.1.2.0,
1.1.2.1, 1.1.2.2, 1.1.2.3, 1.1.2.4, 1.1.3, 1.2, 1.2.0.1, 1.2.0.2, 1.2.0.3,
1.2.0.4 and 1.2.0.5
selecting process-1.0.1.3 (installed or hackage) and discarding
directory-1.1.0.0, filepath-1.0, process-1.0.0.0, 1.0.1.1, 1.0.1.2, 1.0.1.4
and 1.0.1.5
selecting directory-1.0.1.1 (installed or hackage) and discarding
directory-1.0.0.0, 1.0.0.3, 1.0.1.0, 1.0.1.2 and filepath-1.2.0.0
selecting old-time-1.0.0.5 (installed or hackage) and discarding
old-time-1.0.0.0, 1.0.0.2, 1.0.0.3, 1.0.0.4 and 1.0.0.6
selecting old-locale-1.0.0.2 (installed or hackage) and discarding
old-locale-1.0.0.0 and 1.0.0.1
selecting filepath-1.1.0.4 (installed or hackage) and discarding
filepath-1.1.0.0, 1.1.0.1, 1.1.0.2 and 1.1.0.3
selecting Win32-2.2.0.2 (installed or hackage) and discarding Win32-2.1,
2.1.0.0, 2.2.0.0 and 2.2.0.1
selecting bytestring-0.9.1.7 (installed or hackage) and discarding
bytestring-0.9, 0.9.0.1, 0.9.0.2, 0.9.0.3, 0.9.0.4, 0.9.1.0, 0.9.1.1, 0.9.1.2,
0.9.1.3, 0.9.1.4, 0.9.1.5, 0.9.1.6, 0.9.1.8, 0.9.1.9 and 0.9.1.10
selecting ghc-prim-0.2.0.0 (installed)
selecting ffi-1.0 (installed)
selecting rts-1.0 (installed)
selecting array-0.3.0.1 (installed or hackage) and discarding array-0.1.0.0,
0.2.0.0, 0.3.0.0 and 0.3.0.2
selecting OpenGL-2.2.3.0 (installed or hackage) and discarding OpenGL-2.1,
2.2.1.1, 2.2.2.0, 2.3.0.0, 2.4.0.0 and 2.4.0.1
selecting base-3.0.3.2 (installed) and 4.2.0.2 (installed) and discarding
syb-0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.2, 0.2.1, 0.2.2, 0.3, 0.3.1 and
0.3.2
selecting integer-gmp-0.2.0.1 (installed)
selecting syb-0.1.0.2 (installed)
In order, the following would be installed:
qt-1.1.4 (new package)
Configuring qt-1.1.4...
Dependency OpenGL ==2.2.3.0: using OpenGL-2.2.3.0
Dependency base ==3.0.3.2: using base-3.0.3.2
Dependency haskell98 ==1.0.1.1: using haskell98-1.0.1.1
Using Cabal-1.8.0.4 compiled by ghc-6.10
Using compiler: ghc-6.12.3
Using install prefix: C:\Users\simonpj\AppData\Roaming\cabal
Binaries installed in: C:\Users\simonpj\AppData\Roaming\cabal\bin
Libraries installed in:
C:\Users\simonpj\AppData\Roaming\cabal\qt-1.1.4\ghc-6.12.3
Private binaries installed in: C:\Users\simonpj\AppData\Roaming\cabal\qt-1.1.4
Data files installed in: C:\Users\simonpj\AppData\Roaming\cabal\qt-1.1.4
Documentation installed in:
C:\Users\simonpj\AppData\Roaming\cabal\doc\qt-1.1.4
Using alex version 2.2 found on system at: c:\fp\alex-2.2\alex.exe
Using ar found on system at: c:\fp\HP-2010.2.0.0\mingw\bin\ar.exe
No c2hs found
No cpphs found
No ffihugs found
Using gcc version 3.4.5 found on system at:
c:\fp\HP-2010.2.0.0\mingw\bin\gcc.exe
Using ghc version 6.12.3 found on system at: c:\fp\HP-2010.2.0.0\bin\ghc.exe
Using ghc-pkg version 6.12.3 found on system at:
c:\fp\HP-2010.2.0.0\bin\ghc-pkg.exe
No greencard found
Using haddock version 2.6.1 found on system at:
c:\fp\HP-2010.2.0.0\bin\haddock.exe
Using happy version 1.17 found on system at: c:\fp\happy-1.17\happy.exe
No hmake found
Using hsc2hs version 0.67 found on system at:
c:\fp\HP-2010.2.0.0\bin\hsc2hs.exe
No hscolour found
No hugs found
No jhc found
Using ld found on system at: c:\fp\HP-2010.2.0.0\mingw\bin\ld.exe
No lhc found
No lhc-pkg found
No nhc98 found
No pkg-config found
No ranlib found
No strip found
Using tar found on system at: c:\msys\1.0\bin\tar.exe
cabal.exe: Missing dependencies on foreign libraries:
* Missing C libraries: qtc_core, qtc_gui, qtc_network, qtc_opengl, qtc_tools,
qtc_script
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
cabal.exe: Error: some packages failed to install:
qt-1.1.4 failed during the configure step. The exception was:
ExitFailure 1
bash-3.1$ 

comment:5 Changed 8 years ago by simonmar

I think I managed to get to the stage of building the Haskell code under Linux a week or so ago. Simon - let's look at this when you have time.

comment:6 Changed 8 years ago by simonmar

I didn't get as far as module 657, there was a type error at 651:

[651 of 662] Compiling Qtc.Core.Attributes ( Qtc/Core/Attributes.hs, dist/build/Qtc/Core/Attributes.o )

Qtc/Core/Attributes.hs:583:13:
    Could not deduce (Qstt a (QDialogSc b))
      arising from a use of `slotReject''
    from the context (Qstt a (QDialogSc b1))
      bound by the instance declaration
      at Qtc/Core/Attributes.hs:581:10-52
    Possible fix:
      add (Qstt a (QDialogSc b)) to the context of
        the instance declaration
      or add an instance declaration for (Qstt a (QDialogSc b))
    In the expression: slotReject'
    In an equation for `reject'': reject' = slotReject'
    In the instance declaration for `QsaSlotReject a'

any ideas?

BTW, it is unlikely that the "Iface Id out of scope" warnings would give rise to any runtime problems, because they simply prevent an unfolding from being used by the optimiser, which should not change behaviour. I strongly suspect that the problem you have with labels not showing up properly is due to something else. Nevertheless these warnings should not happen, so we'd like to track down the cause.

comment:7 Changed 8 years ago by simonmar

Incedentally, I had to restart the compilation at one point because the GHC process had grown to around 6Gb and was crawling. We clearly have some space leaks in --make.

comment:8 Changed 8 years ago by simonmar

Milestone: 7.4.1
Status: newinfoneeded

Simon and I managed to reproduce the warnings. In order to get past the type error we made the following change:

diff -c /home/simonmar/scratch/qtHaskell-1.1.4/Qtc/Core/Attributes.hs\~ /home/simonmar/scratch/qtHaskell-1.1.4/Qtc/Core/Attributes.hs
*** /home/simonmar/scratch/qtHaskell-1.1.4/Qtc/Core/Attributes.hs~	2010-09-02 17:02:32.000000000 +0100
--- /home/simonmar/scratch/qtHaskell-1.1.4/Qtc/Core/Attributes.hs	2011-09-07 11:19:56.000000000 +0100
***************
*** 580,586 ****
  
  instance (Qstt a (QDialogSc b)) => QsaSlotReject (a) where
    slotReject' = (Qslot "reject()", \_ -> ())
!   reject' = slotReject'
  
  class QsaSignalRejected_nt_f w x f where
    signalRejected', rejected' :: x -> SltConf w f
--- 580,586 ----
  
  instance (Qstt a (QDialogSc b)) => QsaSlotReject (a) where
    slotReject' = (Qslot "reject()", \_ -> ())
!   reject' = (Qslot "reject()", \_ -> ())
  
  class QsaSignalRejected_nt_f w x f where
    signalRejected', rejected' :: x -> SltConf w f

We believe that the warnings are related to #5263, which was fixed in 7.2.1. Could you try with 7.2.1 or later please?

comment:9 Changed 8 years ago by igloo

difficulty: Unknown
Resolution: fixed
Status: infoneededclosed

No response from submitter, so closing. Please reopen if you think it's still broken in 7.4 or later.

Note: See TracTickets for help on using tickets.