fix installation with MSYS2+mingw-w64#1914
fix installation with MSYS2+mingw-w64#1914vtorri wants to merge 1 commit intofacebook:devfrom vtorri:dev
Conversation
|
The
|
|
i don't know what you did but the dll in my patch is : dll/libzstd-$(LIBVER_MAJOR).dll that is common usage to add major version for parallal installation after api or abi break (in that case, major version should (must) be increased) |
|
The test fails at The test result linked above is the result of merging this patch with I presume this PR is incompatible with the dynamic library test for Windows, |
|
i guess so. Just add -$(LIBVER_MAJOR) |
|
I don't think that's the best course of action. On Unix, the convention is to have multiple links to take care of this situation. I guess it makes sense to use the same convention for Windows, even with the lack of link. Therefore, both versions should exist. |
|
the name of the dll is not important, what is important is the name of the import library, which is libzstd.dll.a see : https://sourceware.org/binutils/docs/ld/WIN32.html section "direct linking to a dll" so when you pass -lzstd, ld will find libzstd.dll.a and everything will be fine mimic what linux does on windows is not good because they are different beasts. |
|
about https://github.com/facebook/zstd/blob/dev/tests/Makefile#L228 you should do instead : and you shoud export PATH with ../lib/dll so that libzstd-1.dll is found when the test binary is executed |
|
or you can both copy import lib and dll to ., and pass -L. -lzstd btw, ZSTD_DLL_IMPORT is completely useless. |
|
I'm fine with changing the test for a "better" one, if "better" can be documented.
This is very confusing. Why are there 2 differently named dll now ?
Technically, it does prefix all public symbols with This was added a long time ago, and is documented as having a "positive impact on performance" : But we have very little knowledge of this subtlety. All I know is that it adds a form of "complexity", and even if it's a small one, it better pays for its presence. If this option is not useful, then maybe explain why (the code comment is wrong then ?), and then we should get rid of it, to simplify the source code and its maintenance. |
|
@Cyan4973 "This is very confusing. *.a is the accepted suffix for static libraries in Unix world," but Windows IS NOT Unix. You try to convince yourself that unix OS and Windows must have the same behavior and should do the same things. It is not the case. For example : do you think that LD_PRELOAD or LD_LIBRARY_PATH support exists on Windows. No, it does not. But, for years, gcc developpers try to simplify the life of Windows coders so that using the same options to gcc (compiler and linker) works correctly on all systems. There is one differences on windows, though, you must use -Wl,--out-implib OR using a .def file, but imho, using a .def file is very error prone as you can easily forget a public function in it. Technically, a .a on unix is an archive created with the ar archiver (hence the .a suffix). On windows the import lib is the list of stub (empty) functions that appear in the dll. The import library is NOT a dll. Visual Studio uses .lib for import lib. But it also uses .lib for static lib, which is very confusing. So, for around 20 years, the import lib has the .dll.a suffix on Windows when built with gcc (more precisely, it's libtool which decided to name the import lib like that) and the ld linker with correctly do things if you pass -lzstd, as mentioned in the link i have provided. another reference : http://www.mingw.org/wiki/sampleDLL about my ZSTD_DLL_IMPORT comment : there are to cases :
So you could simplify the definition of ZSTDLIB_API like that : I've also removed the check of the value of ZSTD_DLL_EXPORT which is also useless. What is important is that -DZSTD_DLL_EXPORT must be passed to the preprocessor when building the dll. Then everything will be fine. I think that ZSTDLIB_VISIBILITY is useless on Windows. Final reference : https://gcc.gnu.org/wiki/Visibility section "How to use the new C++ visibility support" |
|
I'm fine with most of the suggestions proposed. Maintainers can't be expected to know all details of all systems at all times, so it's normal to have questions and surprises. |
|
so, what's the status of this PR ? |
Apparently, it is. In this test, the A curious and annoying detail is that I can't reproduce it on my local config : using a VM with Windows 10 + |
|
it's more in libzstd.dll.a, i think |
Well, if this test was compiled with But this test is different, since it lists so it's unclear why it would need to reach It's also unclear to me why this test was redacted this way. So I'll try to get more information on what this test is trying to achieve. |
|
Not sure if it matters, but the name |
|
normally (and i never had problem with this ways since more than 10 years) :
so with zstd : -shared -Wl,--out-implib,libzstd.dll.a libzstd-$(LIBVER_MAJOR).dll
and that's all. |
|
btw you should create the dll with the version with step 1 above, then copy it to libzstd.dll (not the contrary) |
|
This PR hasn't made progress in over a year. This issue seems to be a bit complex, and each fix causes another problem. We're not against fixing this issue, if still present, but will need a different approach. So I will close this PR. |
No description provided.