[GF] Unable to install GF with C runtime support on Windows

62 views
Skip to first unread message

Alice Oliveira

unread,
Sep 30, 2020, 12:37:43 PM9/30/20
to gf-...@googlegroups.com

Hello!


I'm working on a project and need to use the C# binding to the C runtime on Windows, but I'm having trouble installing the C Runtime/GF with C runtime support.I was able to install it on Ubuntu 18.04 with no problems by following the steps in the Developer's Guide (http://www.grammaticalframework.org/doc/gf-developers.html#toc16). Now, I'm trying to do the same on Windows, but I could not succeed.

I installed the C runtime system, but when I try to install GF using cabal install -fserver -fc-runtime, I face the following error:

C:\Users\Alice\AppData\Local\Temp\cabal-install.-4980\dist-newstyle\tmp\src-4980\gf-3.10.4\dist\setup\setup.hs:9:1:

error:

Could not find module `WebSetup'

Use -v (or `:set -v` in ghci) to see a list of the files searched for.

|

9 | import WebSetup

| ^^^^^^^^^^^^^^^

)


And my workmate is having trouble installing the C runtime (following the gf-core/src/runtime/c/INSTALL file). When he runs the command “make”, the following error occurs:


  CCLD   libpgf.la

/bin/sed: can't read Santiago/Documents/GitHub/gf-core/src/runtime/c/libgu.la: No such file or directory

libtool: link: `Santiago/Documents/GitHub/gf-core/src/runtime/c/libgu.la' is not a valid libtool archive

make[1]: *** [libpgf.la] Error 1

