Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic linking failure (at runtime) with cbits dependency #151

Closed
iphydf opened this issue Feb 21, 2018 · 7 comments
Closed

Dynamic linking failure (at runtime) with cbits dependency #151

iphydf opened this issue Feb 21, 2018 · 7 comments
Assignees
Labels
P1 critical: next release type: bug

Comments

@iphydf
Copy link

iphydf commented Feb 21, 2018

https://travis-ci.org/iphydf/repro140/jobs/344336314#L740

==================== Test output for @haskell_dlist//:test:
/home/travis/.cache/bazel/_bazel_travis/62cd4b4156760703e80e26252af7b00f/bazel-sandbox/1857824427084396710/execroot/repro140/bazel-out/k8-fastbuild/bin/external/haskell_dlist/test.runfiles/repro140/external/haskell_dlist/test: error while loading shared libraries: bazel-out/k8-fastbuild/bin/external/haskell_tf_random/libexternal_Shaskell_Utf_Urandom_Scbits_libcbits.so: cannot open shared object file: No such file or directory

iphydf added a commit to iphydf/repro400 that referenced this issue Feb 21, 2018
@iphydf iphydf changed the title Linking failure with cbits dependency Dynamic linking failure (at runtime) with cbits dependency Feb 21, 2018
@iphydf
Copy link
Author

iphydf commented Feb 21, 2018

Extra info: if I make the cbits library linkstatic = 1, I get a link time error about missing a symbol from that library (Threefish_256_Process_Block).

@mrkkrp
Copy link
Member

mrkkrp commented Feb 22, 2018

I was able to reproduce it. For this to work we need to run the test executable in a modified environment setting LD_LIBRARY_PATH perhaps. I'm currently reading the docs and I don't see how this can be done.

Another difficulty is that although we know location of dynamic libraries when we link the executable, I don't see how to pass that information to whatever is in charge of running the test. Test rule should produce only ctx.outputs.executable.

It is not obvious to me how to make it work. Doesn't mean there isn't a way to do that, though.

@mboes Looks like the broken distribution story hits us even in just running the tests.

@mrkkrp
Copy link
Member

mrkkrp commented Feb 22, 2018

One particularly perverted way to make it work would be via outputting a shell script instead of executable (still need to link an executable first, of course) when we're generating a test (test = True). In that shell script we would need to set environment variables and then call the executable.

@iphydf
Copy link
Author

iphydf commented Feb 22, 2018

Generating shell scripts seems to be quite a common way for bazel rules. Java test binaries are shell scripts, as well.

@mboes
Copy link
Member

mboes commented Feb 25, 2018

Elevating priority level.

@mboes
Copy link
Member

mboes commented Feb 25, 2018

Generating scripts might well be the way forward. Before we do that though, is there any chance we could do away with setting LD_LIBRARY_PATH? If we didn't need that env var, that would solve the issue too, right?

@mrkkrp
Copy link
Member

mrkkrp commented Feb 25, 2018

I worked on this today, actually, and I have found out what works and what does not. It's 2 am here however and I'll share my findings tomorrow. Hopefully, I should also get it to work tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 critical: next release type: bug
Projects
None yet
Development

No branches or pull requests

3 participants