On Wed, Feb 5, 2020 at 9:33 AM Florent Bonneau
<
tnerolf...@gmail.com> wrote:
>
> Using docker image golang:1.13-alpine to build our code :
> - Compiling with "go install -v oursoftware/..." our build is sucessfull
> - Compiling with "go install -v -trimpath oursoftware/..." fails with following error :
>
>
> ...
>
> runtime
> runtime/cgo
> vendor/
golang.org/x/crypto/curve25519
> # runtime/cgo
> exec: "gcc": executable file not found in $PATH
> encoding
> ...
>
> We can for sure install the build tools upon the base image to solve the issue, but it doesn't seem normal that the "-trimpath" option had this side-effect ?
>
> Can someone explain why it happens ?
I haven't verified this, so this is just a guess, but perhaps without
-trimpath the go tool is using the prebuilt runtime/cgo.a, which was
built on a system with a C compiler. When you add -trimpath, the
runtime/cgo package needs to be rebuilt in order to trim the paths.
Unfortunately, that rebuild fails, as the system you are building on
does not have a C compiler.
Ian