make[1]: Leaving directory `/c/Users/Williams Santiago/Documents/GitHub/gf-core/src/runtime/c'

make: *** [all] Error 2


Could someone help us? Is there any other step-by-step tutorial that we can follow to succeed the installation? 


Any help is appreciated. :)

Thank you!

Inari Listenmaa

unread,
Sep 30, 2020, 12:53:52 PM9/30/20
to gf-...@googlegroups.com
Hi Alice!

I don't have Windows machine, so apologies beforehand if this advice isn't helpful.

I installed the C runtime system, but when I try to install GF using cabal install -fserver -fc-runtime, I face the following error:

You actually don't need to have GF installed with the c-runtime. If I remember correctly, you'd get from that only the benefit of using gf with the -cshell flag. (In c-shell, the only benefit you get is that you can parse stuff that uses BIND tokens -- if you're curious, read here https://inariksit.github.io/gf/2019/01/26/literals-2.html#bind-token-and-the-different-runtimes , but otherwise just ignore this whole remark in parentheses.)

So my suggestion is to skip the step (cabal install -fserver -fc-runtime), and just go on to installing the C# bindings. The C# bindings should work with a PGF compiled by just the regular GF executable, no need for that GF to have been compiled with C-runtime support.


And my workmate is having trouble installing the C runtime (following the gf-core/src/runtime/c/INSTALL file). When he runs the command “make”, the following error occurs:

  CCLD   libpgf.la
/bin/sed: can't read Santiago/Documents/GitHub/gf-core/src/runtime/c/libgu.la: No such file or directory
libtool: link: `Santiago/Documents/GitHub/gf-core/src/runtime/c/libgu.la' is not a valid libtool archive
make[1]: *** [libpgf.la] Error 1
make[1]: Leaving directory `/c/Users/Williams Santiago/Documents/GitHub/gf-core/src/runtime/c'
make: *** [all] Error 2

Could someone help us? Is there any other step-by-step tutorial that we can follow to succeed the installation? 

You said that you succeeded in installing the C runtime. Are you two doing the same steps?

The Makefile https://github.com/GrammaticalFramework/gf-core/blob/master/Makefile contains cabal commands, so maybe he needs to run them manually and add the flag(s) --extra-include-dirs=/path/to/include and/or --extra-lib-dirs=/path/to/lib to an appropriate place.

Do report back if these suggestions don't help!

Inari

Alice Oliveira

unread,
Oct 1, 2020, 2:27:41 PM10/1/20
to gf-...@googlegroups.com
Hi Inari,

You actually don't need to have GF installed with the c-runtime. If I remember correctly, you'd get from that only the benefit of using gf with the -cshell flag. (In c-shell, the only benefit you get is that you can parse stuff that uses BIND tokens -- if you're curious, read here https://inariksit.github.io/gf/2019/01/26/literals-2.html#bind-token-and-the-different-runtimes , but otherwise just ignore this whole remark in parentheses.)


I didn't know that, thank you!
 
So my suggestion is to skip the step (cabal install -fserver -fc-runtime), and just go on to installing the C# bindings. The C# bindings should work with a PGF compiled by just the regular GF executable, no need for that GF to have been compiled with C-runtime support.

We tried to do that the same way we did on Ubuntu. We built the PGFSharp.dll and added a reference to it in the C# project. But we are still getting an error:

Exception thrown: 'System.DllNotFoundException' in PGFSharp.dll
An unhandled exception of type 'System.DllNotFoundException' occurred in PGFSharp.dll
Unable to load DLL 'gu.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)

Should I do something different on Windows, is there an extra step to get it working? Or maybe this is caused by some error in the C runtime installation?


And my workmate is having trouble installing the C runtime (following the gf-core/src/runtime/c/INSTALL file). When he runs the command “make”, the following error occurs:

  CCLD   libpgf.la
/bin/sed: can't read Santiago/Documents/GitHub/gf-core/src/runtime/c/libgu.la: No such file or directory
libtool: link: `Santiago/Documents/GitHub/gf-core/src/runtime/c/libgu.la' is not a valid libtool archive
make[1]: *** [libpgf.la] Error 1
make[1]: Leaving directory `/c/Users/Williams Santiago/Documents/GitHub/gf-core/src/runtime/c'
make: *** [all] Error 2

Could someone help us? Is there any other step-by-step tutorial that we can follow to succeed the installation? 

You said that you succeeded in installing the C runtime. Are you two doing the same steps?

The Makefile https://github.com/GrammaticalFramework/gf-core/blob/master/Makefile contains cabal commands, so maybe he needs to run them manually and add the flag(s) --extra-include-dirs=/path/to/include and/or --extra-lib-dirs=/path/to/lib to an appropriate place.

Do report back if these suggestions don't help!

Inari

Yes, we are doing the same steps, but there must be something off and that is causing the error. He tried using the flags but, unfortunately, still got the same error.


We decided, for now, to work with the Java binding, since we got it to work and it seems to have some methods, like Complete, that the C# binding does not (please, correct me if I'm wrong).

Thank you for the help!

--
Alice

Andreas Källberg

unread,
Oct 2, 2020, 3:17:53 AM10/2/20
to gf-...@googlegroups.com
Hi Alice,

Can you try downloading the zip file for windows from here https://www.grammaticalframework.org/download/index.html
and copy the dll files from there to your working directory? Or if you managed to build the c runtime yourself, try moving the generated dll files to your working directory manually.

Regarding the problem for your workmate, I think the problem is that they have a space in their username, which confuses the building script into believing that "/c/Users/Williams" is one argument and "Santiago/Documents/GitHub/gf-core/src/runtime/c/libgu.la" is the other argument. If they try moving the gf-core directory to a location without spaces in, I think it should work.

Regards,
Andreas

--

---
You received this message because you are subscribed to the Google Groups "Grammatical Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gf-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gf-dev/CAJPHJS_vfK3SiW%2B03s%2BMDX-AdbD00kogtitz9LVhBOZ1OaOUTQ%40mail.gmail.com.

Alice Oliveira

unread,
Oct 2, 2020, 11:22:21 AM10/2/20
to gf-...@googlegroups.com
Hi Andreas,

Em sex., 2 de out. de 2020 às 04:17, Andreas Källberg <anka...@gmail.com> escreveu:
Hi Alice,

Can you try downloading the zip file for windows from here https://www.grammaticalframework.org/download/index.html
and copy the dll files from there to your working directory? Or if you managed to build the c runtime yourself, try moving the generated dll files to your working directory manually.

We tried using the dll files from the zip file and the ones generated when building the C runtime, but we're still getting the same error.
I have the following situation:

image.png

And we also tried to add those dlls as references to the C# project, just like we did with the PGFSharp.dll, but we get an error saying "The reference is invalid or unsupported.".
Are we doing something wrong?

Regarding the problem for your workmate, I think the problem is that they have a space in their username, which confuses the building script into believing that "/c/Users/Williams" is one argument and "Santiago/Documents/GitHub/gf-core/src/runtime/c/libgu.la" is the other argument. If they try moving the gf-core directory to a location without spaces in, I think it should work.

Regards,
Andreas

It worked!

Thank you for the help :)

--
Alice

Andreas Källberg

unread,
Oct 2, 2020, 11:33:46 AM10/2/20
to gf-...@googlegroups.com
Hi Alice,

On 2 Oct 2020, at 17:22, Alice Oliveira <ao...@cin.ufpe.br> wrote:

We tried using the dll files from the zip file and the ones generated when building the C runtime, but we're still getting the same error.

Hmm, ok. Can you see if removing the "-0" from the name and see if that helps?


And we also tried to add those dlls as references to the C# project, just like we did with the PGFSharp.dll, but we get an error saying "The reference is invalid or unsupported.".

Did you try that with both those those from the zip file and those built manually? Did you use Cygwin to build the C runtime?

Are we doing something wrong?

Not that I can tell. I'm as confused as you are.

Another thing you can check is what the output of 
dumpbin /dependents nameOfDll.dll
is for all the dll files. It should say which dll files they need as dependencies. (https://stackoverflow.com/questions/1993673/what-is-the-equivalent-of-linuxs-ldd-on-windows)

Regards,
Andreas

Krasimir Angelov

unread,
Oct 2, 2020, 12:31:57 PM10/2/20
to Grammatical Framework
Hi Alice,

As far as I know only one person has used the C# binding so far. I myself compiled it once on Windows but it was long time ago. 

My vague memory is that instead of the normal Makefiles we used cmake. On Windows cmake processes the file CMakeLists.txt and generates a Visual Studio project. This made is possible to compile the runtime via the normal Microsoft tools which seems to be necessary for things to work smoothly with .NET. 

I also remember that I compiled the C# binding but with Mono on Unbuntu and then I was able to use the normally compiled shared libraries.

I hope that this helps.

Best Regards,
Krasimir


--

---
You received this message because you are subscribed to the Google Groups "Grammatical Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gf-dev+un...@googlegroups.com.

Alice Oliveira

unread,
Oct 8, 2020, 1:32:13 PM10/8/20
to gf-...@googlegroups.com
Hi Andreas and Krasimir.
On 2 Oct 2020, at 17:22, Alice Oliveira <ao...@cin.ufpe.br> wrote:

We tried using the dll files from the zip file and the ones generated when building the C runtime, but we're still getting the same error.

Hmm, ok. Can you see if removing the "-0" from the name and see if that helps?


We tried removing the "-0", but nothing changed.

And we also tried to add those dlls as references to the C# project, just like we did with the PGFSharp.dll, but we get an error saying "The reference is invalid or unsupported.".

Did you try that with both those those from the zip file and those built manually? Did you use Cygwin to build the C runtime?
 
Yes, we tried using both as references and it resulted in the same error. We built the C runtime using MinGW.
 
Another thing you can check is what the output of 
dumpbin /dependents nameOfDll.dll
is for all the dll files. It should say which dll files they need as dependencies. (https://stackoverflow.com/questions/1993673/what-is-the-equivalent-of-linuxs-ldd-on-windows)

Regards,
Andreas


We also tried that, but with no luck. Again, thank you for the suggestions!

Em sex., 2 de out. de 2020 às 13:31, Krasimir Angelov <kr.an...@gmail.com> escreveu:
Hi Alice,

As far as I know only one person has used the C# binding so far. I myself compiled it once on Windows but it was long time ago. 

My vague memory is that instead of the normal Makefiles we used cmake. On Windows cmake processes the file CMakeLists.txt and generates a Visual Studio project. This made is possible to compile the runtime via the normal Microsoft tools which seems to be necessary for things to work smoothly with .NET. 


I haven't had the time to test using cmake yet, but when I have, I will report back.

 
I also remember that I compiled the C# binding but with Mono on Unbuntu and then I was able to use the normally compiled shared libraries.


We also did that and it worked as expected. We are only having trouble on Windows.

Thank you for the help, Krasimir!
 

Alice

Alice Oliveira

unread,
Dec 11, 2020, 8:30:47 AM12/11/20
to gf-...@googlegroups.com
Hello, sorry for taking so long to report back.

Em sex., 2 de out. de 2020 às 13:31, Krasimir Angelov <kr.an...@gmail.com> escreveu:
Hi Alice,

As far as I know only one person has used the C# binding so far. I myself compiled it once on Windows but it was long time ago. 

My vague memory is that instead of the normal Makefiles we used cmake. On Windows cmake processes the file CMakeLists.txt and generates a Visual Studio project. This made is possible to compile the runtime via the normal Microsoft tools which seems to be necessary for things to work smoothly with .NET. 


I haven't had the time to test using cmake yet, but when I have, I will report back.


I was able to generate the Visual Studio project, using cmake -G "Visual Studio 16 2019".
Here are the files generated with cmake:
image.png

When I tried to build the solution, several errors occurred when building pgf.vcxproj (the output is in the annexed file, in case it helps).
After trying to build the project these files were created:
image.png
In the gu.dir folder there were several C files compiled and inside of the Debug folder, there is a gu.dll, which I believe is one of the libraries necessary to install the runtime. But I'm not being able to generate the other dlls, since errors occurred when building the project.

What am I doing wrong? Is there a tutorial I could follow? Thank you.

--
Alice
errorpgf.txt

Krasimir Angelov

unread,
Dec 13, 2020, 2:59:21 AM12/13/20
to Grammatical Framework
Hi Alice,

I don't have Visual Studio and I can't reproduce the error, but looking at the source code:

#if defined(_MSC_VER)
#if defined(COMPILING_GU)
#define GU_API_DECL __declspec(dllexport)
#define GU_API __declspec(dllexport)
#else
#define GU_API_DECL __declspec(dllimport)
#define GU_API ERROR_NOT_COMPILING_LIBGU
#endif

It looks like the macro COMPILING_GU should be defined somewhere. I remember that it used to be possible to define macroses from the settings of the project. Do that for the project for libgu! I can't be more specific since it has been years since I used Visual Studio.

Best Regards,
Krasimir


--

---
You received this message because you are subscribed to the Google Groups "Grammatical Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gf-dev+un...@googlegroups.com.

Alice Oliveira

unread,
Jan 7, 2021, 6:40:11 PM1/7/21
to gf-...@googlegroups.com
Hello,

I tried defining the macro COMPILING_GU, but the errors persisted.
At the moment, I will not keep trying to compile the C runtime on Windows, since it's not necessary for the work I am doing, which is only using the Java binding. Thank you for the help!


Alice
Reply all
Reply to author
Forward
0 new messages