You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Me again testing weird cross-compilation options and think I've found another problem
I have created a package and installed it that contains a few functions, structs and interfaces and have been able to use it successfully when using go build.
I'd like to write a shim package for interfacing with C code and have run up against the following error:
$ go build -v -buildmode=c-archive fli_wrapper.go
command-line-arguments
# command-line-arguments
/usr/local/go/pkg/tool/linux_386/link: running ar failed: exit status 1
ar: /go.o: No such file or directory
I have my custom package modemmanager built and installed:
ls ../../pkg/linux_386/
github.com/ golang.org/ gopkg.in/ modemmanager.a
But when I try and build the following I get the previous error:
package main
import (
mm "modemmanager"
"log"
"net"
"net/rpc/jsonrpc"
)
func GetAvailableModems() {
log.Println("Getting Modems...")
// Dial up the remote server
conn, err := net.Dial("tcp", "localhost:8222")
if err != nil {
panic(err)
}
defer conn.Close()
c := jsonrpc.NewClient(conn)
// Get the available modems
modems := make([]mm.Modem, 0)
log.Println("Empty:", modems)
// calling method on RPC server
err = c.Call("ModemManager.GetAvailableModems", &modems, &modems)
if err != nil {
log.Fatal("error:", err)
}
log.Println("Success: ", modems)
}
func main() { }
The modemmanager package consists of simply ~/gopath/src/modemmanager/common.go which defines the package modemmanager.
It makes no difference if I have the package available locally and specify the relative package location. Any ideas on why it can't run ar?
The text was updated successfully, but these errors were encountered:
is there a way to reproduce the problem?
please try running your first command with a few added options:
go build -v -x -ldflags "-v" -buildmode=c-archive fli_wrapper.go
and paste the output here. Thanks.
ianlancetaylor
changed the title
Creating an archive from an installed package fails
cmd/link: Creating an archive from an installed package fails
Sep 3, 2015
I had a weird path issue and it was picking up the wrong library (one without an import "C" and //export directives) so just user-error in that case.
The only real take-home from this is that the error message makes no reference to the lack of exports/import "C" and gives an AR failure instead. Closing as, well, it's solved.
Me again testing weird cross-compilation options and think I've found another problem
I have created a package and installed it that contains a few functions, structs and interfaces and have been able to use it successfully when using go build.
I'd like to write a shim package for interfacing with C code and have run up against the following error:
I have my custom package modemmanager built and installed:
But when I try and build the following I get the previous error:
The modemmanager package consists of simply
~/gopath/src/modemmanager/common.go
which defines the package modemmanager.It makes no difference if I have the package available locally and specify the relative package location. Any ideas on why it can't run ar?
The text was updated successfully, but these errors were encountered: