sv2v icon indicating copy to clipboard operation
sv2v copied to clipboard

How to build on GNU/Linux on ppc64?

Open spth opened this issue 1 year ago • 8 comments

philipp@nemesis:~/sv2v-0.0.11$ LANG=C make
mkdir -p bin
stack install --install-ghc --local-bin-path bin
Error: [S-1852]
I don't know how to install GHC for (Linux,PPC64), please install manually
make: *** [Makefile:7: sv2v] Error 1
philipp@nemesis:~/sv2v-0.0.11$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.4.7

spth avatar Apr 25 '24 11:04 spth

I likely can't provide much help here because don't have access to a PowerPC machine. However, this build failure isn't specific to sv2v. Any advice you find online for installing a system GHC on PowerPC and setting it up in Stack should be applicable here too.

If you do get further along in the build, please share some pointers! There may be other users that would benefit.

zachjs avatar Apr 25 '24 12:04 zachjs

@spth could you please try cabal unpack sv2v-0.0.11 && cd sv2v-0.0.11 && cabal install --allow-newer -w ghc-9.4? This is assuming you apt-get install cabal-install ghc.

Bodigrim avatar Apr 30 '24 21:04 Bodigrim

Well, I don't have any experience with Haskell (I'm a C programmer). I've tried this variant of the above: cabal unpack sv2v-0.0.12 && cd sv2v-0.0.12 && cabal install --allow-newer -w ghc-9.4.7 but it fails before it gets to sv2v:

Failed to build os-string-2.0.2.1.
Build log (
/home/philipp/.cabal/logs/ghc-9.4.7/os-string-2.0.2.1-06e42e20ec7bc311f28ef3125b4ae8133648473a05a09693d632a831139a5ff0.log
):
Configuring library for os-string-2.0.2.1..
Preprocessing library for os-string-2.0.2.1..
Building library for os-string-2.0.2.1..
[ 1 of 10] Compiling System.OsString.Data.ByteString.Short.Internal ( System/OsString/Data/ByteString/Short/Internal.hs, dist/build/System/OsString/Data/ByteString/Short/Internal.o, dist/build/System/OsString/Data/ByteString/Short/Internal.dyn_o )

System/OsString/Data/ByteString/Short/Internal.hs:314:15: error:
    • Couldn't match type ‘Word#’ with ‘Word16#’
      Expected: Word16# -> Word16#
        Actual: Word# -> Word#
    • In the expression: byteSwap16#
      In an equation for ‘word16ToLE#’: word16ToLE# = byteSwap16#
    |
314 | word16ToLE# = byteSwap16#
    |               ^^^^^^^^^^^
Error: cabal: Failed to build os-string-2.0.2.1 (which is required by exe:sv2v
from sv2v-0.0.12). See the build log above for details.

P.S.: To me personally, the ppc64 is less important than amr64 now: My synthesis workflow is sv2v -> yosys, and yosys depends on abc, which has bugs preventing it from working on ppc64.

spth avatar May 07 '24 06:05 spth

@spth thanks for the bug report. While Haskell in principle works on any system with LLVM, it lacks testing on big-endian arches unfortunately. This is now fixed in https://github.com/haskell/os-string/pull/14, could you please cabal update and try again?

Bodigrim avatar May 09 '24 19:05 Bodigrim

It looks like this might have worked:

philipp@nemesis:/tmp/test$ cabal unpack sv2v-0.0.12 && cd sv2v-0.0.12 && cabal install --allow-newer -w ghc-9.4.7
Unpacking to sv2v-0.0.12/
Wrote tarball sdist to
/tmp/test/sv2v-0.0.12/dist-newstyle/sdist/sv2v-0.0.12.tar.gz
Resolving dependencies...
Build profile: -w ghc-9.4.7 -O1
In order, the following will be built (use -v for more details):
 - os-string-2.0.2.2 (lib) (requires download & build)
 - vector-0.13.1.0 (lib) (requires build)
 - hashable-1.4.4.0 (lib) (requires build)
 - sv2v-0.0.12 (exe:sv2v) (requires build)
Downloading  os-string-2.0.2.2
Starting     vector-0.13.1.0 (lib)
Downloaded   os-string-2.0.2.2
Starting     os-string-2.0.2.2 (lib)
Building     vector-0.13.1.0 (lib)
Building     os-string-2.0.2.2 (lib)
Installing   os-string-2.0.2.2 (lib)
Completed    os-string-2.0.2.2 (lib)
Starting     hashable-1.4.4.0 (lib)
Building     hashable-1.4.4.0 (lib)
Installing   hashable-1.4.4.0 (lib)
Completed    hashable-1.4.4.0 (lib)
Installing   vector-0.13.1.0 (lib)
Completed    vector-0.13.1.0 (lib)
Starting     sv2v-0.0.12 (exe:sv2v)
Building     sv2v-0.0.12 (exe:sv2v)
Installing   sv2v-0.0.12 (exe:sv2v)
Completed    sv2v-0.0.12 (exe:sv2v)
Symlinking 'sv2v' to '/home/philipp/.cabal/bin/sv2v'
philipp@nemesis:/tmp/test/sv2v-0.0.12$

How would I run the tests here?

spth avatar May 14 '24 10:05 spth

Please try the following:

  • Clone the full sv2v repo. The Hackage tarball doesn't include the tests, as users don't generally need to run them.
  • Make your out-of-band build of sv2v available at <clone>/bin/sv2v. The binary is statically linked.
  • Run make test. This assumes you have iverilog and python3 in your PATH.

Let me know if this works for you!

zachjs avatar May 14 '24 11:05 zachjs

I see "5 test suite(s) failed". log.gz

spth avatar May 16 '24 11:05 spth

@spth Those test failures all appear to be due to an an outdated version of iverilog, as in https://github.com/zachjs/sv2v/issues/283#issuecomment-2098264126.

It does look like you have a working build of sv2v on PPC. Thanks for the help, @Bodigrim!

zachjs avatar May 16 '24 13:05 zachjs

I am closing this and #283 as these build issues appear to be resolved. Please feel free to reopen if not. Thank you @spth, @Bodigrim, and @newAM for your help!

zachjs avatar Jun 15 '24 13:06 zachjs