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

Don't generate PDB for libiconv on Windows #11502

Closed

Conversation

HertzDevil
Copy link
Contributor

Fixes #11480 (comment). At the moment, static libraries for Windows builds are all release builds and do not have any debug information, so we make sure to strip it from libiconv too; more specifically, we cannot pass the /Zi flag to cl.exe. Later we should revisit the issue of whether to include PDB files for those libraries as they might affect call stacks on Windows.

This PR switches to kiyolee/libiconv-win-build instead, since its MSVC build files are more organized than the one before (which is also incorrect in certain places).

@HertzDevil HertzDevil added kind:regression Something that used to correctly work but no longer works platform:windows Windows support based on the MSVC toolchain / Win32 API topic:infrastructure labels Nov 27, 2021
@oprypin
Copy link
Member

oprypin commented Nov 27, 2021

Ummmm isn't the license in that project straight up GPLv3-only?
https://github.com/kiyolee/libiconv-win-build/blob/master/src/iconv.c

@HertzDevil
Copy link
Contributor Author

HertzDevil commented Nov 27, 2021

That's GNU iconv, the command-line frontend to GNU libiconv, and we don't use it anywhere, before or after this PR.

At least that's what GNU proclaims:

The libiconv and libcharset libraries and their header files are under LGPL.

The iconv program is under GPL.

The .vcxproj file used by the CI references some header files under srclib that are GPL. I don't know if GNU libiconv genuinely needs them.

@oprypin
Copy link
Member

oprypin commented Nov 27, 2021

OK but all other files are also GPL only.
https://github.com/kiyolee/libiconv-win-build/blob/master/lib/cp858.h

@HertzDevil
Copy link
Contributor Author

That linked file clearly refers to LGPL???

image

@oprypin
Copy link
Member

oprypin commented Nov 27, 2021

OMG I was so confused.
"Library General Public License" huh.
I was looking for "Lesser" everywhere.
Sorry

@oprypin
Copy link
Member

oprypin commented Nov 27, 2021

There are still warnings
https://github.com/crystal-lang/crystal/runs/4340598526?check_suite_focus=true#step:37:34

Run .\crystal-cross.exe build src/compiler/crystal.cr -Di_know_what_im_doing -Dwithout_playground --link-flags=/STACK:10000000
iconv.lib(iconv.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
Generating code
Finished generating code
iconv.lib(iconv.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance

@HertzDevil
Copy link
Contributor Author

HertzDevil commented Nov 27, 2021

Did some further digging and the actual GNU libiconv uses libcharset/include/localcharset.h instead of srclib/localcharset.h; they have identical code, only their licenses are different. So this is a potential licensing issue in that newer MSVC repository.

EDIT: This is indeed an issue on their end, but localcharset.h is truly LGPL according to GNU. There is still one conflicting file (srclib/xalloc.h) but I had no issues building libiconv locally with that file removed.

@oprypin
Copy link
Member

oprypin commented Nov 28, 2021

@HertzDevil It's unfortunate... this kind of thing is exactly something that can make this PR linger for months :D

What solution do we have for now?
Is it possible to stick with the previous implementation?
Otherwise, I'd like to see a solution sooner rather than later, even if it has to be passing -Dwithout_iconv in CI for now.

@HertzDevil
Copy link
Contributor Author

Is the /GL warning still there?

A few options if we want to get around the license issues:

  • We use the old repository, but because the DebugInformationFormat and WholeProgramOptimization elements are absent we must override it from outside or find a way to inject it into the .vcxproj correctly.
  • We fork the new repository and fix the include directories and/or header licenses ourselves.
  • We invoke cl.exe directly. But note that we must still rely on either of the repositories because this skips the Linux-only configuration step.

@HertzDevil HertzDevil closed this Nov 29, 2021
@HertzDevil HertzDevil deleted the bug/windows-libiconv-pdb branch November 29, 2021 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:regression Something that used to correctly work but no longer works platform:windows Windows support based on the MSVC toolchain / Win32 API topic:infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants