tboox / tbox

🎁 A glib-like multi-platform c library
https://docs.tboox.org
Apache License 2.0
4.85k stars 719 forks source link

packages runtime 与 --vs_runtime 不符 #209

Open nil-ref opened 1 year ago

nil-ref commented 1 year ago

在用参数: xmake f -m debug --vs_runtime=MDd -k static --demo=n --small=n --openssl=n --polarssl=n 配置 tbox 后

......
checking for windows__InterlockedExchange8_rel ... no
checking for windows__InterlockedExchange8_nf ... no
checking for windows__InterlockedCompareExchange_nf ... no
checking for windows__InterlockedExchange_rel ... no
checking for windows__InterlockedCompareExchange64_rel ... no
checking for windows__InterlockedCompareExchange ... no
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> zlib v1.2.13 [optional, vs_runtime:"MTd", from:pcre]
  -> sqlite3 3.39.0+200 [optional, vs_runtime:"MTd"]
  -> mbedtls 2.13.0 [optional, vs_runtime:"MTd"]
  -> pcre2 10.40 [optional, vs_runtime:"MTd"]
     or pcre 8.45 [optional, vs_runtime:"MTd"]
please input: y (y/n/m)

这里预期 packages vs_runtime 是 MDd. 可实际编译的是 MTd 的 runtime.

nil-ref commented 1 year ago

在手动修改脚本 xmake.lua, 关键位置 add_requires 加入 configs = {vs_runtime = "MDd"} 后. 能顺利编译. 但是在VS使用的过程中遇到: warning LNK4099: 未找到 PDB“” 的提示.

发现在 Local.xmake\packages\m\mbedtls\2.13.0\65246ccd0cf34d1fa5829fbe8953be40\lib 中不存在 pdb. 这里是不是可以在编译第三方包的时候保留 pdb 以方便调试?

nil-ref commented 1 year ago

或者可以将符号嵌入 debug 模式下的静态 lib. 参考: https://github.com/microsoft/vcpkg/commit/f7b813dce8c8d67147e3b007e4c880f6a877f810

waruqi commented 1 year ago

目前这个项目不打算对 md 做支持,你可以自己 xmake.lua 里面全局设置下 set_runtime("MDd") 去编译。

发现在 Local.xmake\packages\m\mbedtls\2.13.0\65246ccd0cf34d1fa5829fbe8953be40\lib 中不存在 pdb. 这里是不是可以在编译第三方包的时候保留 pdb 以方便调试?

保留 pdb 很占空间,目前不会在包里,特定去保留它。

想要调试包,可以自己将 add_requires("xxx", {debug = true}) 切到调试版本的包,但前提是这些包 对 debug config 做了处理。。目前不是所有包都加了 debug 切换。。得自己到 xmake-repo 仓库看下。。

切到 debug config ,通常包自身安装,会顺带安装 pdb ,前提是这个包的构建脚本有做处理

或者自己搞个本地仓库,改下包配置,用自己的包