# lang/go and libc.so.6



## ikbendeman (Dec 11, 2013)

Port lang/go installs properly, and issuing the command `go run hello.go` produces typical "Hello, world!" from the console. However, I have yet to try to actually compile anything even of medium size and I can't even remember the name of the Go compiler (6g or something like that on amd64?). Anyways, when I built it using Portmaster gave the following message:
`portmaster lang/go`

```
Installed commands in /usr/ports/lang/go/work/go/bin

The binaries expect /usr/ports/lang/go/work/go to be copied or moved to /usr/local/go
===>  Staging for go-1.2,1
===>   Generating temporary packing list
====> Compressing man pages (compress-man)
===>  Installing for go-1.2,1
===>  Checking if lang/go already installed
===>   Registering installation for go-1.2,1
pkg-static: (go-1.2,1) /usr/ports/lang/go/work/stage//usr/local/go/src/pkg/debug/elf/testdata/gcc-386-freebsd-exec - [b]shared library libc.so.6 not found[/b]
Installing go-1.2,1... done
```

`find / | grep libc.so.6`

```
/compat/linux/lib/libc.so.6
```
`find / | grep libc.so.`

```
(...a bunch of stuff from /usr/src/lib/libc.....)
/usr/lib32/libc.so.7
/lib/libc.so.7
/compat/linux/lib/libc.so.6
```

So I added to /etc/libmap.conf

```
libc.so.6            libc.so.7
```
Is this what I should have done?

I have lang/gcc46, lang/gcc47, lang/gcc48. lang/gcc49, lang/clang33 and I think I have another version of Clang installed as well. None of them install a version of lib.c.so.# libc.so.#. 

Any advice??? Should I recompile? Should I lipmap to the Linux libc? I mean, maybe that's what it's looking for but I don't think the Linuxulator is required for this port.


----------



## kpa (Dec 11, 2013)

Which version of FreeBSD? The libc.so.6 is from FreeBSD 6 as far as I can see from compatibility ports. Install misc/compat6x and see if it works that way. It's really odd though that the port requires such an ancient version of libc.so.


----------



## ikbendeman (Dec 11, 2013)

I thought about that too, I'll give it a try as I just tried re-compiling and my libmap didn't work.


----------



## ikbendeman (Dec 11, 2013)

Even weirder, notice 
	
	



```
GOARCH=amd64
```
 yet at the bottom it mentions FreeBSD-386-exec or something of that nature? I installed misc/compat6x and it didn't look like it installed libc.so.6 but I'll check pkg-plist and even if not I'll try to rebuild again anyways. It _appears_ to be working but that message isn't giving me much confidence. 

`portmaster lang/go`

```
===>>> Starting build for lang/go <<<===

===>>> All dependencies are up to date

===>  Cleaning for go-1.2,1
===>  License BSD accepted by the user
===>   go-1.2,1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by go-1.2,1 for building
===>  Extracting for go-1.2,1
=> SHA256 Checksum OK for go1.2.src.tar.gz.
===>  Patching for go-1.2,1
===>  Applying FreeBSD patches for go-1.2,1
===>  Configuring for go-1.2,1
===>  Building for go-1.2,1
cd /usr/ports/lang/go/work/go/src &&  CC=cc  GOROOT=/usr/ports/lang/go/work/go GOROOT_FINAL=/usr/local/go  GOBIN= GOARCH=amd64 GOOS=freebsd  /bin/sh make.bash
# Building C bootstrap tool.
cmd/dist

# Building compilers and Go bootstrap tool for host, freebsd/amd64.
lib9
libbio
libmach
misc/pprof
cmd/addr2line
cmd/nm
cmd/objdump
cmd/pack
cmd/prof
cmd/cc
cmd/gc
cmd/6l
cmd/6a
cmd/6c
cmd/6g
pkg/runtime
pkg/errors
pkg/sync/atomic
pkg/sync
pkg/io
pkg/unicode
pkg/unicode/utf8
pkg/unicode/utf16
pkg/bytes
pkg/math
pkg/strings
pkg/strconv
pkg/bufio
pkg/sort
pkg/container/heap
pkg/encoding/base64
pkg/syscall
pkg/time
pkg/os
pkg/reflect
pkg/fmt
pkg/encoding
pkg/encoding/json
pkg/flag
pkg/path/filepath
pkg/path
pkg/io/ioutil
pkg/log
pkg/regexp/syntax
pkg/regexp
pkg/go/token
pkg/go/scanner
pkg/go/ast
pkg/go/parser
pkg/os/exec
pkg/os/signal
pkg/net/url
pkg/text/template/parse
pkg/text/template
pkg/go/doc
pkg/go/build
cmd/go

# Building packages and commands for freebsd/amd64.
runtime
errors
sync/atomic
unicode
unicode/utf8
math
sort
encoding
unicode/utf16
crypto/subtle
container/list
container/heap
sync
container/ring
image/color
runtime/race
io
syscall
hash
crypto/cipher
bytes
strings
hash/crc32
crypto/hmac
hash/adler32
hash/crc64
hash/fnv
image/color/palette
text/tabwriter
bufio
path
html
time
compress/bzip2
strconv
math/rand
math/cmplx
os
crypto
reflect
encoding/base64
regexp/syntax
net/url
crypto/aes
crypto/rc4
crypto/md5
crypto/sha1
crypto/sha256
encoding/pem
crypto/sha512
encoding/ascii85
path/filepath
os/exec
os/signal
encoding/base32
regexp
image
io/ioutil
encoding/binary
fmt
image/draw
image/jpeg
debug/dwarf
crypto/des
index/suffixarray
flag
go/token
encoding/json
encoding/xml
text/template/parse
log
compress/flate
math/big
encoding/hex
go/scanner
mime
debug/elf
debug/macho
debug/pe
text/template
compress/gzip
go/ast
crypto/elliptic
crypto/rand
crypto/dsa
encoding/asn1
crypto/rsa
runtime/pprof
cmd/yacc
archive/tar
archive/zip
crypto/ecdsa
compress/lzw
compress/zlib
database/sql/driver
crypto/x509/pkix
debug/gosym
encoding/csv
encoding/gob
html/template
image/gif
image/png
database/sql
runtime/debug
testing
go/parser
go/printer
go/doc
testing/iotest
testing/quick
text/scanner
cmd/cgo
go/format
cmd/gofmt
cmd/fix
go/build
runtime/cgo
net
os/user
crypto/x509
net/textproto
log/syslog
mime/multipart
net/mail
crypto/tls
net/http
net/smtp
cmd/go
expvar
net/http/cgi
net/http/cookiejar
net/http/httptest
net/http/httputil
net/http/pprof
net/rpc
net/http/fcgi
net/rpc/jsonrpc


---
Installed Go for freebsd/amd64 in /usr/ports/lang/go/work/go
Installed commands in /usr/ports/lang/go/work/go/bin

The binaries expect /usr/ports/lang/go/work/go to be copied or moved to /usr/local/go

===>>> Creating a backup package for old version go-1.2,1
Creating package for go-1.2,1
pkg: (go-1.2,1) /usr/local/go/src/pkg/debug/elf/testdata/gcc-386-freebsd-exec - shared library libc.so.6 not found
Deinstallation has been requested for the following 1 packages:

	go-1.2,1

The deinstallation will free 114 MB
[1/1] Deleting go-1.2,1... done

===>  Staging for go-1.2,1
===>   Generating temporary packing list
====> Compressing man pages (compress-man)
===>  Installing for go-1.2,1
===>  Checking if lang/go already installed
===>   Registering installation for go-1.2,1
pkg-static: (go-1.2,1) /usr/ports/lang/go/work/stage//usr/local/go/src/pkg/debug/elf/testdata/gcc-386-freebsd-exec - shared library libc.so.6 not found
Installing go-1.2,1... done

===>>> Creating a package for new version go-1.2,1
pkg-static: (go-1.2,1) /usr/ports/lang/go/work/stage/usr/local/go/src/pkg/debug/elf/testdata/gcc-386-freebsd-exec - shared library libc.so.6 not found
	===>>> Package saved to /usr/ports/packages/All

===>>> Re-installation of go-1.2,1 complete

===>>> Exiting
```


