Go to file
Arnout Vandecappelle c6bb759e2c package/pkg-golang.mk: add osusergo and netgo tags in static builds
CGO (the Go language C bindings) normally links dynamically with the C
libraries. It seems that passing -extldflags=-static is not sufficient
to make sure they link statically. As a result, a build using CGO will
fail with

runtime.gcdata: missing Go type information for global symbol .dynsym: size 72

There are two modules in the standard Go library that can use CGO:
os/user and net. Both of these have pure Go versions, however, which can
be selected with the osusergo and netgo tags. Since these two are
standard library modules that get used in almost all Go programs, pass
those flags in the common infrastructure.

It's not entirely clear if this is always the case or only depending on
the specific way CGO is used. In the former case, we could instead
disable CGO globally if static libs are enabled. However, it turns out
that this doesn't solve the problem completely anyway (delve still fails
to link, with different errors). Also, it is possible that other cgo
modules do still work. Therefore, just stick to adding the osusergo and
netgo tags.

Cf. Statically compiling Go programs [0]

Fixes:
 - crucible:
   http://autobuild.buildroot.net/results/c2f/c2f29f55b461899e8e15c0494578304e6f74bf51/
 - containerd:
   http://autobuild.buildroot.net/results/699/69910fc6b9f474a7eb0ca7ffa27ac5512cc1bb37/
 - delve:
   http://autobuild.buildroot.net/results/552/55225d5da17e85271943f7adce6f07d014d9717d/
 - probably others...

[0] https://www.arp242.net/static-go.html

Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2023-04-16 21:56:52 +02:00
arch arch/arch.mk.xtensa: relax check on overlay file to apply only to internal toolchains 2022-11-13 22:32:31 +01:00
board board/qemu: restore readme globbing 2023-04-15 09:06:54 +02:00
boot Merge branch 'next' 2023-03-12 22:45:36 +01:00
configs configs/orangepi_pc_plus: bump BSP versions 2023-04-15 19:56:32 +02:00
docs doc/manual: fix formatting slightly 2023-04-16 14:33:42 +02:00
fs fs/cpio: allow users to provide their own dracut modules 2023-02-06 22:46:35 +01:00
linux linux: use BR2_MAKE 2023-04-10 17:24:15 +02:00
package package/pkg-golang.mk: add osusergo and netgo tags in static builds 2023-04-16 21:56:52 +02:00
support Makefile: merge check-flake8 into check-package 2023-04-09 22:33:24 +02:00
system system: Warn if systemd is used with kernel < 4.15 2023-02-07 22:51:26 +01:00
toolchain toolchain/toolchain-external/toolchain-external-codescape-mti-mips: remove wrong MIPS32r5 and MIPS64r5 support 2023-02-15 22:00:05 +01:00
utils utils/checkpackagelib: check for Upstream trailers 2023-04-15 19:36:50 +02:00
.checkpackageignore checkpacakge: regenerate ignore list in reference build envirnment 2023-04-15 20:00:08 +02:00
.clang-format .clang-format: initial import from Linux 5.15.6 2022-01-01 15:01:13 +01:00
.defconfig
.flake8
.gitignore
.gitlab-ci.yml .gitlab-ci.yml: update Docker image to use 2023-02-07 18:15:00 +01:00
.shellcheckrc utils/check-package: improve shellcheck reproducibility 2022-07-25 23:52:47 +02:00
CHANGES Update for 2022.02.11 2023-03-19 14:58:53 +01:00
Config.in toolchain: make paranoid check of library/header paths unconditional 2023-02-05 15:11:25 +01:00
Config.in.legacy Merge branch 'next' 2023-03-12 22:45:36 +01:00
COPYING
DEVELOPERS package/python-pep517: drop package 2023-04-09 23:11:41 +02:00
Makefile Makefile: merge check-flake8 into check-package 2023-04-09 22:33:24 +02:00
Makefile.legacy
README docs: move the IRC channel away from Freenode 2021-05-29 22:16:23 +02:00

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on OFTC IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches