zcream
(Anmol)
June 23, 2020, 12:00am
1
I have Visual Studio 2019 Community edition and cmake installed.
I can build the default shared lib.
meson _build --backend=vs2019
cd _build
msbuild /m glib.sln
However, the static lib does not build.
meson _build --default-library static --backend=vs2019
cd _build
msbuild /m glib.sln
I also tried with
meson -Ddefault_library=static --backend=vs2019 _build
cd _build
msbuild /m glib.sln
ld\gio\tests\4076ad8@@appmonitor@exe.vcxproj]
libgobject-2.0.a(gclosure.c.obj) : error LNK2001: unresolved external
symbol __imp_ffi_type_sint32 [C:\Users\Administrator\Documents\glib\_bui
ld\gio\tests\4076ad8@@appmonitor@exe.vcxproj]
libgobject-2.0.a(gclosure.c.obj) : error LNK2001: unresolved external
symbol __imp_ffi_type_uint64 [C:\Users\Administrator\Documents\glib\_bui
ld\gio\tests\4076ad8@@appmonitor@exe.vcxproj]
libgobject-2.0.a(gclosure.c.obj) : error LNK2001: unresolved external
symbol __imp_ffi_type_sint64 [C:\Users\Administrator\Documents\glib\_bui
ld\gio\tests\4076ad8@@appmonitor@exe.vcxproj]
libgobject-2.0.a(gclosure.c.obj) : error LNK2001: unresolved external
symbol __imp_ffi_type_float [C:\Users\Administrator\Documents\glib\_buil
d\gio\tests\4076ad8@@appmonitor@exe.vcxproj]
libgobject-2.0.a(gclosure.c.obj) : error LNK2001: unresolved external
symbol __imp_ffi_type_double [C:\Users\Administrator\Documents\glib\_bui
ld\gio\tests\4076ad8@@appmonitor@exe.vcxproj]
libgobject-2.0.a(gclosure.c.obj) : error LNK2001: unresolved external
symbol __imp_ffi_type_pointer [C:\Users\Administrator\Documents\glib\_bu
ild\gio\tests\4076ad8@@appmonitor@exe.vcxproj]
.\appmonitor.exe : fatal error LNK1120: 17 unresolved externals [C:\Us
ers\Administrator\Documents\glib\_build\gio\tests\4076ad8@@appmonitor@ex
e.vcxproj]
340 Warning(s)
3697 Error(s)
nirbheek
(Nirbheek Chauhan)
June 23, 2020, 12:23am
2
Building glib on windows statically is known to not work (with both the vs backend and the ninja backend): https://gitlab.gnome.org/GNOME/glib/-/issues/692
glib builds fine with the vs backend (and of course the ninja backend) if you don’t build statically, though. I just tested it.
zcream
(Anmol)
June 23, 2020, 4:51pm
3
I think the patch being used by conan/bincrafters in their static build is your own patch
0001-win32-Prefer-the-use-of-constructors-over-DllMain.patch
Is it possible for meson to use this patch for a current build ?
EDIT: I mean, is there a way I can pass some params to tell meson to use this patch during a build?
nirbheek
(Nirbheek Chauhan)
June 23, 2020, 6:33pm
4
Yes, I wrote that patch 7 years ago, but it’s outdated now and does not apply to latest glib. Perhaps the version that Conan is carrying has been updated, in which case you can apply it with git am
before you build it with meson . Just make sure it’s the same version of glib that Conan is shipping.
However, build issues are another matter. I’m sure there are bugs since no one is testing it. You can try with --default-library=both
which should generate both static libraries *.a
and DLLs and use only the static libraries.
zcream
(Anmol)
June 23, 2020, 6:44pm
5
I hope that my comment will not be blocked as I’m going to post a link.
Conan definitely uses your patch -
From 8e8e82a7696d30a3115ddad2d935ce8a7af7079a Mon Sep 17 00:00:00 2001
From: Erik van Pienbroek <epienbro@fedoraproject.org>
Date: Tue, 16 Apr 2013 11:42:11 +0200
Subject: [PATCH 2/2] win32: Prefer the use of constructors over DllMain
This prevents having to depend on DllMain in static libraries
Constructors are available in both the GCC build (GCC 2.7 and later)
and the MSVC build (MSVC 2008 and later using _Pragma, earlier
versions using #pragma)
---
0002-win32-Prefer-the-use-of-constructors-over-DllMain.patch
I’ll try to patch and report back later.
zcream
(Anmol)
June 24, 2020, 12:22am
6
Nope. That patch fails with glib 2.64. I’ll try the Conan/bincrafters method and report later.
zcream
(Anmol)
June 24, 2020, 3:36pm
7
The patch does not work currently. However, SSE4 at conan has ported this sometime recently. I am leaving the link in here, in case someone want to follow it up.
If I get some guidance on the issue, I would be happy to make the changes to make static build work on glib.
opened 01:43PM - 23 Jun 20 UTC
I have spent a few days doing through the docs and trying different things. I am missing something very basic.
I wish...
question
system
(system)
Closed
July 8, 2020, 3:47pm
8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.