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

Version 2 and 3 of the library should have different symbol names #1175

Closed
1 task done
PierreF opened this issue Nov 10, 2021 · 0 comments · Fixed by #1176
Closed
1 task done

Version 2 and 3 of the library should have different symbol names #1175

PierreF opened this issue Nov 10, 2021 · 0 comments · Fixed by #1176

Comments

@PierreF
Copy link
Contributor

PierreF commented Nov 10, 2021

Describe the bug

Same issue as #1136 but for other symbol.
I've the issue with open_smc, close_smc and get_temperature

To Reproduce

package main

import (
	_ "github.com/shirou/gopsutil/host"
	_ "github.com/shirou/gopsutil/v3/host"
)

func main() {}

with go.mod:

module example.com

go 1.17

require (
        github.com/shirou/gopsutil v3.21.10+incompatible
        github.com/shirou/gopsutil/v3 v3.21.10
)

require (
        github.com/StackExchange/wmi v1.2.1 // indirect
        github.com/go-ole/go-ole v1.2.6 // indirect
        github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
        github.com/tklauser/go-sysconf v0.3.9 // indirect
        github.com/tklauser/numcpus v0.3.0 // indirect
        golang.org/x/sys v0.0.0-20211013075003-97ac67df715c // indirect
)

Then build (go mod tidy may be required before):

go build
[...]
# example.com
/opt/homebrew/Cellar/go/1.17.2/libexec/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
duplicate symbol '_get_temperature' in:
    /var/folders/gq/hqkcdkyd60l1bl2_gtx3mwch0000gn/T/go-link-1488035936/000002.o
    /var/folders/gq/hqkcdkyd60l1bl2_gtx3mwch0000gn/T/go-link-1488035936/000005.o
duplicate symbol '_open_smc' in:
    /var/folders/gq/hqkcdkyd60l1bl2_gtx3mwch0000gn/T/go-link-1488035936/000002.o
    /var/folders/gq/hqkcdkyd60l1bl2_gtx3mwch0000gn/T/go-link-1488035936/000005.o
duplicate symbol '_close_smc' in:
    /var/folders/gq/hqkcdkyd60l1bl2_gtx3mwch0000gn/T/go-link-1488035936/000002.o
    /var/folders/gq/hqkcdkyd60l1bl2_gtx3mwch0000gn/T/go-link-1488035936/000005.o
ld: 3 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Expected behavior

The program should build correctly.

Environment (please complete the following information):

  • Mac OS: [paste the result of sw_vers and uname -a
% sw_vers
ProductName:	macOS
ProductVersion:	12.0.1
BuildVersion:	21A559

% uname -a
Darwin hostname.local 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:01 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T6000 arm64

% go version
go version go1.17.2 darwin/arm64

Additional context

Note that this conflict is not necessary limited to version 2 and version 3 of gopsutil. If any other package define the same C function (e.g. version 2 of gopsutil and github.com/lufia/iostat, which both define readdrivestat) a conflict also occur :(

For this reason, we might need to prefix the function no only with "v3" but some unique enough prefix. "gopsutil_v3_" ?

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.

1 participant