Also, I should have included this along time ago:
`uname -a`

```
FreeBSD fbsd.local 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013     root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```


----------



## kpa (Dec 11, 2013)

The compat port installs it as /usr/local/lib/compat/libc.so.6. That is probably not going to be used for building new ports. That's even weirder if the old library is needed at build time when there's an up to date library already in the system.  I would contact the port maintainer about the issue.


----------



## ikbendeman (Dec 12, 2013)

Yep that's the only option. It's still working, installing etc, but the old pkg message is gone (about setting environment variables) and everything so far seems fine. I just get that weird error during the install, not the build.


----------



## SirDice (Dec 12, 2013)

kpa said:
			
		

> The compatThat's even weirder if the old library is needed at build time when there's an up to date library already in the system.


It looks like it's using some pre-built executable to bootstrap the build process. Probably very much like you need java to be able to build java (this requires FREEBSD_COMPAT7). And I'm guessing the pre-compiled bootstrap was built for FreeBSD 6 hence the need for the FreeBSD 6 libc. But I would have expected the port to depend on misc/compat6x.


----------



## Gwyneth Llewelyn (Nov 28, 2017)

I know I'm bumping up an old thread, but I'm still using FreeBSD 10.3-RELEASE-p11 and when installing the latest version of go (1.9.2 at the time of writing this), I still continue to get this error. I'm well aware that this version of FreeBSD is unsupported. Nevertheless, after installation, go works perfectly, the error only occurs during install (of both go 1.4, required to compile 1.9.2, as well as when finally installing go 1.9.2).


----------



## xavi (Nov 28, 2017)

Gwyneth Llewelyn said:


> I'm well aware that this version of FreeBSD is unsupported.



Actually, 10.3-RELEASE is supported until April 30th 2018. Supported FreeBSD releases are documented here. I would take the advice of kpa above and contact the port maintainer for assistance.


----------



## SirDice (Nov 28, 2017)

Yep, 10.3-RELEASE is still supported.


----------



## kmsp (Feb 7, 2018)

Installing go-1.9.3 on a brand new instance of 11.1-RELEASE-p4, and receive the same error yet.  Looks like the culprit is in  
src/debug/elf/symbols_test.go of both go-1.9.3 and 1.4.


```
symbols_test.go:                        Name:    "puts@@GLIBC_2.2.5",
symbols_test.go:                        Name:    "__libc_start_main@@GLIBC_2.2.5",
```

GLIBC_2.2.5--released January, 2002--provides libc.so.6.  And apparently, GLIBC_X.Y.Z still provides libc.so.6. Read more under "Linux libc" on the libc(7) manpage from our Linux colleagues: http://man7.org/linux/man-pages/man7/libc.7.html

However, what remains unknown to me is if this could cause production or security issues.


----------

