Skip to content

Recreate of issue #203 #306

@tdolby

Description

@tdolby

Bumped into the same issue as described in #203 while building with gccgo on ppc64 (big endian):

$ go get github.com/mattn/go-sqlite3
$ go install src/github.com/mattn/go-sqlite3/_example/simple/simple.go
# command-line-arguments
/usr/bin/ld: $WORK/libgo-sqlite3.a893956317(sqlite3-binding.o): undefined reference to symbol 'pthread_mutexattr_destroy@@GLIBC_2.3'
/usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

but as @ianlancetaylor rightly pointed out, this ought not to be happening because libpthread should be linked in automatically. The code works fine on linux-amd64 with gccgo 5.3.0 (go v1.4.2), but not on linux-ppc64 with gcc-6.1.0 (go v1.6.1).

The simplest solution does seem to be to add -lpthread into LDFLAGS in this package, but if you'd rather I chase the gccgo side of things instead then this issue can be closed; it seemed worth providing the recreate (missing from #203) just in case it helps (even if it's just a misconfiguration of gccgo).

Version for gccgo:

$ gccgo -v
Using built-in specs.
COLLECT_GCC=gccgo
COLLECT_LTO_WRAPPER=/usr/contrib/libexec/gcc/powerpc64-unknown-linux-gnu/6.1.0/lto-wrapper
Target: powerpc64-unknown-linux-gnu
Configured with: ../gcc-6.1.0/configure --prefix=/usr/contrib --enable-languages=c,c++,go --disable-multilib
Thread model: posix
gcc version 6.1.0 (GCC) 

libgo ldd output:

$ ldd /usr/contrib/lib64/libgo.so
        linux-vdso64.so.1 (0x00003fff9d5a0000)
        libpthread.so.0 => /lib64/power6/libpthread.so.0 (0x00003fff9bfb0000)
        libm.so.6 => /lib64/power6/libm.so.6 (0x00003fff9bec0000)
        libgcc_s.so.1 => /usr/contrib/lib64/libgcc_s.so.1 (0x00003fff9be80000)
        libc.so.6 => /lib64/power6/libc.so.6 (0x00003fff9bc60000)
        /lib64/ld64.so.1 (0x0000000028430000)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions