diff --git a/eng/helix.proj b/eng/helix.proj index effc0c5e3d..f7fb259148 100644 --- a/eng/helix.proj +++ b/eng/helix.proj @@ -104,7 +104,7 @@ $(HelixPreCommands);export PATH=$HELIX_CORRELATION_PAYLOAD/$(DotNetCliDestination):$PATH $(HelixPreCommands);set PATH=%HELIX_CORRELATION_PAYLOAD%\$(DotNetCliDestination)%3B%PATH% - $(HelixPreCommands);export LD_LIBRARY_PATH=/opt/homebrew/opt/mono-libgdiplus/lib;ls /usr/lib;ls $HELIX_WORKITEM_ROOT + $(HelixPreCommands);export LD_LIBRARY_PATH=/opt/homebrew/opt/mono-libgdiplus/lib;ls /usr/lib;ls $HELIX_WORKITEM_ROOT;export KMP_DUPLICATE_LIB_OK=TRUE;export DYLD_PRINT_LIBRARIES=1;otool -L $HELIX_WORKITEM_ROOT/runtimes/osx-x64/native/lib_lightgbm.dylib $(HelixPreCommands);sudo apt update;sudo apt-get install libomp-dev libomp5 -y @@ -128,7 +128,7 @@ Command="install_name_tool -change "/usr/local/opt/libomp/lib/libomp.dylib" "@loader_path/libomp.dylib" $(BUILD_SOURCESDIRECTORY)/artifacts/bin/%(ProjectsWithTargetFramework.Filename)/$(BuildConfig)/%(ProjectsWithTargetFramework.TargetFrameworks)$(PublishFolder)/libSymSgdNative.dylib" /> + Command="install_name_tool -change "/usr/local/opt/libomp/lib/libomp.dylib" "@rpath/libomp.dylib" $(BUILD_SOURCESDIRECTORY)/artifacts/bin/%(ProjectsWithTargetFramework.Filename)/$(BuildConfig)/%(ProjectsWithTargetFramework.TargetFrameworks)$(PublishFolder)/runtimes/osx-x64/native/lib_lightgbm.dylib" /> diff --git a/test/Microsoft.ML.TestFrameworkCommon/Attributes/NativeDependencyFactAttribute.cs b/test/Microsoft.ML.TestFrameworkCommon/Attributes/NativeDependencyFactAttribute.cs index 29bd0baa17..f40f8e1be2 100644 --- a/test/Microsoft.ML.TestFrameworkCommon/Attributes/NativeDependencyFactAttribute.cs +++ b/test/Microsoft.ML.TestFrameworkCommon/Attributes/NativeDependencyFactAttribute.cs @@ -19,6 +19,9 @@ public NativeDependencyFactAttribute(string library) : base($"This test requires /// protected override bool IsEnvironmentSupported() { + // Starting to drop native support for X64 OSX since intel no longer makes them. + if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX) && System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture == System.Runtime.InteropServices.Architecture.X64) + return false; return NativeLibrary.NativeLibraryExists(_library); } } diff --git a/test/Microsoft.ML.TestFrameworkCommon/Attributes/NativeDependencyTheoryAttribute.cs b/test/Microsoft.ML.TestFrameworkCommon/Attributes/NativeDependencyTheoryAttribute.cs index 444e17b5e6..1f4e1e6b1a 100644 --- a/test/Microsoft.ML.TestFrameworkCommon/Attributes/NativeDependencyTheoryAttribute.cs +++ b/test/Microsoft.ML.TestFrameworkCommon/Attributes/NativeDependencyTheoryAttribute.cs @@ -19,6 +19,9 @@ public NativeDependencyTheoryAttribute(string library) : base($"This test requir /// protected override bool IsEnvironmentSupported() { + // Starting to drop native support for X64 OSX since intel no longer makes them. + if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX) && System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture == System.Runtime.InteropServices.Architecture.X64) + return false; return NativeLibrary.NativeLibraryExists(_library); } } diff --git a/test/Microsoft.ML.TestFrameworkCommon/Utility/NativeLibrary.cs b/test/Microsoft.ML.TestFrameworkCommon/Utility/NativeLibrary.cs index 7cb1a73ef7..92eb50743f 100644 --- a/test/Microsoft.ML.TestFrameworkCommon/Utility/NativeLibrary.cs +++ b/test/Microsoft.ML.TestFrameworkCommon/Utility/NativeLibrary.cs @@ -19,7 +19,7 @@ public static bool NativeLibraryExists(string name) string extension = default; string prefix = "lib"; - if (Environment.OSVersion.Platform == PlatformID.MacOSX) + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) extension = ".dylib"; else if (Environment.OSVersion.Platform == PlatformID.Unix) extension = ".so"; @@ -43,7 +43,17 @@ public static bool NativeLibraryExists(string name) } catch { - return false; + // If that didn't load, dispose of the first attempt and try appending lib_ in front + try + { + nativeLibrary?.Dispose(); + nativeLibrary = new NativeLibrary(prefix + "_" + name + extension); + return true; + } + catch + { + return false; + } } } finally diff --git a/test/Microsoft.ML.TestFrameworkCommon/Utility/PathResolver.cs b/test/Microsoft.ML.TestFrameworkCommon/Utility/PathResolver.cs index fb717075c8..d56ab680e8 100644 --- a/test/Microsoft.ML.TestFrameworkCommon/Utility/PathResolver.cs +++ b/test/Microsoft.ML.TestFrameworkCommon/Utility/PathResolver.cs @@ -69,6 +69,10 @@ private bool TryLocateNativeAssetFromDeps(string name, out string appLocalNative List allRIDs = new List(); allRIDs.Add(currentRID); + if (currentRID.Contains("arm64")) + { + allRIDs.Add("osx-arm64"); + } if (!AddFallbacks(allRIDs, currentRID, defaultContext.RuntimeGraph)) { #pragma warning disable MSML_ParameterLocalVarName // Parameter or local variable name not standard