3

I'm trying to install Threadscope on Windows 8 in order to follow along the Parallel and Concurrent Programming in Haskell –book.

I successfully installed the GTK+ –bundle and subsequently tried installing threadscope through cabal. The installation terminated with the following information:

cabal: Error: some packages failed to install:
gio-0.12.5.0 failed during the building phase. The exception was:
ExitFailure 1
gtk-0.12.5.0 depends on pango-0.12.5.0 which failed to install.
pango-0.12.5.0 failed during the building phase. The exception was:
ExitFailure 1
threadscope-0.2.2 depends on pango-0.12.5.0 which failed to install.

So something was up with GIO and pango.

Looking further back what happened, the console was filled with messages like this:

Not in scope: type constructor or class `CULLong'

These messages followed when both GIO and pango were being compiled, as in:

Linking dist/setup-wrapper\setup.exe ...
Configuring gio-0.12.5.0...
Building gio-0.12.5.0...
Preprocessing library gio-0.12.5.0...
[ 1 of 24] Compiling System.GIO.Signals ( dist\build\System\GIO\Signals.hs, dist\build\System\GIO\Signals.o )
[ 2 of 24] Compiling System.GIO.Types ( dist\build\System\GIO\Types.hs, dist\build\System\GIO\Types.o )

System\GIO\Types.chs:1027:31:
    Not in scope: type constructor or class `CULLong'
    Perhaps you meant `CULong' (imported from Foreign.C.Types)

...

and,

Linking dist/setup-wrapper\setup.exe ...
Configuring pango-0.12.5.0...
Building pango-0.12.5.0...
Preprocessing library pango-0.12.5.0...
[ 1 of 14] Compiling Graphics.Rendering.Pango.Types ( dist\build\Graphics\Rendering\Pango\Types.hs, dist\build\Graphics\Rendering\Pango\Types.o )

Graphics\Rendering\Pango\Types.chs:256:29:
    Not in scope: type constructor or class `CULLong'
    Perhaps you meant `CULong' (imported from Foreign.C.Types)

...

I've tried searching hard but I can't find anything related to this. Help would be appreciated!

  • The error is pretty clear "Not in scope: type constructor or class `CULLong' Perhaps you meant `CULong' (imported from Foreign.C.Types)". I checked the module `System.GIO.Types` and it has the line `import Foreign.C.Types (CULong(..), CUInt(..))`. This module is automatically generated so whichever tool has generated this file, it isn't expecting that you will need `unsigned long long` but when c2hs runs it decides it needs `unsigned long long`. It may be a lot of work but have you tried adding `CULLong` to the imports list? – user2407038 Jan 03 '14 at 20:47
  • I haven't. How would I do that? – funky_vodka Jan 03 '14 at 21:52
  • Download the source on hackage, open the files, make the changes, install the package from those files. – user2407038 Jan 03 '14 at 22:57
  • Oh, you mean that. I haven't tried before, but I'll try to search on how to do that. If you know any good suggestions, I'd like to hear. Thanks! Edit: I went to see the System.GIO.Types module on Hackage, but it can't find the page when I go there. I can't find the module on the github repo either. What's up with that? – funky_vodka Jan 03 '14 at 23:22
  • The link is http://hackage.haskell.org/package/gio-0.12.5.0/gio-0.12.5.0.tar.gz its on the bottom of the page. There isn't much to search, you literally open each file and add `CULLong(..)` to the imports, then `cabal configure` and `cabal install` in the root dir of the package (the folder which contains the .cabal file) – user2407038 Jan 03 '14 at 23:30
  • Well now something completely weird happened — I did what you said: I extracted the tar file, navigated to the GIO-directory, opened up the System/GIO/Types.chs–file and added `CULLong(..)` to the `Foreign.C.Types` –import line. Then I ran `cabal configure` and `cabal install` in the directory with the .cabal–file as you said. But then I was met with the same errors. The weird thing is, the errors are reported from lines upwards from 1027, as in `System\GIO\Types.chs:1027:31: ...`, but **the Types.chs–file is 1025 lines in length — there are no occurences of CULLong there.** – funky_vodka Jan 03 '14 at 23:50
  • I don't know how many files will contain the same problem - possibly all of them. Are you still getting the errors for that specific file? It is shorter because it is a .chs file, it needs to be processed by c2hs (which automatically creates ffi bindings) before it is real haskell. The types that will be in the final .hs file depend on your machine - but I don't know why `long long` is being substituted for `long`. – user2407038 Jan 04 '14 at 00:05
  • Right, I'll try to come up with something. But thanks for help, I learned some useful things from you. – funky_vodka Jan 04 '14 at 00:09
  • Wish I could help more but I can't even get that far into the installation, something about missing header files. Best of luck. – user2407038 Jan 04 '14 at 01:17

1 Answers1

2

Both cabal configure and cabal install seem to revert Types.chs to the original version (missing CULLONG(..)).

It looks like you want to

cabal build
cabal register --global

Which gets you to CULLong missing from Pango. At least it's progress :-P

Adding the CULLong into Pango, we move on to a new and even more exciting error:

GraphicsRenderingPongoStructs.hsc:87:21:
    Not in scope: type constructor or class 'Word9150716308491337760'

Followed by many more similar errors. Any ideas?

Keldor
  • 21
  • 2
  • 1
    Yes, you'll notice that `Word9150716308491337760` is a multiple of 8. Looking at the problem in context, it seems that a macro defined in template-hsc-gtk2hs.h is generating these strange type names. When the type given is an integer type, it checks if it is signed or unsigned to determine the Int or Word portion of the type, and then it appends `sizeof(t) * 8`. If this were working correctly you'd get answers like say, `Int32` for a signed data type that gives a `sizeof` result of 4. As it happens, `sizeof` is instead returning results like `1143839538561417220`. – Barend Venter Mar 25 '14 at 20:11