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

cannot import in windows (linking error) #755

Closed
gopherbot opened this issue Apr 29, 2010 · 6 comments
Closed

cannot import in windows (linking error) #755

gopherbot opened this issue Apr 29, 2010 · 6 comments

Comments

@gopherbot
Copy link
Contributor

by pallas0328@yahoo.com.cn:

What steps will reproduce the problem?
attempting to import a local package on windows

What is the expected output? What do you see instead?
The package should import. 
Error "cannot open file c:\go/pkg/mingw_386/c:/go/prj/mytest.a" 
mytest.a is the imported file
c:\go is my goroot 
mytest.a is in c:/go/prj  

It sounds like that one in https://code.google.com/p/go/issues/detail?
id=732,but happend while lingking.
@rsc
Copy link
Contributor

rsc commented Apr 29, 2010

Comment 1:

Did you build the tools yourself?  If so, can you try applying this patch to
src/cmd/ld/lib.c and rebuilding 
them?
diff -r 7a932654bb51 src/cmd/ld/lib.c
--- a/src/cmd/ld/lib.c  Thu Apr 29 11:02:10 2010 -0700
+++ b/src/cmd/ld/lib.c  Thu Apr 29 13:28:22 2010 -0700
@@ -103,6 +103,10 @@
        sprint(name, "");
        i = 1;
    } else
+   if(isalpha(histfrog[0]->name[1]) && histfrog[0]->name[2] == ':') {
+       sprint(name, "");
+       i = 0;
+   } else
    if(histfrog[0]->name[1] == '.') {
        sprint(name, ".");
        i = 0;
Thanks.
Russ

Owner changed to r...@golang.org.

Status changed to Accepted.

@jpoirier
Copy link
Member

Comment 2:

Applied the patch to release 2010-04-27 and rebuilt on windows using mingw. Tested 
using the svgo library.
It appears there's a forward slash pre-pended to the fqfn of the library file to be 
imported. Also note that although the import fails a 0 KB executable is created.
The import block in the go test file:
import {
    svglib "./svg"
    "os"
}
cmd shell output
----------------
C:\temp\svgo>8g testsvgo.go
C:\temp\svgo>8l -o testsvgo.exe testsvgo.8
??none??: cannot open file: /C:/temp/svgo/svg.8

@rsc
Copy link
Contributor

rsc commented Apr 29, 2010

Comment 3:

Round 2: thanks for testing:
diff -r 7a932654bb51 src/cmd/ld/lib.c
--- a/src/cmd/ld/lib.c  Thu Apr 29 11:02:10 2010 -0700
+++ b/src/cmd/ld/lib.c  Thu Apr 29 14:54:41 2010 -0700
@@ -103,6 +103,10 @@
        sprint(name, "");
        i = 1;
    } else
+   if(isalpha(histfrog[0]->name[1]) && histfrog[0]->name[2] == ':') {
+       strcpy(name, histfrog[0]->name+1);
+       i = 1;
+   } else
    if(histfrog[0]->name[1] == '.') {
        sprint(name, ".");
        i = 0;

@jpoirier
Copy link
Member

Comment 4:

Glad to help.
I just ran the test again with the second patch applied:
cmd shell output
----------------
C:\temp\svgo>8g testsvgo.go
C:\temp\svgo>8l -o testsvgo.exe testsvgo.8
??none??: cannot open file: C:/C:/temp/svgo/svg.8

@jpoirier
Copy link
Member

Comment 5:

The "round 2" code corrects the problem.

@rsc
Copy link
Contributor

rsc commented Apr 30, 2010

Comment 6:

This issue was closed by revision 74a2364.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
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

3 participants