-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Z3 bindings don't build on .NET Core 2 without a lot of manual migration #1423
Comments
@MattWindsor91 Thanks for giving this a try and using the CMake based build system to do so. I know ".NET core" exists but I don't have any familiarity with it. That being said I'll try my best to explain some of the problems you're seeing. Looking at the steps you give it looks like you're fighting and hacking the build system rather than changing it to suit your needs. The first thing I should point out that I did leave room in the CMake based build system for ".NET core" to be supported one day. Take a look at cmake/modules/FindDotNetToolchain.cmake. This file is responsible for detecting the ".NET" toolchain. Currently it only supports the Windows ".NET" toolchain and Mono. The fact that you were able to successfully configure with What needs to be done here is to add support for detecting if ".NET core" is installed and also provide an option to pick which toolchain to use when both Mono and ".NET core" are available (as in your case).
By
This sounds like a ".NET core" specific thing. I do remember hearing about
I can't really help with this. I don't understand why you would add the
Looking at your build steps that can't really isn't going to work so well. You seem to be using a high level ".NET Core" build tool to try to build the .NET bindings but the CMake build system (and the previous Python build system) take a very low level approach and manually invoke the compiler directly.
This is deliberate. The python (old build system) made the mistake of writing generated build files into the source tree. This causes loads of problems when trying to build multiple configurations from a single source tree, so instead the CMake build system emits generated build files into the build tree and leaves the source tree untouched. The CMake build system could be taught to copy over all the Presumably it is possible to invoke ".NET Core's" C# compiler directly? If so then the approach to implement support properly into Z3's build system would be
If it is not possible to invoke ".NET Core's" C# compiler directly or there is some huge advantage to using ".NET Core"'s high level build tools then we need to take a different approach. My guess is that it would be something like this...
I'm not keen on this approach because it means we have a completely different code path for ".NET Core". I don't have time to work on this but if you have the time to work on it I'm happy to provide advise on the CMake side of things. |
@delcypher: Thank you very much for the quick response, and apologies that I don't know enough about either the Z3 build system or .NET Core to offer much in the way of constructive ideas.
To be honest, this is mostly a holdover from building against The problem in .NET Core is that there doesn't seem to be a nuget package available on macOS for Z3 (
The
I can run .NET Core's Roslyn through It's probably best if |
Oh it's a nuget package, I was missing that context.
Sorry. I completed missed that file being in Z3's source tree. @wintersteiger can tell you whether it is officially supported.
It requires the changes I roughly sketched out in my previous comment. If you're interested in working on this I can sketch this out in more detail if you like.
That is for installation of .NET dlls when using mono. It isn't essential that |
Yes, Regarding the contracts, it's nice if Core 2.0 supports that, but I doubt their usefulness, so we could discuss removal. For the CMake build, I guess it would make sense to generate a project.json file in the right directory and we can start out by simply adding a hand-crafted one in |
If you're going to build via generating a project file, don't use Personally, I'd think it makes more sense to directly invoke Rosyln's CSC, as I would expect that to fit more nicely into your existing build system. But if it makes sense to use A simple <Project Sdk="Microsoft.Net.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<AssemblyName>Microsoft.Z3</AssemblyName>
<!-- do not automatically include anything -->
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
<!-- unnecessary if default compile items are enabled -->
<Compile Include="src\**\*.cs" />
<!-- explicity add generated code -->
<Compile Include="build\src\**\*.cs" />
</ItemGroup>
</Project> Adding |
Hi, May I recommend moving to a multi-targeting
We're building a compiler and trying to leverage z3 for inference tasks. Here's a cmake module file I wrote for .NET core 2.0+ integration: https://github.com/Microsoft/GraphEngine/blob/master/cmake/FindDotnet.cmake It supports both .NET core and .NET Framework projects (we're using it for our C# and F# projects) -- you can use For example: ADD_DOTNET(Reisen.Core/Reisen.Core.fsproj
PACKAGE Reisen.Core
VERSION 0.0.1
DEPENDS GraphEngine.Core)
ADD_DOTNET(Reisen.FFI/Reisen.FFI.csproj
PACKAGE Reisen.FFI
VERSION 0.0.1
DEPENDS GraphEngine.Core Reisen.Core)
# Trinity and Reisen are our native libraries
ADD_DEPENDENCIES(BUILD_Reisen.Core Trinity Reisen) |
I've tried to build the Z3 bindings on macos 10.13 using the .NET Core SDK version 2.1.3, and run into a few problems that needed manual intervention.
The text was updated successfully, but these errors were encountered: