Skip to content

[glibmm] fix #6550 by partially reverting #5937 (+minor correction in glibmmconfig.h)#6621

Merged
grdowns merged 9 commits intomicrosoft:masterfrom
NNemec:glibmm
Jun 6, 2019
Merged

[glibmm] fix #6550 by partially reverting #5937 (+minor correction in glibmmconfig.h)#6621
grdowns merged 9 commits intomicrosoft:masterfrom
NNemec:glibmm

Conversation

@NNemec
Copy link
Copy Markdown
Contributor

@NNemec NNemec commented May 25, 2019

No description provided.

@NNemec
Copy link
Copy Markdown
Contributor Author

NNemec commented May 25, 2019

The build appears to have some issues. Unfortunately, I don't have access to the details.

@cbezault
Copy link
Copy Markdown
Contributor

It's failing on Linux x64, I'm away from a work computer so I can't get you logs right now.

@cbezault
Copy link
Copy Markdown
Contributor

P. S. Here's a link to the beta public pipeline that should give you access to Linux build results https://dev.azure.com/vcpkg/public/_build?definitionId=8&_a=summary please give us any feedback you have.

@NNemec
Copy link
Copy Markdown
Contributor Author

NNemec commented May 27, 2019

Thanks, I've found the logfile and it leaves me puzzled:
The error does indeed relate to my changes, but these changes are in MSVC_Net2013/glibmm/glibmmconfig.h which is only used inside an if(WIN32) block in vcpkg's CMakeLists.txt - why would a Linux build have that variable set true?!?

The log file config-x64-linux-dbk-out.log does indeed state
config.status: executing MSVC_Net2013/glibmm/glibmmconfig.h commands

I don't know how to continue from here without digging deep into the build pipelines...

@cbezault
Copy link
Copy Markdown
Contributor

Agreed is seems weird that those configure_files are getting run, I'll look into it more tomorrow.

endif()

# A hacky solution for building Windows DLLs from sources ported from Linux.
# The cleaner approach would be to manually add __declspec(dllexport) to all public symbols in the header files or
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not so much that it's hacky, it's more that vcpkg doesn't feel like we should export symbols when the library maintainer chooses not to. In the case of glibmm the library does actually choose to export all symbols. vcpkg provides a full build system replacement for glibmm and so we also need to export all symbols. This comment should reflect that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit that the comment can be phrased better, but I don't agree with your reasoning:

The library maintainer did not make a choice. They simply did not consider Windows. On Linux, you always export everything. This flag is never about overriding upstream decisions, but about mimicking Linux default behaviour on Windows. Without the flag, the DLL exports nothing, which is clearly not the authors intention.

To this point, glibmm is in no way special. The only special aspect is that static linking it's not an option.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"hacky" is also still true, because this is kind of lazy: Of you really want to know the authors intention, you could simply go through all the public headers and handcraft a .def file from there. That is what the author would have done, if that option existed on Linux.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's untrue the library does export everything. Look at MSVC_NMake/gendef/gendef.cc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had no idea that file existed! Anyhow, it does not change my main point: Any DLL ported from Linux needs to add export defs. For glibmm, this was obviously already done upstream. If it had not been done, vcpkg would still have to do it, to make the DLL work.

Anyhow, I won't press this any further. I'll rephrase the comment and pull out of the more general discussion.

@grdowns
Copy link
Copy Markdown
Contributor

grdowns commented Jun 6, 2019

Hey @NNemec, I had the chance to dig into this problem and resolve the issues. As per the prior conversation, I've removed CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS because upstream exports the correct symbols through gendef.cc. I've also fixed the x64-linux build error by removing the manual setting of GLIBMM_DLL from within CMakeLists.txt as doing so causes glibmmconfig.h to define GLIBMM_API as __declspec(dllimport), which obviously does not work on x64-linux. I've also removed the instance of vcpkg_check_linkage as we want dependent ports to be able to link dynamically so as to not bring in multiple copies of glibmm, while still allowing the user to link statically if they desire. I'll merge this PR provided that it passes through CI successfully. Thanks for adding the patch to enable dynamic builds, and thanks for looking into the issue!

@cbezault
Copy link
Copy Markdown
Contributor

cbezault commented Jun 6, 2019

@grdowns the whole point of this PR was to add CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS. The gendef.cc only gets run if we use their NMake build.

@grdowns
Copy link
Copy Markdown
Contributor

grdowns commented Jun 6, 2019

I totally misunderstood the discussion -- it seems pretty obvious in retrospect. I'll make that change 👍

@grdowns grdowns merged commit 97d6a9b into microsoft:master Jun 6, 2019
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

Successfully merging this pull request may close these issues.

3 participants