英文:
Packaging Go 1.5 applications for Debian-like systems
问题
原始问题是在三年前提出的,当时Go语言是静态链接可执行文件。
现在,随着新的Go 1.5版本发布,其发布说明中提到:
> 链接器的改变使得可以将Go包作为共享库分发,以链接到Go程序中,并将Go包构建为可以链接到或由C程序加载的存档文件或共享库。
我查看了Debian GoPackaging wiki,但发现它还没有更新到Go 1.5,可能是因为该维基页面没有维护,或者其他原因,但是,
我只是想知道,如果我想打包一个只依赖于官方Go包的工具,我应该如何利用共享库,而不是构建一个庞大的静态链接可执行文件?
我知道官方答案可能需要一些时间,但我可以等待。
感谢Braiam的回答,我有了一些进展。
-
我按照博客中的步骤
head -100 debian/**/*
,但我的输出与博客中的完全不同。有人知道为什么以及如何解决吗?$ head -100 debian/**/* 3.0 (quilt)
-
我尝试运行
gbp buildpackage --git-pbuilder
,但遇到错误:gbp:info: Building with (cowbuilder) for sid Base directory /var/cache/pbuilder/base.cow does not exist gbp:error: 'git-pbuilder' failed: it exited with 1
-
我检查并验证了我已经安装了
cowbuilder
和pbuilder
:ii cowbuilder amd64 pbuilder running on cowdancer ii pbuilder all personal package builder for Debian packages
出了什么问题?这个pbuilder
对我来说是新的,因为我是使用Docker构建Debian/Ubuntu软件包。
英文:
The original question, https://stackoverflow.com/questions/15104089/packaging-golang-application-for-debian, was asked over three years ago, when Go was statically linking executables.
Now, with the new Go 1.5 Release, whose release note says,
> Changes to the linker enable distributing Go packages as shared libraries to link into Go programs, and building Go packages into archives or shared libraries that may be linked into or loaded by C programs
I headed to Debian GoPackaging wiki, but only to find out that it has not been updated to Go 1.5 yet, maybe the wiki is not maintained, or maybe not, but,
I just want to know, if I want to package a tool that depends on nothing but the official Go packages, how should I take advantage of the shared libraries, instead of building my app into a humongous statically linked executable?
I know the official answer may take some time, but I can wait.
Thanks to Braiam's answer, I moved a bit further.
-
I followed the blog to the step
head -100 debian/**/*
, but my output is completely different from the blog's. Mine is just the following. Anyone knows why and how to fix?$ head -100 debian/**/* 3.0 (quilt)
-
I tried to run
gbp buildpackage --git-pbuilder
but bumped into error:gbp:info: Building with (cowbuilder) for sid Base directory /var/cache/pbuilder/base.cow does not exist gbp:error: 'git-pbuilder' failed: it exited with 1
-
I checked and verified that I already have
cowbuilder
&pbuilder
installed:ii cowbuilder amd64 pbuilder running on cowdancer ii pbuilder all personal package builder for Debian packages
What's wrong? This pbuilder
thing is new to me as I build Debian/Ubuntu Package with Docker.
答案1
得分: 1
最简单的方法是使用dh-make-golang,然后验证/修正自动生成的文件。否则,您必须遵循Debian打包指南,创建debian/*
目录,并编辑控制文件和规则文件以与示例匹配。
英文:
The easiest method is to use dh-make-golang and verify/correct the autogenerated files. Otherwise you must follow Debian Packaging Guide and create debian/*
directory and editing the control and rules file to match the examples.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论