Rollback of commit 50adddf01b8d7f46fba6bee12ebbb41c31c87165. *** Reason for rollback *** Makes some tests fail, oddly enough. *** Original change description *** Fixes to use dylib on MacOS X. The change in LinkCommandLine.java fixes the error "ld: library not found for -ltbb.dylib". The change in osx_gcc_wrapper.sh fixes the error "dyld: Library not loaded: @rpath/libtbb.dylib". See https://groups.google.com/forum/#!topic/bazel-discuss/bs8BnXYRjzY -- MOS_MIGRATED_REVID=101012689
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java index 27cc256..b9a4fb9 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
@@ -911,7 +911,7 @@ String name = inputArtifact.getFilename(); if (CppFileTypes.SHARED_LIBRARY.matches(name)) { - String libName = name.replaceAll("(^lib|\\.(dylib|so)$)", ""); + String libName = name.replaceAll("(^lib|\\.so$)", ""); options.add("-l" + libName); } else { // Interface shared objects have a non-standard extension
diff --git a/tools/cpp/osx_gcc_wrapper.sh b/tools/cpp/osx_gcc_wrapper.sh index d41854a..a8eb46a 100755 --- a/tools/cpp/osx_gcc_wrapper.sh +++ b/tools/cpp/osx_gcc_wrapper.sh
@@ -58,8 +58,8 @@ function get_library_path() { for libdir in ${LIB_DIRS}; do - if [ -f ${libdir}/lib$1.dylib ]; then - echo "${libdir}/lib$1.dylib" + if [ -f ${libdir}/lib$1.so ]; then + echo "${libdir}/lib$1.so" fi done } @@ -87,7 +87,7 @@ for lib in ${LIBS}; do libpath=$(get_library_path ${lib}) if [ -n "${libpath}" ]; then - ${INSTALL_NAME_TOOL} -change "@rpath/lib${lib}.dylib" $(get_otool_path "${libpath}") "${OUTPUT}" + ${INSTALL_NAME_TOOL} -change $(get_otool_path "${libpath}") "@loader_path/${RPATH}/lib${lib}.so" "${OUTPUT}" fi done fi