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

plugin: application complains about missing dll when importing package (Windows 386) #28789

Closed
michael-obermueller opened this issue Nov 14, 2018 · 13 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@michael-obermueller
Copy link

What did you do?

package main

import (
	"os"
	"plugin"
)

func main() {
	os.Exit(0)

	_, err := plugin.Open("")
	println(err)
}

go build Main.go
run the application

What did you expect to see?

No error. I know that Go plugins are not supported in windows but it is possible to import package plugin (stub implementation).

What did you see instead?

System Error window: The code execution cannot proceed because .DLL was not found. Reinstalling the program may fix this problem.

Does this issue reproduce with the latest release (go1.11.2)?

yes, reproducible with all releases from 1.8 - 1.11.2

System details

go version go1.11 windows/amd64
GOARCH="386"
GOBIN=""
GOCACHE="C:\Users\michael.obermueller\AppData\Local\go-build"
GOEXE=".exe"
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="windows"
GOOS="windows"
GOPATH="C:\workspaces\go\workspace"
GOPROXY=""
GORACE=""
GOROOT="C:\workspaces\go\Go"
GOTMPDIR=""
GOTOOLDIR="C:\workspaces\go\Go\pkg\tool\windows_amd64"
GCCGO="gccgo"
GO386="sse2"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD=""
GOROOT/bin/go version: go version go1.11 windows/amd64
GOROOT/bin/go tool compile -V: compile version go1.11
lldb --version: lldb version 6.0.1
gdb --version: GNU gdb (GDB) 7.10.1
@agnivade
Copy link
Contributor

Please kindly upload the entire code. The current code, will always exit in the first line, not executing anything.

@agnivade agnivade added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 14, 2018
@michael-obermueller
Copy link
Author

It is the entire code, system error happens immediately on startup (before os.Exit(0) gets called) when package plugin is imported.

@agnivade
Copy link
Contributor

agnivade commented Nov 14, 2018

@agnivade agnivade removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 14, 2018
@agnivade agnivade changed the title Go application complains about missing dll when importing package plugin (Windows 386) plugin: application complains about missing dll when importing package (Windows 386) Nov 14, 2018
@agnivade agnivade added OS-Windows NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 14, 2018
@agnivade agnivade added this to the Unplanned milestone Nov 14, 2018
@alexbrainman
Copy link
Member

What did you expect to see?

No error. I know that Go plugins are not supported in windows but it is possible to import package plugin (stub implementation).

Issue to track windows plugin implementation is #19282. If windows plugin is not implemented, what is the benefit to be able to import plugin package? If there is not benefit, then do not import plugin package.

Alex

@michael-obermueller
Copy link
Author

My Go application is built for multiple platforms. This bug enforces me to define build constraints like +build !windows.

@PeterFeicht
Copy link
Contributor

Merely importing the plugin package without actually using it should still not make the executable crash.

@alexbrainman
Copy link
Member

This bug enforces me to define build constraints like +build !windows.

I don't see a problem with that. Do you have better suggestion?

Merely importing the plugin package without actually using it should still not make the executable crash.

plugin package is broken. If you import the package, you run any init function in it.

Alex

@michael-obermueller
Copy link
Author

michael-obermueller commented Nov 16, 2018

I don't see a problem with that. Do you have better suggestion?

The problem is that it should not be necessary, the plugin package contains 3 files:
plugin
|__ plugin.go
|__ plugin_dlopen.go --> +build linux,cgo darwin,cgo
|__ plugin_stubs.go --> +build !linux,!darwin !cgo

Both files 'plugin_dlopen.go' and 'plugin_stubs.go' define build constraints. The file 'plugin_stubs.go' is used for unsupported OS's like windows --> plugin.Open(...) should return an error (plugin: not implemented).
This works for windows amd64 but not for 386 which IMHO is a bug.

Michael

@gopherbot
Copy link

Change https://golang.org/cl/151139 mentions this issue: cmd/link: do not use _GLOBAL_OFFSET_TABLE_ on windows/386

@alexbrainman
Copy link
Member

This works for windows amd64 but not for 386 which IMHO is a bug.

@michael-obermueller please try https://go-review.googlesource.com/c/go/+/151139
to see if it fixes your problem.

Thank you.

Alex

@michael-obermueller
Copy link
Author

Thank you Alex, your change fixes the problem.

Michael

@agnivade
Copy link
Contributor

Reopening for the CL to close this issue.

@agnivade agnivade reopened this Nov 26, 2018
@alexbrainman
Copy link
Member

your change fixes the problem.

Thanks for checking. Now we will wait for https://go-review.googlesource.com/c/go/+/151139 to get submitted.

Alex

@golang golang locked and limited conversation to collaborators Nov 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
None yet
Development

No branches or pull requests

5 participants