如何在Windows上将libxml2与zlib1链接? [英] How do I link libxml2 with zlib1 on Windows?

查看:188
本文介绍了如何在Windows上将libxml2与zlib1链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为我的 TeamSpeak 3插件编译libxml2 32位和64位二进制文​​件,因为我找不到dll/lib 64位下载.当我将编译的libxml2.dll用作命令提示符应用程序中的依赖项时,它可以正常工作.但是,当我尝试将其用作TeamSpeak 3中的依赖项时,该程序在启动时立即崩溃.具体来说,它在此行崩溃:

I need to compile libxml2 32-bit and 64-bit binaries for my TeamSpeak 3 plugin because I could not find a dll/lib 64-bit download. When I use my compiled libxml2.dll as a dependency in a command prompt application, it works just fine. However, when I try to use it as a dependency in TeamSpeak 3, the program immediately crashes on launch. Specifically it crashes on this line:

https://github.com/NobleUplift/TeamSpeak3WebsitePreview /blob/master/ts3websitepreview/plugin.c#L148

这是我在Windows上编译libxml2的批处理脚本:

This is my batch script for compiling libxml2 on Windows:

@ECHO OFF
CALL "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
CD libxml2-2.9.4\win32
nmake clean
cscript configure.js compiler=msvc zlib=true prefix=D:\Repos\libxml2\release include=D:\Repos\libxml2\dll\include lib=D:\Repos\libxml2\dll\bin debug=yes
nmake
nmake install
cd ../..

左侧下载的libxml2.dll起作用.编译的libxml2.dll在右边.我尝试使用zlib标志,并将zlib标头放在include目录中,并将dll/lib放在lib目录中,但是我无法将其链接到DLL中.

The downloaded libxml2.dll on the left works. Compiled libxml2.dll is on the right. I've tried using the zlib flag, and I put my zlib headers in the include directory and the dll/lib in the lib directory, but I can't get it to link in the DLL.

推荐答案

好吧,我不知道您的问题是什么,但是这是我们编译发行版本的方法:

Well, I dunno whats wrong with yours, but here's how we compile the release version:

set TARGET_DIR=.\release_vc100
cscript configure.js compiler=msvc cruntime=/MD debug=no iconv=no legacy=no vcmanifest=no prefix=%TARGET_DIR% || exit /B 1
nmake /f Makefile.msvc clean || exit /B 1
nmake /f Makefile.msvc MSVC_VERSION=vc100 || exit /B 1
nmake /f Makefile.msvc install || exit /B 1

我猜你不想使用iconv=no,但是我会注意到我为动态链接发布msvcrt和debug=no明确指定了/MD,并将MSVC_VERSION=vc100传递给了make步骤.

I guess you don't want iconv=no, but I'll note I explicitly specify /MD for the dynamic link release msvcrt and debug=no as well as passing MSVC_VERSION=vc100 to the make step.

我也注意到你通过<4>当选择似乎采取! - 我的的认为 '真' 不会interpeted为1,但为0(= )

I also note you pass zlib=truewhen the options seem to take yes|no - and I do think 'true' will not interpeted as 1, but as 0. (!= yes)

再次查看您的depwalker输出,我以某种方式怀疑您缺少的MSVC_VERSION开关 实际上可能是一个问题,因为depwalker列出了缺少的LIBiconv.dll和该命名方案(动态对象的LIB前缀) )据我所知是* nix的事情.)

Looking at your depwalker output again, I somehow suspect your missing MSVC_VERSION switch may actuall be a problem, because depwalker lists a missing LIBiconv.dll and that naming scheme (LIB prefix for dynamic object) is a *nix thing as far as I understand this.)

对于您的错误行-DLL加载失败-两个depwalker屏幕截图都显示缺少依赖项DLL文件:

As for your erro line -- dll load failed -- both depwalker screenshots show missing dependency DLL files:

  • 左侧:iconv.dll zlib1.dll令人烦恼

  • Left side: iconv.dll and zlib1.dll are muissing

右侧:缺少LIBiconv.dll. (但我认为在Windows上没有libiconv.dll,因此必须有一些错误的链接器设置(??).

Right side: LIBiconv.dll is missing. (But I think there is no libiconv.dll on Windows, so there must be some wrong linker settings (??).

我也显式传递了makefile,但这可能只是 是我们尝试了一些自定义生成文件的先前版本的遗留物.

I also pass the makefile explicitly, but that may just be a leftover from a prior version where we tried some customized makefiles.

侧面说明:调试版本为:

Side note: Debug version as:

cscript configure.js compiler=msvc cruntime=/MDd debug=yes iconv=no legacy=no vcmanifest=no prefix=%TARGET_DIR% || exit /B 1

这篇关于如何在Windows上将libxml2与zlib1链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