Guvante
Guvante

Reputation: 19203

Error building GHC on Windows

While attempting to bootstrap Haskell on Windows without the Haskell Platform I ran into the following error

C:\git\Haskell\ghc\libraries\haskeline\dist-install\build/libHShaskeline-0.7.1.2.a: could not read symbols: Archive has no index; run ranlib to add one

Note that C:\git\Haskell\ghc is where I put the ghc git repo.

However whenever I looked at the file it appeared to be building correctly.

I have attempted completely clean rebuilds, and deleting the whole repo and regetting it, everything short of deleting anything related to this build and starting fresh.

Upvotes: 3

Views: 165

Answers (1)

Guvante
Guvante

Reputation: 19203

I eventually figured out what was causing the issue, I realized it when I found the following notice on the Windows Platform notes for GHC.

However, the makefiles do use whatever ld and ar happen to be in your path.

This didn't seem right, and reading the configure script I noticed the following lines:

mingwbin="$hardtop/inplace/mingw/bin/"
LD="${mingwbin}ld.exe"

Note that mingwbin refers to the location that the tarballs are extracted to. Looking at the timestamps of the executables did not match up to the version that which ld returned (in /mingw/bin).

Given the note that meant that at some point /inplace/mingw/bin/ld.exe was being used while at another point /mingw/bin/ld.exe was being used, possibly causing the issue.

Running the following command before make resolved the issue.

export PATH=/c/git/Haskell/git/inplace/mingw/bin:$PATH

Upvotes: 5

Related Questions