Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Jason E. Aten
On Saturday, February 10, 2018 at 2:18:23 AM UTC+7, andrey mirtchovski wrote: > > If you mix dynamic libraries with static ones in the same folder the > -L -l trick won't work. a workaround is to softlink the .a files to a > separate folder so that the linker doesn't see the .so/.dylib files.

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread andrey mirtchovski
If you mix dynamic libraries with static ones in the same folder the -L -l trick won't work. a workaround is to softlink the .a files to a separate folder so that the linker doesn't see the .so/.dylib files. On Fri, Feb 9, 2018 at 12:11 PM, Jason E. Aten wrote: >> Note that

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Jason E. Aten
> > Note that the _ALLOW environment variables hold a regular expression, > so you could also write CGO_LDFLAGS_ALLOW='.*\.a'. > Thank you, Ian. That's much more palatable. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Ian Lance Taylor
On Fri, Feb 9, 2018 at 10:05 AM, Jason E. Aten wrote: > Yay. I found a workaround--or rather, finally understood one of the > suggestions. > > Adding the following CGO_LDFLAGS_ALLOW hack in the Makefiles allows linking > against the named .a file. > > export >

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Jason E. Aten
Yay. I found a workaround--or rather, finally understood one of the suggestions. Adding the following CGO_LDFLAGS_ALLOW hack in the Makefiles allows linking against the named .a file. export

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Jason E. Aten
I added comments on #23749, but sadly the -L -l suggested workaround just makes a bad situation worse. It converts a linktime error into a runtime error. Details in the 23749 comment. It appears that this CL, that adds the forgotten support for linking against .a files, is what is needed:

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread andrey mirtchovski
Please add your comments to this issue: https://github.com/golang/go/issues/23749 There are already a couple of reports for that particular usage pattern, one of which is mine. For now you have the option to do: #cgo LDFLAGS: -L${SRCDIR}/../../../LuaJIT/LuaJIT/src -lluajit -lm -ldl There are

[go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread Jason E. Aten
on OSX, with the newly minted go1.9.4 with its cgo flag restrictions, I am telling the linker what libraries to link against: (here https://github.com/gijit/gi/blob/master/vendor/github.com/glycerine/golua/lua/lua.go#L10 ) ~~~ #cgo LDFLAGS: ${SRCDIR}/../../../LuaJIT/LuaJIT/src/libluajit.a