Re: compiling hugs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: compiling hugs

AntC
Hi again Sam, if you're still listening ...

WIth time on my hands during the lockdown, I had a crack at making the libraries, and hit the same error, I think.

I'm on Windows, so the build complained about not finding Ptr.dll. Indeed it wasn't created, even though there's a Ptr.c in the same directory. There's 2 other .dll's which give the same error: Alloc.dll, Error.dll; again there are .c files in the same directories.

There's other .dll's that got built OK. So seems the make isn't picking up that it needs to compile the .c to .dll. DId you manage to figure out what's going on? I tried reading what the Makefile is doing, but it's too convoluted.

To hack my way through it (this eventually worked, but it's very dodgy): I downloaded/unpacked the official Package distribution; found those .dll's in it; copied them into the place the make was looking for them; and restarted the make. There were a few other errors that I hacked through similarly; the make did eventually finish (I won't say OK ;-).

So I have a kinda working cobbled-together system.

AntC
> However, I hit this compilation error and I was hoping somebody could
help me to get past it:

cd libraries; make all
make[1]: Entering directory '/home/fommil/tmp/hugs98-plus-Sep2006/libraries'
cd ../cpphs; HUGSFLAGS=-P../libraries/bootlib HUGSDIR=../hugsdir ../src/runhugs -98
../packages/Cabal/examples/hapax.hs configure --verbose --hugs --prefix='/usr/local'
--scratchdir='../hugsdir/packages/cpphs' --with-compiler=../src/ffihugs
runhugs: Error occurred
ERROR "../libraries/bootlib/Foreign/Ptr.hs" - Error while importing DLL
"../libraries/bootlib/Foreign/Ptr.so":
../libraries/bootlib/Foreign/Ptr.so: cannot open shared object file: No such file or directory


-- 
Best regards,
Sam


_______________________________________________
Hugs-Users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/hugs-users
Reply | Threaded
Open this post in threaded view
|

Re: compiling hugs

fommil

Hi Anthony,

I indeed am still listening :-)

I had considered doing that, but I didn't want to start downloading
binaries because my entire interest in hugs is driven by a compulsion to
be able to bootstrap a Haskell compiler with nothing but a C compiler to
hand and relying on pre-built binaries is as sinful as just using a
pre-built ghc in that frame of mind.

Please do let me know if anybody can figure out how to compile the
missing library!



Anthony Clayden wrote:

> Hi again Sam, if you're still listening ...
>
> WIth time on my hands during the lockdown, I had a crack at making the
> libraries, and hit the same error, I think.
>
> I'm on Windows, so the build complained about not finding Ptr.dll. Indeed
> it wasn't created, even though there's a Ptr.c in the same directory.
> There's 2 other .dll's which give the same error: Alloc.dll, Error.dll;
> again there are .c files in the same directories.
>
> There's other .dll's that got built OK. So seems the make isn't picking up
> that it needs to compile the .c to .dll. DId you manage to figure out
> what's going on? I tried reading what the Makefile is doing, but it's too
> convoluted.
>
> To hack my way through it (this eventually worked, but it's very dodgy): I
> downloaded/unpacked the official Package distribution; found those .dll's
> in it; copied them into the place the make was looking for them; and
> restarted the make. There were a few other errors that I hacked through
> similarly; the make did eventually finish (I won't say OK ;-).
>
> So I have a kinda working cobbled-together system.
>
> AntC
>
>> However, I hit this compilation error and I was hoping somebody could
> help me to get past it:
>
> cd libraries; make all
> make[1]: Entering directory '/home/fommil/tmp/hugs98-plus-Sep2006/libraries'
> cd ../cpphs; HUGSFLAGS=-P../libraries/bootlib HUGSDIR=../hugsdir
> ../src/runhugs -98
> ../packages/Cabal/examples/hapax.hs configure --verbose --hugs
> --prefix='/usr/local'
> --scratchdir='../hugsdir/packages/cpphs' --with-compiler=../src/ffihugs
> runhugs: Error occurred
> ERROR "../libraries/bootlib/Foreign/Ptr.hs" - Error while importing DLL
> "../libraries/bootlib/Foreign/Ptr.so":
> ../libraries/bootlib/Foreign/Ptr.so: cannot open shared object file:
> No such file or directory
>
>
> --
> Best regards,
> Sam
> _______________________________________________
> Hugs-Users mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/hugs-users
--
Best regards,
Sam


_______________________________________________
Hugs-Users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/hugs-users

signature.asc (199 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: compiling hugs

AntC
In reply to this post by AntC
Hi Sam, I have some good news, but mostly bad news.
> > Please do let me know if anybody can figure out how to compile the
> missing library!
To answer your last point first, Franklin Chen figured out how to compile the library
-- it's a two-line fix, that gets three .dlls to compile.
See around line 220 in here: 
also see the git change history for that header file.

One piece of bad news is you can't simply apply that patch and continue the make:
the make had already got three compile fails: Ptr.dll, Alloc.dll, Error.dll.
So the error you report is somewhat later when something tries to grab
Ptr.dll and it isn't there.
You'd need to compile those three by hand, then restart the make.
Given your goals, I think you'd do better to blow away what you have,
unzip from the distro and start again. But wait!

There are heaps more patches that Franklin applied, including some to other header files
that are very similar to the fix to HsBase.h. So I'm nowhere near getting the make to finish.

Furthermore I'm getting tripped up by bits of earlier installs hanging around.
On Windows, Hugs holds stuff in Registry HKEY_CURRENT_USER.
My attempted make keeps picking up directory names from there, then getting banjaxed.

I haven't looked at the Mac install process to see if you'd run into that.

I had considered doing that [grabbibg binaries from elsewhere],
> but I didn't want to start downloading
> binaries because my entire interest in hugs is driven by a compulsion to
be able to bootstrap a Haskell compiler with nothing but a C compiler to
> hand and relying on pre-built binaries is as sinful as just using a
pre-built ghc in that frame of mind.
Well the make uses a great variety of tools, not just gcc,
and including sed, grep and perl (I think).

If you're worried about provenance,take a look in the top-level Makefile.
It accesses two repos over the interwebs and seems to download stuff from them 
using 'darcs get'.
Clearly a vector to introduce malware.
(Not that I'm suggesting anybody's malicious, probably those repos are dead;
Joachim was particularly anxious to avoid any chance of Trojans getting into the build.)

Please do have another crack. It'll be handy if you can turn up more fails.

AntC

_______________________________________________
Hugs-Users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/hugs-users
Reply | Threaded
Open this post in threaded view
|

Re: compiling hugs

AntC
In reply to this post by AntC
The news is improving, I have a working system (on Windows, including WinHugs).

Not all of the libraries compiled, and some are bitrotted beyond repair.

But I think there's enough for your objective of using Hugs to bootstrap GHC.

In particular, you'll need to get working a couple of preprocessors:

* hsc2hs -- HSC format is a hybrid Haskell/C; pre-processed to .hs + .c + .h
* cpphs -- "a simplified re-implementation" of C++ pre-processor, in Haskell.

They're both used extensively in the `make` building libraries/packages.

Both of those need a bit of polishing-up, see Franklin's repo. (He was also working on Mac, did you see his homebrew kit?)

For the sake of posterity I'll post some notes here with the travails of getting Hugs up and running.
Some of the code is very ancient -- pre the C 1999 standard.

AntC

Hi Sam, I have some good news, but mostly bad news.
>
> Please do let me know if anybody can figure out how to compile the > missing library!
>To answer your last point first, Franklin Chen figured out how to compile the library -- it's a two-line fix, that gets three .dlls to compile. See around line 220 in here:
https://github.com/FranklinChen/hugs98-plus-Sep2006/blob/master/packages/base/include/HsBase.h
; also see the git change history for that header file.


_______________________________________________
Hugs-Users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/hugs-users