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 other options discussed in that thread.

On Fri, Feb 9, 2018 at 9:11 AM, Jason E. Aten <j.e.a...@gmail.com> wrote:
> 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 -lm -ldl
> ~~~
>
> produces on attempt to build:
>
> ~~~
> make build
> go build -ldflags "-X
> main.LastGitCommitHash=30259813c10c0f6b63768b4f35358828e2e29f0b -X
> main.BuildTimeStamp=2018-02-09T22:49:48+0700 -X main.GitBranch=master -X
> main.NearestGitTag=v0.9.6  -X
> main.GoVersion=go_version_go1.9.4_darwin/amd64" -o gi
> go build github.com/gijit/gi/vendor/github.com/glycerine/golua/lua: invalid
> flag in #cgo LDFLAGS:
> /Users/jaten/go/src/github.com/gijit/gi/vendor/github.com/glycerine/golua/lua/../../../LuaJIT/LuaJIT/src/libluajit.a
> make[2]: *** [build] Error 1
> make[1]: *** [install] Error 2
> make: *** [install] Error 2
> jaten@jatens-MacBook-Pro ~/go/src/github.com/gijit/gi (master) $
> ~~~
>
> So.... how do I tell cgo to link against these libraries in 1.9.4?
>
> Going down the path of crazy, I tried setting
> CGO_CFLAGS_ALLOW="$(GOPATH)/github.com/gijit/gi/vendor/github.com/glycerine/golua/lua/../../../LuaJIT/LuaJIT/src/libluajit.a",
> but even so I still get:
> ~~~
> go build -ldflags "-X
> main.LastGitCommitHash=30259813c10c0f6b63768b4f35358828e2e29f0b -X
> main.BuildTimeStamp=2018-02-09T23:08:10+0700 -X main.GitBranch=master -X
> main.NearestGitTag=v0.9.6  -X
> main.GoVersion=go_version_go1.9.4_darwin/amd64" -o gi
> go build github.com/gijit/gi/vendor/github.com/glycerine/golua/lua: invalid
> flag in #cgo LDFLAGS:
> /Users/jaten/go/src/github.com/gijit/gi/vendor/github.com/glycerine/golua/lua/../../../LuaJIT/LuaJIT/src/libluajit.a
> make[2]: *** [build] Error 1
> make[1]: *** [install] Error 2
> make: *** [minimal] Error 2
> jaten@jatens-MacBook-Pro ~/go/src/github.com/gijit/gi (master) $
> ~~~
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to