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

build fails on darwin #34

Closed
vangent opened this issue Apr 8, 2022 · 16 comments · Fixed by #42 or #43
Closed

build fails on darwin #34

vangent opened this issue Apr 8, 2022 · 16 comments · Fixed by #42 or #43

Comments

@vangent
Copy link

vangent commented Apr 8, 2022

Describe the bug
Building things that use this library seems to yield an error on darwin, both amd64 and arm64.

Example output:

❯ GOOS=darwin GOARCH=arm64 go build .

github.com/mattn/go-ieproxy

../../Go/pkg/mod/github.com/mattn/[email protected]/ieproxy.go:36:9: undefined: getConf
../../Go/pkg/mod/github.com/mattn/[email protected]/ieproxy.go:41:9: undefined: reloadConf
../../Go/pkg/mod/github.com/mattn/[email protected]/ieproxy.go:48:2: undefined: overrideEnvWithStaticProxy
../../Go/pkg/mod/github.com/mattn/[email protected]/ieproxy.go:53:13: psc.findProxyForURL undefined (type *Proxy

@mattn
Copy link
Owner

mattn commented Apr 8, 2022

Sorry, I don't have macOS. So I can't fix this issue.

@laurazard
Copy link
Contributor

On an M1 MacBook Pro on macOS 12.3.1 (21E258), I can't replicate this. Seems to build successfully.

@vangent
Copy link
Author

vangent commented Apr 8, 2022

google/go-cloud#3114 (comment)

describes how to repro from a user. I think you can do it on any platform by setting

GOOS=darwin GOARCH=amd64

@laurazard
Copy link
Contributor

laurazard commented Apr 9, 2022

Oh sorry, I didn't notice this happened building things that used this library, I was just trying to build it itself. I can replicate, I'll try to take a look myself.

@laurazard
Copy link
Contributor

laurazard commented Apr 9, 2022

Looks like this happens due to golang/go#24068. I managed to make this work by enabling the CGO_ENABLED flag, like so:

GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build

Could you test this @vangent? Doesn't seem like anything go-ieproxy can fix.

@caarlos0
Copy link
Contributor

I could but I don't really want to use CGO...

@laurazard
Copy link
Contributor

CGo is used extensively in this package to interface with OS APIs to fetch the relevant configs, so I'm not sure what alternative is left if you're trying to use it. If you want to use parts of the lib that don't rely on C calls, you can fork it and just use the parts you need!

@caarlos0
Copy link
Contributor

I understand, I'm getting this as a dependency of a dependency actually, so its not that simple...

on a side note, probably worth mentioning that it uses cgo on the readme/godocs...

@bep
Copy link

bep commented Apr 13, 2022

on a side note, probably worth mentioning that it uses cgo on the readme/godocs...

With big bold letters!

@chrislusf
Copy link

chrislusf commented Aug 24, 2022

CGo is used extensively in this package to interface with OS APIs to fetch the relevant configs, so I'm not sure what alternative is left if you're trying to use it. If you want to use parts of the lib that don't rely on C calls, you can fork it and just use the parts you need!

Not a good option for projects using libraries that are using ieproxy.

github.com/Azure/[email protected] github.com/mattn/[email protected]
[email protected] github.com/mattn/[email protected]

@vangent
Copy link
Author

vangent commented Aug 24, 2022

Note that gocloud.dev doesn't use this library directly, it is getting the dependency indirectly from azure-pipeline-go.

@mattn
Copy link
Owner

mattn commented Aug 24, 2022

So, would be solved this problem with adding empty implementations for non-cgo?

@caarlos0
Copy link
Contributor

I think it might, yes.

Azure could also not use the proxy by default (as I suggested here), but having a no-op impl for non-cgo seems even better...

@caarlos0
Copy link
Contributor

created #42 to address it

@mattn mattn closed this as completed in #42 Sep 15, 2022
@chrislusf
Copy link

chrislusf commented Sep 15, 2022

Got into this when building with 0.0.8 on mac

# github.com/mattn/go-ieproxy
../../../../../pkg/mod/github.com/mattn/[email protected]/ieproxy.go:53:13: psc.findProxyForURL undefined (type *ProxyScriptConf has no field or method findProxyForURL, but does have FindProxyForURL)

@caarlos0
Copy link
Contributor

oh, my bad, fix on #43, now with tests!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants