File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
tests/venv_site_packages_libs/ext_with_libs Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -36,14 +36,24 @@ cc_library(
3636# todo: copy more from py_extension in local_toolchains
3737cc_shared_library (
3838 name = "adder" ,
39+ # Necessary for several reasons:
40+ # 1. Ensures the output doesn't include increment itself (avoids ODRs)
41+ # 2. Adds -lincrement (DT_NEEDED for libincrement.so)
42+ # 3. Ensures libincrement.so is available at link time to satisfy (2)
3943 dynamic_deps = [":increment" ],
40- shared_lib_name = select ({
41- "//conditions:default" : "adder.so" ,
42- }),
44+ shared_lib_name = "adder.so" ,
4345 user_link_flags = [
4446 # NOTE: cc_shared_library adds Bazelized rpath entries, too.
4547 "-Wl,-rpath,$ORIGIN/libs" ,
46- ],
48+ ] + select ({
49+ "@platforms//os:osx" : [
50+ "-undefined" ,
51+ "dynamic_lookup" ,
52+ "-Wl,-exported_symbol" ,
53+ "-Wl,_PyInit_adder" ,
54+ ],
55+ "//conditions:default" : [],
56+ }),
4757 deps = [":adder_impl" ],
4858)
4959
You can’t perform that action at this time.
0 commit comments