swig and go - g++4.8 does not have -no-pie

893 views
Skip to first unread message

jkl...@ucdavis.edu

unread,
Jun 23, 2017, 5:09:48 PM6/23/17
to golang-nuts
Hi, I'm trying to wrap a c++ library with swig to be called by Go. 

I've gotten "go build" to run up to the point to where I get the error:
g++-4.8: error: unrecognized command line option '-no-pie'

The library I'm using is only supported up to g++ 4.8. Is there any way around this command?

Ian Lance Taylor

unread,
Jun 23, 2017, 5:43:11 PM6/23/17
to jkl...@ucdavis.edu, golang-nuts
Which version of Go are you using? You may be running into
https://golang.org/issue/15900 or something along those lines.

Ian

jkl...@ucdavis.edu

unread,
Jun 23, 2017, 5:52:17 PM6/23/17
to golang-nuts, jkl...@ucdavis.edu
go version go1.7.4 linux/amd64


The link you're referring to is an issue with the LANG env variable; mine is set to LANG=en_US.UTF-8 which the OP mentioned go build succeeds with 

Ian Lance Taylor

unread,
Jun 23, 2017, 8:54:08 PM6/23/17
to jkl...@ucdavis.edu, golang-nuts
On Fri, Jun 23, 2017 at 2:52 PM, <jkl...@ucdavis.edu> wrote:
> go version go1.7.4 linux/amd64
>
>
> The link you're referring to is an issue with the LANG env variable; mine is
> set to LANG=en_US.UTF-8 which the OP mentioned go build succeeds with

Is it possible that you are using a different version of gcc and g++?
Currently the go tool decides whether -no-pie is supported by testing
gcc. If you are using a newer version of gcc, then perhaps it is
incorrectly concluding that g++ supports -no-pie.

Ian


> On Friday, June 23, 2017 at 2:43:11 PM UTC-7, Ian Lance Taylor wrote:
>>
>> On Fri, Jun 23, 2017 at 2:09 PM, <jkl...@ucdavis.edu> wrote:
>> >
>> > Hi, I'm trying to wrap a c++ library with swig to be called by Go.
>> >
>> > I've gotten "go build" to run up to the point to where I get the error:
>> > g++-4.8: error: unrecognized command line option '-no-pie'
>> >
>> > The library I'm using is only supported up to g++ 4.8. Is there any way
>> > around this command?
>>
>> Which version of Go are you using? You may be running into
>> https://golang.org/issue/15900 or something along those lines.
>>
>> Ian
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

jkl...@ucdavis.edu

unread,
Jun 26, 2017, 12:34:58 AM6/26/17
to golang-nuts, jkl...@ucdavis.edu
Thanks, my gcc and g++ versions were indeed different. I've set them both to 4.8 now and the -no-pie error has gone away.

I'm seeing warnings from "go build" command regarding syntax in the c++ library - if they are just warnings, would go install continue with placing output files in the $GOBIN folder? (I don't see any files in my $GOBIN folder)

Ian Lance Taylor

unread,
Jun 26, 2017, 3:06:17 AM6/26/17
to Joanna .Leong, golang-nuts
On Sun, Jun 25, 2017 at 9:34 PM, <jkl...@ucdavis.edu> wrote:
> Thanks, my gcc and g++ versions were indeed different. I've set them both to
> 4.8 now and the -no-pie error has gone away.
>
> I'm seeing warnings from "go build" command regarding syntax in the c++
> library - if they are just warnings, would go install continue with placing
> output files in the $GOBIN folder? (I don't see any files in my $GOBIN
> folder)

Warnings shouldn't affect the build. Note that `go build` doesn't put
anything in $GOBIN, but `go install` should put main packages there.

Ian

jkl...@ucdavis.edu

unread,
Jun 26, 2017, 12:10:11 PM6/26/17
to golang-nuts, jkl...@ucdavis.edu
awesome go install is working :) thanks so much!
Reply all
Reply to author
Forward
0 new messages