.so files in the same directory linked differently

26 views
Skip to first unread message

Tuan Vu

unread,
Jan 23, 2023, 8:32:48 PM1/23/23
to bazel-discuss
Hello,

I have 2 .so files, say a.so and b.so and I'm using cgo with bazel to invoke C functions from Go code. Using ldd to inspect the dependency of the generated binary, I got something like this.

bazel-out/k8-fastbuild-ST-4a519fd6d3e4/bin/_solib_k8/<path-to-a.so>
b.so => /usr/local/home/<username>/<repro>/<path-to-build-target>/../../../../../bazel-bin/<path-to-b.so>

The multiple ../ in the second symlink makes the second path same as
b.so => /usr/local/home/<username>/<repro>/bazel-bin/_solib_k8/<path-to-b.so>

It looks like b.so is correctly linked but not a.so although they're both in the same path in the bundle .tar.gz that is imported via cc_library. Did I do something incorrect here?

Thanks,
Tuan

David Turner

unread,
Jan 24, 2023, 7:40:27 AM1/24/23
to Tuan Vu, bazel-discuss
If the libraries are prebuilt, they would be imported / depended on by cc_import() targets, not cc_library() ones. Without more details about your BUILD.bazel file, it is hard to see what's wrong.
Do you have more info about your setup?

Thanks,
Tuan

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/278fb25f-759a-4d8f-9fe3-563cded3cbf6n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages