Skip to content

Recreate of issue #203 #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tdolby opened this issue May 20, 2016 · 16 comments
Closed

Recreate of issue #203 #306

tdolby opened this issue May 20, 2016 · 16 comments

Comments

@tdolby
Copy link

tdolby commented May 20, 2016

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)
gjrtimmer added a commit to gjrtimmer/go-sqlite3 that referenced this issue May 30, 2018
Add: -lpthread for ppc / ppc64

Issue: mattn#306

[ci ckip]
@gjrtimmer
Copy link
Collaborator

@tdolby can you please checkout branch fix/306 and try to compile for linux-ppc64.

@gjrtimmer
Copy link
Collaborator

@tdolby any update ?

@tdolby
Copy link
Author

tdolby commented Jun 15, 2018

@gjrtimmer Sorry - missed the first notification :( I'll try and test this early next week.

@gjrtimmer
Copy link
Collaborator

@tdolby I hope the fix works for you.

@gjrtimmer gjrtimmer self-assigned this Jun 18, 2018
gjrtimmer added a commit that referenced this issue Jun 18, 2018
Add: -lpthread for ppc / ppc64

Issue: #306

[ci ckip]
@gjrtimmer
Copy link
Collaborator

@tdolby I rebased fix/306 with the latest master.

@gjrtimmer
Copy link
Collaborator

@tdolby fix/306 branch successful with Travis-CI we will await your test.

@gjrtimmer
Copy link
Collaborator

@tdolby Any success ?

@tdolby
Copy link
Author

tdolby commented Jun 20, 2018

Having issues building now, as it looks like the world has moved on: when I run

$ go get github.com/mattn/go-sqlite3

I now get

package context: unrecognized import path "context" (import path does not begin with hostname)

which looks like I need go 1.7 and can't build with gccgo 6.1.0 . . .

I shall try and get gcc7 going and see how it works there.

@tdolby
Copy link
Author

tdolby commented Jun 20, 2018

I don't have gcc7 working yet, but I have applied your branch changes on top of release 1.2 (which does work with go 1.6) and they build successfully. From the perspective of the original environment, your fix is looking good, and works for ppc64.

From the perspective of current source, I haven't confirmed that the solution still works with current master code and recent GCC versions; I can try and get that going if it's worthwhile?

@gjrtimmer
Copy link
Collaborator

@tdolby I think you should give it a try, I will incorperate the fix at least into the current v2.0.0 branch I'm building

@gjrtimmer gjrtimmer mentioned this issue Jun 20, 2018
@gjrtimmer
Copy link
Collaborator

gjrtimmer commented Jun 20, 2018

@tdolby made small change, included the options within sqlite3_other.go instead of separate files and included ppc64le also. Would it be too much to do a quick retest after you pull the latest change from fix/306 ? I also created a PR so when Travis-CI is successful you can start using the master branch.

@tdolby
Copy link
Author

tdolby commented Jun 20, 2018

No problem - I'm building gccgo 7.3 right now but can certainly try out the new changes on that version and also 6.1.0.

@gjrtimmer
Copy link
Collaborator

gjrtimmer commented Jun 20, 2018

@tdolby Sounds great, PR is awaiting your test and approval.

gjrtimmer added a commit that referenced this issue Jun 20, 2018
Included fix 306.

Closes #306
@gjrtimmer
Copy link
Collaborator

Add

Enhancement:

  • ppc
  • ppc64
  • ppc64le

@gjrtimmer
Copy link
Collaborator

@tdolby any update on latest test ?

@tdolby
Copy link
Author

tdolby commented Jun 28, 2018

Yes - just finished testing everything with gccgo 6.1, 7.3, and 8.1 on ppc64, and everything works as expected. The patched sqllite3 1.2 source works for all compilers, and the current 306 source works for 7.3 and 8.1 due to language constraints described above stopping 6.1 from working.

Thanks for fixing this!

gjrtimmer added a commit that referenced this issue Jun 28, 2018
Add: -lpthread for ppc / ppc64

Issue: #306

[ci ckip]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants