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
$ mkdir -p $HOME/gotest/src/test
$ cat > $HOME/gotest/src/test/test.go
package main
import "C"
//export exportedFunc
func exportedFunc() {}
func main() {}
$ GOPATH=$HOME/gotest go install -buildmode=c-shared test
$ cat > $HOME/gotest/src/test/test.go
package main
import "C"
//export exportedFunc
func exportedFunc() {}
func main() {
}
$ GOPATH=$HOME/gotest go install -buildmode=c-shared -x test
....
cp $WORK/test/_obj/_cgo_install.h /usr/local/google/home/spetrovic/gotest/pkg/linux_amd64_shared/test.h
build output "/usr/local/google/home/spetrovic/gotest/pkg/linux_amd64_shared/test.h" already exists and is not an object file
The problem is that $WORK and $HOME are on different devices in my setup, and hence the os.Rename() fails to move the file _cgo_install.h with: "invalid cross-device link"; cmd/go/build.go then tries to copy the file over, but this code causes it to fail as well:
if !isObject(dst) {
return fmt.Errorf("build output %q already exists and is not an object file", dst)
}
My question is, what is the purpose of this isObject() check and can we get rid of it?
The text was updated successfully, but these errors were encountered:
The isObject check is not appropriate for _cgo_install.h. It is meaningful for the case where copyFile is called from moveOrCopyFile when called from builder.install, because of http://golang.org/issue/2829 . But we should add a flag parameter, or something along those lines, to skip the test when copying a header file.
mikioh
changed the title
Copying of _cgo_install.h causes problems when $WORK and $GOPATH are on different disks.
cmd/go: Copying of _cgo_install.h causes problems when $WORK and $GOPATH are on different disks.
Jun 13, 2015
NOTE: this problem only occurs when building using -buildmode=c-shared
Here is my reproducible setup:
export TMPDIR=/tmp
export HOME=/usr/local/google/home/$USER
$ mkdir -p $HOME/gotest/src/test
$ cat > $HOME/gotest/src/test/test.go
package main
import "C"
//export exportedFunc
func exportedFunc() {}
func main() {}
$ GOPATH=$HOME/gotest go install -buildmode=c-shared test
$ cat > $HOME/gotest/src/test/test.go
package main
import "C"
//export exportedFunc
func exportedFunc() {}
func main() {
}
$ GOPATH=$HOME/gotest go install -buildmode=c-shared -x test
....
cp $WORK/test/_obj/_cgo_install.h /usr/local/google/home/spetrovic/gotest/pkg/linux_amd64_shared/test.h
build output "/usr/local/google/home/spetrovic/gotest/pkg/linux_amd64_shared/test.h" already exists and is not an object file
The problem is that $WORK and $HOME are on different devices in my setup, and hence the os.Rename() fails to move the file _cgo_install.h with: "invalid cross-device link"; cmd/go/build.go then tries to copy the file over, but this code causes it to fail as well:
if !isObject(dst) {
return fmt.Errorf("build output %q already exists and is not an object file", dst)
}
My question is, what is the purpose of this isObject() check and can we get rid of it?
The text was updated successfully, but these errors were encountered: