Skip to content
This repository was archived by the owner on Aug 26, 2022. It is now read-only.
This repository was archived by the owner on Aug 26, 2022. It is now read-only.

Building PSharp-as-language samples fails on macOS #413

@fniksic

Description

@fniksic

I am having issues trying to build PSharp-as-language samples on macOS. Building PSharp itself works without problems by executing:

dotnet build -c Release PSharp.sln

I can then build PSharp-as-framework samples by executing:

cd Samples
dotnet build -c Release Samples.Framework.sln

However, if I try executing

dotnet build -c Release Samples.Language.sln

I get a number of error messages of the following form:

/Users/filip/PSharp/Samples/Language/build.props(3,3): error MSB4019: The imported project "/Users/filip/PSharp/bin/net46/PSharp.vs2017.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [/Users/filip/PSharp/Samples/Language/MultiPaxos/MultiPaxos.csproj]

The csproj files reference the file Samples/Language/build.props, which in turn references a non-existing file bin/net46/PSharp.vs2017.targets. As far as I understand, the file is supposed to be copied from Tools/Compilation/SyntaxRewriter/PSharp.vs2017.targets, and it's purpose is to define a build task that runs PSharpSyntaxRewriter to rewrite PSharp files into C# files. So I tried to manually copy the file. There's a number of smaller changes I had to do as well:

  • The file Samples/Language/build.props unconditionally defines net46 as the target framework. I changed this as in Samples/Framework/build.props to target netcoreapp2.1 on macOS.
  • The PSharp build process produces PSharpSyntaxRewriter for netstandard2.0, so I copied the PSharp.vs2017.targets to bin/netstandard2.0 and made the corresponding change in Samples/Language/build.props.
  • The file PSharp.vs2017.targets references the assembly file PSharpSyntaxRewriter.exe, but the build process produces PSharpSyntaxRewriter.dll on macOS, so I changed the file to reference the DLL.

Unfortunately, the build still doesn't go through. Here's the sample message I get:

/Users/filip/PSharp/bin/netstandard2.0/PSharp.vs2017.targets(4,5): error MSB4062: The "Microsoft.PSharp.Rewriter" task could not be loaded from the assembly /Users/filip/PSharp/bin/netstandard2.0/./PSharpSyntaxRewriter.dll.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [/Users/filip/PSharp/Samples/Language/MultiPaxos/MultiPaxos.csproj]

I tried to run the syntax rewriter manually just to see if I can rewrite s PSharp file. It turns out this fails as well:

$ mono bin/netstandard2.0/PSharpSyntaxRewriter.dll Samples/Language/PingPong/Server.psharp 
Assembly '/Users/filip/PSharp/bin/netstandard2.0/PSharpSyntaxRewriter.dll' doesn't have an entry point.

I guess there is some problem with the way dependencies are defined in Tools/Compilation/SyntaxRewriter/SyntaxRewriter.csproj. I will continue investigating the issue, but if someone with a better understanding of the build process knows how to quickly make this work, I would appreciate the help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions