Comment 1 for bug 1524374

Revision history for this message
Jonathan Cave (jocave) wrote :

After trying to track down why was causing this symptom I found that where the go plugin creates a custom environment for running commands it adds its own LDFLAGS like this:

env = [
            'GOPATH={}/go'.format(root),
            'CGO_LDFLAGS=$CGO_LDFLAGS"' + ' '.join([
                '-L{0}/lib',
                '-L{0}/usr/lib',
                '-L{0}/lib/{1}',
                '-L{0}/usr/lib/{1}',
                '$LDFLAGS'
            ]).format(root, snapcraft.common.get_arch_triplet()) + '"',

I think when this added to scripts that are used to configure the environment the fact that the CGO_LDFLAGS is outside the quote marks causes issues in some circumstances. I have found changing this to the following allows these builds to work fine:

env = [
            'GOPATH={}/go'.format(root),
            'CGO_LDFLAGS="$CGO_LDFLAGS ' + ' '.join([
                '-L{0}/lib',
                '-L{0}/usr/lib',
                '-L{0}/lib/{1}',
                '-L{0}/usr/lib/{1}',
                '$LDFLAGS'
            ]).format(root, snapcraft.common.get_arch_triplet()) + '"',