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

glib:x64-windows-static failing #3409

Closed
olilarkin opened this issue May 2, 2018 · 22 comments
Closed

glib:x64-windows-static failing #3409

olilarkin opened this issue May 2, 2018 · 22 comments
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support depends:upstream-changes Waiting on a change to the upstream project

Comments

@olilarkin
Copy link

actually trying to install cairo x64 static, which previously worked

-- CURRENT_PORT_DIR=C:/Users/oli/Dev/vcpkg/ports/glib/.
Glib relies on DllMain and therefore cannot be built statically
CMake Error at C:/Users/oli/Dev/vcpkg/ports/glib/portfile.cmake:13 (message):
Glib only supports dynamic library and crt linkage

Error: Building package glib:x64-windows-static failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with .\vcpkg update, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
Package: glib:x64-windows-static
Vcpkg version: 0.0.110-2018-05-02-1e41c4377f38512d1d6c0d65a2e7b9c7c8b03bea

@constructor-s
Copy link

constructor-s commented May 11, 2018

Seems to be due to commits 26fabaf ("Disable static builds") and 79a526a

Same issue while trying to install pcl[openni2,qt,pcap]:x64-windows-static --featurepackages

PS C:\Users\USERNAME> vcpkg install pcl[openni2,qt,pcap]:x64-windows-static --featurepackages
The following packages will be built and installed:
  * atlmfc[core]:x64-windows-static
  ...more * packages...
  * openssl[core]:x64-windows-static
    pcl[core,openni2,pcap,qt]:x64-windows-static
  * qhull[core]:x64-windows-static
  ...more * packages...
  * winpcap[core]:x64-windows-static
Additional packages (*) will be modified to complete this operation.
Starting package 1/90: glib:x64-windows-static
Building package glib[core]:x64-windows-static...
-- CURRENT_INSTALLED_DIR=C:/Users/USERNAME/Documents/vcpkg/installed/x64-windows-static
-- DOWNLOADS=C:/Users/USERNAME/Documents/vcpkg/downloads
-- CURRENT_PACKAGES_DIR=C:/Users/USERNAME/Documents/vcpkg/packages/glib_x64-windows-static
-- CURRENT_BUILDTREES_DIR=C:/Users/USERNAME/Documents/vcpkg/buildtrees/glib
-- CURRENT_PORT_DIR=C:/Users/USERNAME/Documents/vcpkg/ports/glib
Glib relies on DllMain and therefore cannot be built statically
CMake Error at ports/glib/portfile.cmake:13 (message):
  Glib only supports dynamic library and crt linkage
Call Stack (most recent call first):
  scripts/ports.cmake:72 (include)


Error: Building package glib:x64-windows-static failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: glib:x64-windows-static
  Vcpkg version: 0.0.110-2018-05-10-9a19dae13a0fa594245db2df45ec54a504bc82f3

Additionally, attach any relevant sections from the log files above.

@stekyne
Copy link
Contributor

stekyne commented Jun 6, 2018

Had the same issue trying to use Fluidsynth statically. It says in the comments that Glib requires DLLMain to function so I guess that is the reason.

@sykhro
Copy link

sykhro commented Jun 13, 2018

I'm running into the same issue when trying to build qt5-base. This is kind of a problem, since Qt can be built statically.

@pravog
Copy link

pravog commented Jun 29, 2018

Is there any detailed explanations what it is all about? Why so many libraries stuck from being statically build because of some weirdness?
Moreover it is said that "Glib only supports dynamic library and crt linkage" ... I do not see direct connection between crt linkage and using of DllMain

@stekyne
Copy link
Contributor

stekyne commented Jul 31, 2018

This is a real pain point. Anybody with more information?

@sykhro
Copy link

sykhro commented Aug 1, 2018

Nothing really. I'll look into the build details when I have time and submit a PR for it

@stekyne
Copy link
Contributor

stekyne commented Aug 7, 2018

The symbols: GLIB_STATIC_COMPILATION and GOBJECT_STATIC_COMPILATION seem to allow this?
https://github.com/GNOME/glib/blob/4e1488eebb2129c6e39162b56275d311f24216ab/meson.build#L175-L178

