LD_LIBRARY_PATH is required when bootstrapping Go with gccgo (non-standard location)

124 views
Skip to first unread message

Bagas Sanjaya

unread,
May 23, 2021, 6:57:35 AM5/23/21
to golang-nuts
Hi,

Today I have built GCC 11.1.0 for use to bootstrap Go using gccgo.
I installed GCC to non-standard path, that is inside my home directory
(~/.ct-ng/tools/gcc-11.1.10) (sorry for typo when building GCC, I
meant gcc-11.1.0).

`gcc -v` gave:

> COLLECT_GCC=/home/bagas/.ct-ng/tools/gcc-11.1.10/bin/gcc
> COLLECT_LTO_WRAPPER=/home/bagas/.ct-ng/tools/gcc-11.1.10/libexec/gcc/x86_64-pc-linux-gnu/11.1.0/lto-wrapper
> Target: x86_64-pc-linux-gnu
> Configured with: ../configure --prefix=/home/bagas/.ct-ng/tools/gcc-11.1.10 --disable-multilib --enable-languages=c,c++,go --enable-default-pie
> Thread model: posix
> Supported LTO compression algorithms: zlib
> gcc version 11.1.0 (GCC)

Then I bootstrapped Go using gccgo from GCC 11.1.0. Because I installed
GCC to non-standard path, I had to add LD_LIBRARY_PATH when invoking
`make.bash`:

```
$ LD_LIBRARY_PATH=/home/bagas/.ct-ng/tools/gcc-11.1.10/lib64 \
GOROOT_BOOTSTRAP=/home/bagas/.ct-ng/tools/gcc-11.1.10 \
./make.bash
```
Bootstrapping process took about thirty minutes to complete.

Note that LD_LIBRARY_PATH was required because `go` command from
gccgo was dynamically linked with supporting library `libgo.so`,
and the library was installed to non-standard path.

However, on official installation from source instructions [1], gccgo
was assumed to be installed from distribution's package manager,
and thus was installed to standard path (/usr), so LD_LIBRARY_PATH
isn't required.

Maybe the documentation should be updated to take into account
gccgo installations that are installed on non-standard paths
like my case above.

[1]: https://golang.org/doc/install/source#bootstrapFromGccgo

--
An old man doll... just what I always wanted! - Clara

Ian Lance Taylor

unread,
Jun 2, 2021, 7:49:05 PM6/2/21
to Bagas Sanjaya, golang-nuts
Thanks, but I think it's implied that if you want to use gccgo to
bootstrap Go, then the gccgo installation has to work. I don't think
we want to get into all possible details of how to get your gccgo
installation to work. LD_LIBRARY_PATH is just one of many different
possible issues.

Ian
Reply all
Reply to author
Forward
0 new messages