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

ld: sectionForAddress(0x74465E) address not in any section file #2801

Closed
fsyyft opened this issue Sep 25, 2020 · 8 comments
Closed

ld: sectionForAddress(0x74465E) address not in any section file #2801

fsyyft opened this issue Sep 25, 2020 · 8 comments

Comments

@fsyyft
Copy link

fsyyft commented Sep 25, 2020

Go Version: 1.15.2

When require 0.14.4, build success, bus can not run application.

panic: qtls.ClientSessionState not compatible with tls.ClientSessionState

When require 0.15.x or 0.16.x or 0.17.x or 0.18.0, build fail.

/usr/local/Cellar/go/1.15.2/libexec/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: sectionForAddress(0x74465E) address not in any section file '/var/folders/qj/4y8pczjj6v5828wk6twsj4100000gn/T/go-link-796586071/go.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

build with -ldflags="-w", it is ok , why ?

@marten-seemann
Copy link
Member

That’s expected. If you build an old version, you’ll need an old Go version. Not sure why you’d want to build an old version in the first place though...

@fsyyft
Copy link
Author

fsyyft commented Sep 25, 2020

Well, at the beginning, I used version 0.18.0, but when I compiled without -LDflags ="-w", there would be an error, so I used a different version to try, generally try backwards, try to version 0.14.4, the compilation was passed, but there was a panic.

Now the question is, is this also expected if the compilation fails without -LDflags ="-w"? @marten-seemann

thank you!

@fsyyft
Copy link
Author

fsyyft commented Sep 25, 2020

Go version 1.15.2
quic-go version 0.18.0

Successful sample

 go build -ldflags="-w" -o ./bin/example example/cmd/example

Failure sample

go build -o ./bin/example example/cmd/example   
# example/cmd/example
/usr/local/Cellar/go/1.15.2/libexec/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: sectionForAddress(0x74483E) address not in any section file '/var/folders/qj/4y8pczjj6v5828wk6twsj4100000gn/T/go-link-636049088/go.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@marten-seemann
Copy link
Member

I see, so this is not related to qtls.
What exactly is -ldflags="-w" supposed to do? I don't think I've ever used it.
This error doesn't look like a quic-go issue to me, maybe related to golang/go#40974?

@marten-seemann marten-seemann changed the title qtls.ClientSessionState not compatible with tls.ClientSessionState or running clang failed ld: sectionForAddress(0x74465E) address not in any section file Sep 25, 2020
@fsyyft
Copy link
Author

fsyyft commented Sep 25, 2020

I think it's probably also a go problem;

I'm still wondering why I don't have this problem with quic-Go version 0.14 or less.

Well, that goes beyond the quic-Go question, thank you very much!

@fsyyft
Copy link
Author

fsyyft commented Sep 25, 2020

I don't know what happened, but according to your thinking, so far my problem has been solved. @marten-seemann

In my project, I have a piece of code that I put in the init method, and when I modify it, I'm done.

Old

func init() {
	sentinelCommand := newSentinelCommand()
	quicCommand := newQUICCommand()

	newbieRootCommand.Command().AddCommand(
		sentinelCommand.Command(),
		quicCommand.Command(),
	)
}

func Run() {
	newbieRootCommand.Run()
}

New

func preRun() {
	sentinelCommand := newSentinelCommand()
	quicCommand := newQUICCommand()

	newbieRootCommand.Command().AddCommand(
		sentinelCommand.Command(),
		quicCommand.Command(),
	)
}

func Run() {
	preRun()
	newbieRootCommand.Run()
}

@marten-seemann
Copy link
Member

That means you can't use init any more?

@fsyyft
Copy link
Author

fsyyft commented Sep 25, 2020

That means you can't use init any more?

@marten-seemann

I don't know what's going on, but I guess you're right, maybe there's a little loop in init itself that's causing the compilation to go wrong.

What I don't understand is why adding -LDflags ="-w" should be ok.

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

No branches or pull requests

2 participants