fsprojects / FsLexYacc

Lexer and parser generators for F#
http://fsprojects.github.io/FsLexYacc/
MIT License
203 stars 68 forks source link

Variables in supplied ".target" file seems undefined leading to compilation error #140

Open lkluc opened 3 years ago

lkluc commented 3 years ago

Description

I have the following issue :

2>------ Rebuild All started: Project: <project>, Configuration: Release x64 ------
2>      "\"  -o "Lexer.fs" --unicode Lexer.fsl
2>      '"\"' n'est pas reconnu en tant que commande interne
2>      ou externe, un programme exécutable ou un fichier de commandes.
2><projectdir>\packages\FsLexYacc.10.2.0\build\fsyacc\netcoreapp3.1\FsLexYacc.targets(36,3): error MSB3073: The command ""\"  -o "Lexer.fs" --unicode Lexer.fsl" exited with code 9009.

(I replaced my project name and directory with <> in the copied text above) (the text in french translate to :"...is not recognized as an internal or external command, executable program, or batch file.")

For the first part of the command to be "\", I suspect some variables in the file "FsLexYacc.targets" gets undefined (path and exec I guess), which seems to lead to faulty command.

I had been using the library without any problems up to date, this problem came when I migrated from version 10.0 to 10.2 of FsLexYacc.

The project is built with Visual Studio 2019, and the framework is ".NET Framework 4.6.1".

Known workarounds

None known.

Related information

Thanks in advance !

sergey-tihon commented 3 years ago

You can continue use 10.0, there were no significant changes till then. 10.1 - is compiler with .net core 3.1 and in 10.2 there was added support for .net 5-only build envy.

I see that in 10.1 were made a decision to drop .NET framework support https://github.com/fsprojects/FsLexYacc/pull/124 so package no longer contain binaries compiled for net472 and variables that you used https://github.com/fsprojects/FsLexYacc/pull/124/files#diff-db81e7e7e4970636cbf12427aead8bbdb359befca5d71f5016bc862c80ae274aL18

lkluc commented 3 years ago

Hello Sergey,

Thanks for the heads-up!

I don't want to sound rude (and I guess you were not personally implicated in this decision) but I beg to differ, I was the one which requested this change : https://github.com/fsprojects/FsLexYacc/issues/102 ...and now I'm stuck at 10.0, not able to use the patch. Although I must admit, the workaround of the enhancement works for now.

I used FsLexYacc in a tool part of a bigger toolchain of a very sizable and important project at my place. I'm not sure I can easily steer all other developers in migrating into .NET core, it implies changes from developers in my team using my library and changes in other company divisions using our engine! I'll try to see what I can do with .NET standard to interop both worlds, but I'm concern about dropping support too early of a framework still alive like this!

Do you know if dropping support for .NET Framework was really unavoidable? In other word, do you know what was the motivation behind the decision ?

Thanks!

dsyme commented 3 years ago

Do you know if dropping support for .NET Framework was really unavoidable? In other word, do you know what was the motivation behind the decision ?

Not unavoidable, but it is jsut really costly (in terms of engineering complexity) to maintain .NET Framework support, especially both Mono and .NET Framework windows testing.

lkluc commented 3 years ago

Ok, managed to recreate my project with .NET Standard 2.0. However, the problem is still there :

error MSB3073: The command ""\" -o "Lexer.fs" --unicode Lexer.fsl" exited with code 9009

The package should work under .NET Standard 2.0, right?

dsyme commented 3 years ago

Yes, though it may be failing with hidden diagnostics for whatever reasons. May be try dotnet build -v:d and check logs carefully. If it still fails maybe try to invoke fslex directly from the command line.

lkluc commented 3 years ago

It seems it worked correctly when using the provided "dotnet build" command. However my project was still not compiling from Visual Studio interface. I managed to get it work by adding these properties in the "fsproj" file :

  <PropertyGroup>
    <OutputType>Library</OutputType>
    <FsLexToolPath>..\packages\FsLexYacc.10.2.0\build\fslex\netcoreapp3.1</FsLexToolPath>
    <FsYaccToolPath>..\packages\FsLexYacc.10.2.0\build\fsyacc\netcoreapp3.1</FsYaccToolPath>
    <FsLexToolExe>fslex.dll</FsLexToolExe>
    <FsYaccToolExe>fsyacc.dll</FsYaccToolExe>
    <FsLexYaccToolRunner>dotnet </FsLexYaccToolRunner>
  </PropertyGroup>

I believe the NuGet package for 10.2.0 is not working correctly with .NET Standard 2.0 projects, maybe the problems lies in the configuration in the supplied "targets" file? ...as if those variables where undefined, or the "targets" files does not get found by the VS build system... ?