@olilarkin
Copy link
Author

any news from anyone? i have tried and failed to fix this

@sykhro
Copy link

sykhro commented Oct 22, 2018 via email

@olilarkin
Copy link
Author

it definitely worked in the past

@LarryIII LarryIII added the category:port-bug The issue is with a library, which is something the port should already support label Feb 13, 2019
@LilyWangL
Copy link
Contributor

GLib doesn't support static build for Windows. See more information here:
https://bugzilla.gnome.org/show_bug.cgi?id=752837
#529 (comment)

@stekyne
Copy link
Contributor

stekyne commented Nov 26, 2019

Should it fail the build though? I've seen other times it will force dynamic linking instead and continue. For instance, if you want to build a static version of fluidsynth i.e. fluidsynth:x64-windows-static. Glib is a dependency so it will try to build statically but fail due to the error above. Should it not continue but use it dynamically and the rest statically? Otherwise you need to create a custom triplet, which is a bit of a pain.

@JackBoosY
Copy link
Contributor

JackBoosY commented Nov 29, 2019

@stekyne To build glib as a static library and link using a static CRT, we will get a Dllmain error:

gobject-2.0.lib(gtype.c.obj) : error LNK2005: DllMain already defined in glib-2.0.lib(glib-init.c.obj)

So we need to solve this first.

@proTerm
Copy link

proTerm commented Dec 7, 2020

ping

@JackBoosY JackBoosY reopened this Dec 8, 2020
@JackBoosY JackBoosY added depends:upstream-changes Waiting on a change to the upstream project and removed depends:upstream-changes Waiting on a change to the upstream project labels Dec 8, 2020
@JackBoosY
Copy link
Contributor

@proTerm Since the official does not provide a method to build static in windows, and function dllmain does exist in these two libraries, can you accept that tools cannot be built in static?

Note to me: glib and gobject should be installed to the manual-link folder.

@proTerm
Copy link

proTerm commented Dec 23, 2020

can you accept that tools cannot be built in static?

I hope that a solution would be found.

@proTerm
Copy link

proTerm commented May 7, 2021

@JackBoosY and @NancyLi1013
Has the bug been fixed? Because Im still getting an error?

Starting package 6/15: glib:x64-windows-static
Building package glib[core]:x64-windows-static...
-- Note: glib only supports dynamic library linkage. Building dynamic library.
CMake Error at scripts/cmake/vcpkg_check_linkage.cmake:47 (message):
  Refusing to build unexpected dynamic library against the static CRT.  If
  this is desired, please configure your triplet to directly request this
  configuration.
Call Stack (most recent call first):
  ports/glib/portfile.cmake:6 (vcpkg_check_linkage)
  scripts/ports.cmake:142 (include)


Error: Building package glib:x64-windows-static failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: glib:x64-windows-static
  Vcpkg version: 2021-05-05-9f849c4c43e50d1b16186ae76681c27b0c1be9d9

@sykhro
Copy link

sykhro commented May 7, 2021

This is not a bug, GLib doesn't support static linking on Windows yet. There's a merge request upstream but GLib doesn't have many Windows maintainers, so it's just sitting there going stale

@JackBoosY JackBoosY added the depends:upstream-changes Waiting on a change to the upstream project label May 8, 2021
@proTerm
Copy link

proTerm commented May 8, 2021

This is not a bug,

Its not a bug, its a feature ;)

For a moment I had thought, this issue has been resolved ... (On the other hand, its such a pity that this issue is not being prioritized by the vcpkg team).

Thanks for the answer!

@sykhro
Copy link

sykhro commented May 8, 2021

I mean, the vcpkg team can't do anything about this. GLib just doesn't work when linked statically, it has to be fixed upstream

@proTerm
Copy link

proTerm commented May 24, 2021

@JackBoosY Im surprised you closed the issue, although it would never be resolved ... ?

@JackBoosY
Copy link
Contributor

JackBoosY commented May 25, 2021

@proTerm As you can see, the upstream doesn't support static build for such a long time.
And some contributors are trying to support static but waiting for the upstream approval.

And I will keeping my PR #16980 to track this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support depends:upstream-changes Waiting on a change to the upstream project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants