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

Fail to install Lablgtk3 on Windows (Diskuv) #165

Open
F-Loyer opened this issue Feb 5, 2023 · 3 comments
Open

Fail to install Lablgtk3 on Windows (Diskuv) #165

F-Loyer opened this issue Feb 5, 2023 · 3 comments

Comments

@F-Loyer
Copy link

F-Loyer commented Feb 5, 2023

I have compiled Gtk with gvsbuild, copied it in C:\gtk, added C:\gtk\binin the PATH. Then the cairo2 package does install.

However, òpam install lablgtk3` fails :

# [...]
# (cd _build/default/src && C:\DiskuvOCaml\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -IC:/gtk/bin/../include/gtk-3.0 -IC:/gtk/bin/../include/pango-1.0 -IC:/gtk/bin/../include -IC:/gtk/bin/../include/glib-2.0 -IC:/gtk/bin/../lib/glib-2.0/include -IC:/gtk/bin/../include/harfbuzz -IC:/gtk/bin/../include/freetype2 -IC:/gtk/bin/../inc[...]
# cl : Ligne de commande error D8021 : argument numérique non valide '/Wno-deprecated-declarations'
# File "src/dune", line 29, characters 3-11:
# 29 |    ml_pango cairo_pango_stubs
#         ^^^^^^^^
# (cd _build/default/src && C:\DiskuvOCaml\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -IC:/gtk/bin/../include/gtk-3.0 -IC:/gtk/bin/../include/pango-1.0 -IC:/gtk/bin/../include -IC:/gtk/bin/../include/glib-2.0 -IC:/gtk/bin/../lib/glib-2.0/include -IC:/gtk/bin/../include/harfbuzz -IC:/gtk/bin/../include/freetype2 -IC:/gtk/bin/../inc[...]
# cl : Ligne de commande error D8021 : argument numérique non valide '/Wno-deprecated-declarations'
# File "src/dune", line 27, characters 3-11:
# 27 |    wrappers
#         ^^^^^^^^
# (cd _build/default/src && C:\DiskuvOCaml\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe -nologo -O2 -Gy- -MD -D_CRT_SECURE_NO_DEPRECATE -IC:/gtk/bin/../include/gtk-3.0 -IC:/gtk/bin/../include/pango-1.0 -IC:/gtk/bin/../include -IC:/gtk/bin/../include/glib-2.0 -IC:/gtk/bin/../lib/glib-2.0/include -IC:/gtk/bin/../include/harfbuzz -IC:/gtk/bin/../include/freetype2 -IC:/gtk/bin/../inc[...]
# cl : Ligne de commande error D8021 : argument numérique non valide '/Wno-deprecated-declarations'

https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=msvc-170 gives the diffferent /W options. They don't follow the gcc conventions. (src/dune, src-goocanvas2/dune and src-sourceview3/dune have this option)

@garrigue
Copy link
Owner

I'm sorry, you probably need to at least use gcc to install lablgtk3.
It's been a long time I have not tried to compile anything directly under windows...

@F-Loyer
Copy link
Author

F-Loyer commented Feb 21, 2023

But the Microsoft compiler from Visual Studio is the compiler of the Diskuv distribution. I can’t change it for gcc without changing the Distribution.

And it seems to be the privileged distribution on Windows. (tier 2 according to https://ocaml.org/docs/ocaml-on-windows)

@tleedjarv
Copy link

I was testing the new opam system-msvc feature and discovered that lablgtk3 builds just fine with MSVC and appears to work correctly. This was the only fix I needed (I didn't build any of the other packages):

diff --git a/src/dune b/src/dune
index b712a7f7..c996707d 100644
--- a/src/dune
+++ b/src/dune
@@ -34,6 +34,6 @@
    ml_gtkmenu ml_gtkfile ml_gtktree ml_gtkpack
    ml_gtkstock ml_gtkrange ml_gtkassistant
  )
- (c_flags         (:include cflag-gtk+-3.0.sexp) (:include cflag-extraflags.sexp) -Wno-deprecated-declarations)
+ (c_flags         (:include cflag-gtk+-3.0.sexp) (:include cflag-extraflags.sexp))
  (c_library_flags (:include clink-gtk+-3.0.sexp))
  (libraries threads cairo2))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants