Compile Go 1.4.3 failed on Ubuntu 16.04

As the topic title, while I cd the src folder and run ./all.bash, get below errors:

net/rpc
net/rpc/jsonrpc

cmd/pprof

/home/hiler/Desktop/Tool/go14/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/hiler/Desktop/Tool/go14/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298

cmd/go

/home/hiler/Desktop/Tool/go14/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/hiler/Desktop/Tool/go14/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298

hiler@Hiler ~/Desktop/Tool/go14/src (go1.4.3 *) $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

is not a good ideea to use older versions of golang. use the last version (1.6.3 now). also, you can use this tool to properly install everything.

I’m trying to learn the source code of Go.
Go 1.4 is the base to compile the versions after 1.4

I successfully compiled it on Ubuntu 14.04.4 LTS


Installed Go for linux/amd64 in /root/go1.4
Installed commands in /root/go1.4/bin
root@cncore:~/go1.4/src# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty

I agree that this ought to be fixed, whatever it is.

That said, for your experimenting, you can download the latest binary release of 1.6.3 for example, and use that to bootstrap the source release. It doesn’t have to be 1.4, that’s just the oldest that can possibly work.

If you’re compiling 1.4.3 to bootstrap another version, you can disable cgo to fix this problem.

env CGO_ENABLED=0 ./make.bash
2 Likes

it works, thank you very much.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.