Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: working dir for link changed between Go 1.0.3 and Go 1.1 #5319

Closed
gopherbot opened this issue Apr 19, 2013 · 13 comments
Closed

cmd/go: working dir for link changed between Go 1.0.3 and Go 1.1 #5319

gopherbot opened this issue Apr 19, 2013 · 13 comments
Milestone

Comments

@gopherbot
Copy link

by cgmurray:

What steps will reproduce the problem?
run "go test -x ROOT_PACKAGE/..." with go 1.0.3 and tip (13e00572ed0b)

What is the expected output?
working directory is changed for every package with go 1.1, "cd ... or
equivalent"

What do you see instead?
working directory is not changed for every package as with go 1.0.3

Which compiler are you using (5g, 6g, 8g, gccgo)?
-

Which operating system are you using?
osx

Which version are you using?  (run 'go version')
go version devel +13e00572ed0b Thu Apr 18 17:37:21 2013 -0700 darwin/amd64

Please provide any additional information below.
This might break backwards compatibility. In the specific use-case a relative
library-path is set with -L
@minux
Copy link
Member

minux commented Apr 19, 2013

Comment 1:

are you sure about this?
In my test, there is a "cd package_dir" before the build commands.
please provide the output of "go test -x ROOT_PACKAGE/...", or
perhaps write a example using relative library with -L to
demonstrate the problem?

Status changed to WaitingForReply.

@gopherbot
Copy link
Author

Comment 2 by cgmurray:

I actually missed the cd commands but the symptom is similar. A self-contained
bash-script to demonstrate the problem is attached.

Attachments:

  1. issue5319.bash (491 bytes)

@minux
Copy link
Member

minux commented Apr 19, 2013

Comment 3:

the problem is that we never supported put a relative path reference
to an object file in CGO_LDFLAGS. Because when the package is actually
used, the relative path is guaranteed to be incorrect.
if you change p.go to actually invoke C.F() and p_test.go to actually
invoke F(), you will see go 1.0.3 couldn't handle this either.

@gopherbot
Copy link
Author

Comment 4 by cgmurray:

I understand but my example was a bit contrived. I my real case I link to a shared
library. An updated version of the script attached. Note that it's written for osx. In
order to run it on linux "gcc -dynamiclib" must be replaced with "gcc -shared" and
"export DYLD_LIBRARY_PATH=..." with "export LD_LIBRARY_PATH=..."
Is relative library paths supported in go 1.x?

Attachments:

  1. issue5319.bash (593 bytes)

@gopherbot
Copy link
Author

Comment 5 by cgmurray:

Forgot to mention that libissue5319.dylib must be replaced with libissue5319.so on linux.

@minux
Copy link
Member

minux commented Apr 19, 2013

Comment 6:

you could embed rpath into the executable by adding -Wl,-rpath,PATH to
CGO_LDFLAGS, but bear in mind that PATH could need to be absolute.
ps: take a look at $GOROOT/misc/cgo/testso.

@gopherbot
Copy link
Author

Comment 7 by cgmurray:

Do we agree on that the behaviour has changed between go 1.0.3 and tip? The latest
scripts works with 1.0.3 but not with tip.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 8:

FWIW, I have not confirmed the report, and I am not sure it is something we need to fix
regardless.

Labels changed: added priority-later, go1.2maybe, removed priority-triage.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 9:

Labels changed: added feature.

@robpike
Copy link
Contributor

robpike commented Aug 16, 2013

Comment 10:

Unclear. Deferring to 1.3

Labels changed: added go1.3maybe, removed go1.2maybe.

@robpike
Copy link
Contributor

robpike commented Aug 20, 2013

Comment 11:

Labels changed: removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Sep 3, 2013

Comment 12:

I'd like to at least understand this better before we cut Go 1.2. We may not change
anything.

Labels changed: added go1.2maybe, removed feature.

@rsc
Copy link
Contributor

rsc commented Sep 10, 2013

Comment 13:

Status changed to Duplicate.

Merged into issue #5428.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants