跳过不兼容的 zlib dll
情况: 我有很多 gzip 压缩的输入文件,我想在 ac 程序中处理它们。我可以在每次需要时提取它们,但这需要很多时间,所以我想在内存提取中使用。作为测试用例,我从 http://zlib.net/ 下载了 zlib 源代码并尝试编译示例 zpipe .c
问题: 当我使用以下方法编译 zpipe.c 时,
x86_64-w64-mingw32-gcc -Wall -O3 zpipe.c -o zpipe -L. -lzlib1
出现错误:
x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ./zlib1.dll when searching for -lzlib1
x86_64-w64-mingw32/4.5.4/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lzlib1
我认为问题是什么(我从 链接时跳过不兼容错误)
我尝试在编译 64 位代码时链接 32 位 dll。当我查看 http://zlib.net/zlib_faq.html#faq26 时说zlib 在 64 位机器上进行了测试,但我想这意味着您仍然编译 32 位代码。请注意,我编译了 zpipe.c(在 zlib 源代码中提供),所以我确信包含的内容都没有问题。我把zlib1.dll放在编译目录下。
我做了什么/发现了什么: 其中我发现了两个很好的例子(但是对于它们两个我都有上述问题)
- http://www.codeguru.com/cpp/cpp/algorithms/compression/article.php/c11735
- http://bobobobo.wordpress.com/2008/02/23 /how-to-use-zlib/
我还查看了其他问题,例如:
我自己也构建了一个dll然而,在 vc 2010 中,zlib 1.26 源中的所有项目配置均适用于 32 位配置。所以在我构建了一个dll之后,我遇到了与上面相同的错误。
故事很长,所以快速总结一下我的问题:
- 我在编译过程中做错了什么吗?
- 当我在 64 位中编译时,我将永远无法使用 zlib1 dll,这是正确的吗?
- 最重要的是:我可以以某种方式自己编译 64 位版本的 zlib (例如使用这些 http://msdn.microsoft.com/en-us/library/9yb4317s.aspx 说明),或者这些已经在某处可用(直到我才找到这些 现在)?
感谢大家抽出宝贵的时间!
Situation:
I have many gzipped input files that I want to process in a c program. I can extract each of them each time i need them but this takes a lot of time, so I would like to use in memory extraction. As a test case i downloaded the zlib sources from http://zlib.net/ and tried to compile the example zpipe.c
Problem:
When I compile zpipe.c using:
x86_64-w64-mingw32-gcc -Wall -O3 zpipe.c -o zpipe -L. -lzlib1
I get the error:
x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ./zlib1.dll when searching for -lzlib1
x86_64-w64-mingw32/4.5.4/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lzlib1
What I think is the problem (I got this from Skipping incompatible error when linking)
I try to link a 32 bit dll while I compile in 64 bit code. When i look at http://zlib.net/zlib_faq.html#faq26 it is said that zlib is tested on 64 bit machines, but I guess this means you still compile 32 bit code. Note that I compile zpipe.c (provided in the zlib source), so i'm sure the inclusions are all ok. I put the zlib1.dll in the compilation directory.
What did I do/find:
Among others I found 2 good examples (however with both of them I have the problem described above)
- http://www.codeguru.com/cpp/cpp/algorithms/compression/article.php/c11735
- http://bobobobo.wordpress.com/2008/02/23/how-to-use-zlib/
And I looked at other questions, such as:
- Trying to compile program that uses zlib. Link unresolved error
- Skipping Incompatible Libraries at compile
I also build a dll myself in vc 2010, however, all project configurations in the zlib 1.26 source are for a 32 bit configuration. So after I build a dll, I have the same error as above.
A long story so a quick summary of my questions:
- Is there something I do wrong during compilation?
- Is it correct that I will never be able to use the zlib1 dll when I compile in 64 bit?
- And most important: Can I somehow compile a 64 bit version of zlib myself (using for example these http://msdn.microsoft.com/en-us/library/9yb4317s.aspx instructions), or are these already available somewhere (I was not able to find these until now)?
Thank you all for your time!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您绝对可以自己编译 64 位版本。在 Visual Studio 中打开 DLL 项目,进入配置管理器并创建 64 位的新配置。您链接的说明应该没问题。
如果您遇到此问题,您还可以在应用程序中包含 zlib 的源代码,而不是链接 DLL。
You can most definitely compile a 64-bit version yourself. Open your DLL-project in Visual Studio, go into the configuration manager and create a new configuration for 64-bit. The instructions you linked should be fine.
If you are having problem with this you can also include the source of zlib in your application instead of linking against the DLL.