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

Mono build is broken on OSX due to incorrect FrameworkPathOverride paths #6180

Closed
baronfel opened this issue Feb 3, 2019 · 2 comments
Closed
Labels

Comments

@baronfel
Copy link
Member

baronfel commented Feb 3, 2019

When building via msbuild or dotnet build or dotnet msbuild on an OSX system, any net4XX-targeting build fails because the FSharpBuild.Directory.Build.props hard-code mono paths that are standard on Linux, not on OSX. the meaningful lines are 45-50:

 <!-- mono -->
  <PropertyGroup Condition="'$(OS)' == 'Unix'">
    <MonoPackaging Condition="$(TargetFramework.StartsWith('net4'))">true</MonoPackaging>
    <FrameworkPathOverride Condition="'$(TargetFramework)' == 'net45'">/usr/lib/mono/4.5-api</FrameworkPathOverride>
    <FrameworkPathOverride Condition="'$(TargetFramework)' == 'net46'">/usr/lib/mono/4.6-api</FrameworkPathOverride>
  </PropertyGroup>

Repro steps

Provide the steps required to reproduce the problem

  1. Clone down latest master
  2. run dotnet build -f net462 src/fsharp/FSharp.Build/FSharp.Build.fsproj from the root directory

Expected behavior

The FSharp.Build dll is build for the net462 TFM.

Actual behavior

The FSharp.Build dll fails to build because it first builds FSharp.Core, and attempts to locate explicit references via the hard-coded /usr/lib/mono/4.5-api path. An example of the failing resolution is:

12:48:19.065  2:17>/Users/chethusk/oss/fsharp/artifacts/toolset/dotnet/sdk/2.1.500/Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/Users/chethusk/oss/fsharp/src/fsharp/FSharp.Core/FSharp.Core.fsproj]
                             For SearchPath "{TargetFrameworkDirectory}". (TaskId:115)
                             Considered "/usr/lib/mono/4.5-api/System.winmd", but it didn't exist. (TaskId:115)
                             Considered "/usr/lib/mono/4.5-api/System.dll", but it didn't exist. (TaskId:115)
                             Considered "/usr/lib/mono/4.5-api/System.exe", but it didn't exist. (TaskId:115)
                             For SearchPath "{RawFileName}". (TaskId:115)
                             Considered treating "System" as a file name, but it didn't exist. (TaskId:115)
                     Primary reference "System.Data". (TaskId:115)

Known workarounds

None, because this property replacement overrides any FrameworkPathOverride that the user may set, eg via environmetn variable.

Related information

Provide any related information

  • Operating system: OSX Mojave
  • Branch: master
  • .NET Runtime, CoreCLR or Mono Version: Mono 5.18 or 5.23, dotnet sdk 2.1.500 (as downloaded via the dotnet-install.sh script)
  • Editing Tools (e.g. Visual Studio Version): VS Code w/ Ionide
  • Indications of severity: high, this impacts the ability to merge and build on the fsharp/fsharp packaging repository.
@baronfel
Copy link
Member Author

baronfel commented Feb 3, 2019

Note that this should be able to be set on a per-OS basis by using MSBuild builtins for platform detection: dotnet/msbuild#2468 (comment)

I've tried this locally myself and haven't been successful yet. In addition, we may not want to set this value explicitly if it's possible to detect that the user has set an override already. Finally, this matrix of reference directories should be expanded to the other -api folders:
image

I'd be glad to contribute all of this, just want to raise a flag.

baronfel added a commit to baronfel/fsharp that referenced this issue Feb 3, 2019
A potential solve for dotnet#6180 that uses msbuild built-ins to determine the target OS and pivots off of that to set the FrameworkPathOverride.  I included a `MonoRoot` property to allow for easy integration into the build process that fsharp/fsharp uses, which allows for a 'floating' mono root.
baronfel added a commit to baronfel/fsharp that referenced this issue Feb 5, 2019
A potential solve for dotnet#6180 that uses msbuild built-ins to determine the target OS and pivots off of that to set the FrameworkPathOverride.  I included a `MonoRoot` property to allow for easy integration into the build process that fsharp/fsharp uses, which allows for a 'floating' mono root.
KevinRansom pushed a commit that referenced this issue Feb 13, 2019
* Update mono props: support OSX and more .NET Framework versions

A potential solve for #6180 that uses msbuild built-ins to determine the target OS and pivots off of that to set the FrameworkPathOverride.  I included a `MonoRoot` property to allow for easy integration into the build process that fsharp/fsharp uses, which allows for a 'floating' mono root.

* add osx build jobs matching the linux jobs, and add a matrix entry to build the compiler for .net framework using mono

* don't try to build anything for .net framework on non-windows

this required additional build work that may conflict with upcoming work, so we'll just settle for building the existing components on macos at all in CI
@dsyme
Copy link
Contributor

dsyme commented Aug 26, 2020

Fixed in #6181

@dsyme dsyme closed this as completed Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants