Skip to content

Fix MinGW cross#1883

Merged
Cyan4973 merged 3 commits into
facebook:travisTestfrom
Ericson2314:fix-mingw-cross
Nov 27, 2019
Merged

Fix MinGW cross#1883
Cyan4973 merged 3 commits into
facebook:travisTestfrom
Ericson2314:fix-mingw-cross

Conversation

@Ericson2314
Copy link
Copy Markdown
Contributor

@Ericson2314 Ericson2314 commented Nov 12, 2019

The batch file was very unnecessary.

@facebook-github-bot
Copy link
Copy Markdown

Hi Ericson2314! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

Comment thread programs/Makefile Outdated
@facebook-github-bot
Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Helps for cross builds, doesn't matter on Windows itself.
@facebook-github-bot
Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@Ericson2314
Copy link
Copy Markdown
Contributor Author

Should be all good now

@Ericson2314
Copy link
Copy Markdown
Contributor Author

CC @vtorri @jdxAtGitHub

@Ericson2314 Ericson2314 reopened this Nov 13, 2019
@vtorri
Copy link
Copy Markdown
Contributor

vtorri commented Nov 13, 2019

it would be nice to fix import lib name : see issue #1877

@Ericson2314
Copy link
Copy Markdown
Contributor Author

@vtorri it would, but I would do that separately as I was able to link fine with this name.

@vtorri
Copy link
Copy Markdown
Contributor

vtorri commented Nov 13, 2019

the name of the import lib can have .lib extension, but the static lib can also have .lib extension. That's what visual studio does, but it is not a good idea. libtool, and the vast majority of open source project uses .dll.a as extension to enforce the fact that it's the import lib

ok to do that separately

Comment thread programs/Makefile Outdated
generate_res.bat seems rather pointless, am I missing something? I just
inlined it into the Makefile.
Needed a bunch of `$(EXT)`
@Cyan4973
Copy link
Copy Markdown
Contributor

Cyan4973 commented Nov 26, 2019

Looks good to me !

The only point I wonder is : how to test this capability ?

I believe it's an important point, otherwise it would be easy to break this capability in any future patch.

I guess this should be done on AppveyorCI, our current Windows based CI ?

@Ericson2314
Copy link
Copy Markdown
Contributor Author

Ericson2314 commented Nov 26, 2019

Do what https://github.com/facebook/rocksdb does, it is also a Facebook project so shouldn't be too dificult. MinGW cross will catch a few more things than MinGW native too.

https://github.com/facebook/rocksdb/blob/master/.travis.yml#L115-L116

I unfortunately don't have much more time to put into this, sorry, but I also think these fixes won't bit-rot too badly, which makes it less urgent.

@vtorri
Copy link
Copy Markdown
Contributor

vtorri commented Nov 26, 2019

i'm using zstd in my package manager and i test each new release with MSYS2 + mingw-w64, so i also don't think it will bitrot

@Cyan4973
Copy link
Copy Markdown
Contributor

Cyan4973 commented Nov 27, 2019

In https://travis-ci.org/facebook/zstd/jobs/617904275, I've added a mingw cross-compilation test based on the suggested RocksDB's script to the travisTest branch, in preparation for this patch.

As expected, if fails, since it doesn't include this patch :

timefn.h:44:47: fatal error: Windows.h: No such file or directory
https://travis-ci.org/facebook/zstd/jobs/617904275#L343

I guess it's the issue of casing that this patch fixes.

Also notable, library compilation doesn't seem to like the -fPIC directive for mingw cross-compilation.
That's a problem if one wants to neutralize any kind of warning during CI tests, which is generally a good policy. In which case, this issue should be fixed too.
Another method could be to restrict the scope of the test, and by extension of the patch : is it just meant to compile only the CLI in /programs ? Or is library compilation also part of the scope ?

@vtorri
Copy link
Copy Markdown
Contributor

vtorri commented Nov 27, 2019

always use lowercase header file name on windows for cross compilation

@Cyan4973
Copy link
Copy Markdown
Contributor

Cyan4973 commented Nov 27, 2019

The mingw cross-compilation test passes after this patch.
Still, it doesn't solve the -fPIC warning for the library,
so I think I will restrict the scenario to compilation of the CLI only.
This will make it possible to enforce the strictest zero-warning tolerance policy, associated with an extended list of correctness compilation flags.

@Cyan4973 Cyan4973 mentioned this pull request Nov 27, 2019
@Cyan4973 Cyan4973 changed the base branch from dev to travisTest November 27, 2019 22:46
@Cyan4973
Copy link
Copy Markdown
Contributor

redirecting the PR towards travisTest, where the mingwcross-compilation test is present.

@Cyan4973
Copy link
Copy Markdown
Contributor

Well, I was expected CI tests to be triggered after the change of destination branch, but apparently, they are not.

Merging. Tests to be continued onto travisTest branch.

@Cyan4973 Cyan4973 merged commit 93ec5cf into facebook:travisTest Nov 27, 2019
@Ericson2314 Ericson2314 deleted the fix-mingw-cross branch November 28, 2019 00:25
@Ericson2314
Copy link
Copy Markdown
Contributor Author

Can you make an issue for the testing the library? I was building this to build rocksdb in NixOS/nixpkgs#73316, so I can assure you the library is being cross compiled in practice.

@Cyan4973
Copy link
Copy Markdown
Contributor

The CLI-limited mingw cross-compilation test has been added in #1910.

Compiling the library is likely to work fine too, it's just that it generates a ton of -fPIC warnings.
The issue would be to find a way to avoid these warnings, so that CI test results can remain clean.

@Ericson2314
Copy link
Copy Markdown
Contributor Author

Right, the issue would mention the PIC warnings as the blocker.

@Cyan4973
Copy link
Copy Markdown
Contributor

#1911

@Ericson2314
Copy link
Copy Markdown
Contributor Author

Thanks! Subscribed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants