Git Product home page Git Product logo

Comments (5)

TravisCardwell avatar TravisCardwell commented on June 21, 2024 1

We are using GHCUp to install an official binary package. There is likely a script somewhere that specifies exactly how the package is configured and built, but I have not been able to find one. Unfortunately, ghc --info does not provide the this information.

There are two official binary packages for Alpine (example: GHC 9.4.3): one using the GMP bignum implementation that we are using, and another using the Haskell-native bignum implementation. It might we worthwhile to try out the Haskell-native bignum implementation.

I do not have any special instructions for building GHC on Alpine. I would start by following the instructions in the hadrian directory and Hadrian wiki page.

from ghc-musl.

Abhiroop avatar Abhiroop commented on June 21, 2024

Now when I do ghc -O2 -optl-fuse-ld=gold -optl-static -shared -flink-rts -fPIC -o libEval.so Eval.hs hsbracket.o (not the use of the gold linker) I get

ldd libEval.so 

/lib/ld-musl-x86_64.so.1 (0x7fabb8e96000)
libgmp.so.10 => /usr/lib/libgmp.so.10 (0x7fabb82be000)
libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7fabb8e96000)

wonder is it not possible to link the remaining 3 libraries as well.

EDIT
I think I understand that the first and third dependencies are the libc interpreter

from ghc-musl.

TravisCardwell avatar TravisCardwell commented on June 21, 2024

Hi!

I have not built static libraries before. I tried your example and get the same results. I think that your second set of commands is the most promising, and the error message seems to match the following documentation in the Shared libraries that export a C API section of the GHC User's Guide:

In principle you can use -shared without -dynamic in the link step. That means to statically link the runtime system and all of the base libraries into your new shared library. This would make a very big, but standalone shared library. On most platforms however that would require all the static libraries to have been built with -fPIC so that the code is suitable to include into a shared library and we do not do that at the moment.

Perhaps it would work if crtbeginT.o and crtend.o were built with using PIC... I built a version of GCC with PIC, and it resolved the second error but not the first:

Linking libEval.so ...
/usr/bin/ld: /root/ghc-11.2.0/lib/gcc/x86_64-pc-linux-musl/11.2.0/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)

I am out of time today, but perhaps I will get a chance to try again this weekend.

from ghc-musl.

Abhiroop avatar Abhiroop commented on June 21, 2024

@TravisCardwell Thanks for looking into it.

One thing I noticed is that when building GHC if it is configured with --with-intree-gmp then libgmp gets statically linked. I wonder if the ghc-musl binary here is configured with this flag.

Also, do you have any directives or instructions on how to compile ghc with musl?

from ghc-musl.

benz0li avatar benz0li commented on June 21, 2024

@Abhiroop See also commercialhaskell/stack#3420

from ghc-musl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.