Comments (5)
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.
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.
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.
@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.
@Abhiroop See also commercialhaskell/stack#3420
from ghc-musl.
Related Issues (20)
- Building with stack fails with "Executable named groupadd not found on path" error HOT 2
- Add sdl2 and sdl2-ttf to the docker images? HOT 48
- build postgrest failed with error message setup: The program 'pg_config' is required but it could not be found HOT 9
- Failed with integer-gmp HOT 3
- Update image to GHC 9.0.2 HOT 8
- Linker problem building a `monomer` app HOT 2
- Alpine package upgrades HOT 12
- Earthfile suggestions HOT 5
- Would you be so kind as to include stack? HOT 6
- Build wai-app-static failed with Segfaults HOT 3
- Docker image with GHC 9.2.5 HOT 2
- Affected by binutils bug 23856 HOT 1
- Cannot build 'summoner-tui' HOT 11
- Error encountered while installing GHC HOT 2
- Segfault during configuring HOT 8
- The `--ghc-options` for `stack build` were not recognized correctly. HOT 1
- SSL certificates HOT 19
- adding pcre HOT 2
- add bz2 & openssl HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ghc-musl.