Comments (11)
Hello. The haskell_binary
call is not passing "-pie" to ghc. The BUILD file shows how to do it, but not the example in the readme. I will mention it in the readme.
from clodl.
https://github.com/tweag/clodl#usage talks about the PIE requirement, but the binary_closure section should be made consistent with this later section.
from clodl.
Hi both. Thanks very much for responding to this. So I've added -pie
(and -dynamic
and -threaded
, though those too appear to already be in the generated command line) to both my haskell_binary
and, when that failed, to the haskell_library
it depends on, to no avail. I then set about seeing if perhaps I needed to play the bootstrap
trick you are playing in this repository (in which you export a cc_library
of GHC's RTS includes and make main
a weak symbol), but before I did so thought I'd check in here to see whether or not that's an expected requirement.
from clodl.
The bootstrap bit shoudn't be necessary. At least bazel run clotestbin
doesn't use it and works in CI.
If you have a repo to share (or a gist or whatever), I could have a look.
from clodl.
I've created https://github.com/lunaris/bazel-example, which I think is a reproduction of the issue I'm seeing. It depends on a few common Haskell libraries to make sure there are a variety of cbits
etc. floating around -- you can try and build a closure using bazel build //engine:test-closure
. Many thanks!
from clodl.
Adding -rdynamic
to compiler_flags
fixes it for me. But I don't understand yet why it isn't necessary in the clodl repo.
from clodl.
Interesting. Is it perhaps that your bootstrapping stuff references main
in a way that means it is considered a "used" symbol whereas in my example that recognition is missing for some reason?
from clodl.
That would explain it for the cases where we use the bootstrap library. But it also works without it.
from clodl.
That would explain it for the cases where we use the bootstrap library. But it also works without it.
I was wrong. Linking bootstrap does have an effect here, and we are always linking bootstrap.
Linking bootstrap into hello-hs
includes main in the table of dynamic symbols:
$ nm -D bazel-bin/hello-hs | grep main
U hs_main
U __libc_start_main
00000000000024d3 T main
But if we don't link bootstrap, main is missing.
$ nm -D bazel-bin/engine/test-bin | grep main
U hs_main
U __libc_start_main
We will have to update the documentation to account for this. We either ask -rdynamic
, or -Wl,--dynamic-list=<file with a list of symbols including main>
. Also, we can test if the input binary defines main when using binary_closure and suggest in the error message one of these alternatives.
from clodl.
Thanks so much for helping out with this!
from clodl.
You're welcome. Thanks for reporting the issue and putting the testing repo together.
from clodl.
Related Issues (20)
- Apply binary fixups using patchelf HOT 1
- Option to filter out libjvm.so from output .jars HOT 2
- Move to CircleCI HOT 1
- Exclude dependencies of excluded libraries. HOT 5
- Build closures of haskell libraries
- Implement binary_closure HOT 1
- Fix cp failures in tests HOT 2
- Closures of libraries named as *.so fail to build
- Closures of binaries without runfiles fail to build
- Closure of a cc_library fails to build
- Multiple invocations of `invokeMain` cause infinite loop
- bazel 0.22 support HOT 3
- closures does not work in system without `unzip` HOT 7
- closure depends on the system linker HOT 6
- clodl fails on executables built with ghc-8.10.2 HOT 3
- zip files of closures are not reproducible HOT 1
- Add tests of haskell binaries with a haskell_library and haskell_cabal_library
- Feature Request - Get return value (other than rc) from invokeMain
- Feature Request - Allow use to provide their own `build.gradle` and Java shim.
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 clodl.