dqxafj6830 2015-12-18 10:16
浏览 64
已采纳

git2go与libssl和libssh2在单个二进制文件中

Could anyone offer some suggestions (or resources) on how I could package a GO program that uses git2go, libssl and libssh2 such that it doesn't require the end user to install these libraries separately?

I am only targeting Linux distros (if it matters)

  • 写回答

1条回答 默认 最新

  • dqvrlgi3247 2015-12-18 17:34
    关注

    One way would be to build those dependencies statically as well and use PKG_CONFIG_PATH point to your own copies so everything gets linked statically. That should make CMake choose the static versions.

    But if the goal is to avoid depending on the user-installed libraries rather than making everything a single executable, I would recommend shipping the libraries and working with the load path to make sure they get loaded. With gcc you'd pass -Wl,-R to set the search path in the binary itself, so you can set where to search for the shared libraries you're shipping with your app. With go it looks like you can pass -r to the linker (via -ldflags or manually) to do the same thing.

    libgit2 is rather extensible, so there is a third option which is to implement the TLS stream and SSH transport in Go and plug those into a version of libgit2 without support for these. This is however a significant amount of work.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题