Go: crypto: "error Never include this file directly. Use <lzma.h> instead." during test

Created on 3 May 2018  路  18Comments  路  Source: golang/go

Hi,

We just got the following report, https://youtrack.jetbrains.com/issue/GO-5653, on our issue tracker but I believe this is a Go issue.

By the looks of it, the user is using at least Go 1.10 on a macOS. I suspect this has something to do with the fact that we force Go to compile the test binary with -gcflags="all=-N -l" in order to improve the debugging experience for the users.

Thank you.

OS: Mac OS X (10.13.4, x86_64) 
GOROOT=/usr/local/go
GOPATH=/Users/xueqzhan/source/go

/usr/local/go/bin/go test -c -o /private/var/folders/fx/2f29vz253_z8grcj9cbkq3jw0000gn/T/___TestFollowerOnly_in_planner_scheduler_election -gcflags "all=-N -l" planner-scheduler/election

# crypto/x509
In file included from /usr/local/go/src/crypto/x509/root_cgo_darwin.go:16:
In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:
In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:
/usr/local/include/Block.h:16:3: error: Never include this file directly. Use <lzma.h> instead.
#       error Never include this file directly. Use <lzma.h> instead.
        ^
1 error generated.

Compilation finished with exit code 2
NeedsInvestigation

Most helpful comment

I get same error when I copy Applications from one Macbook to another , maybe the copy that overlay the "/usr/local/include" dir , so move it and use global librarys .
you can execute :
sudo mv /usr/local/include /usr/local/include_old

and try again

All 18 comments

@dlsniper can we tell what version of CoreFoundation.framework source code they're on?

I don't have a /usr/local/include/Block.h on my OSX (10.13.4) install.

Unfortunately, I cannot. However, I asked the user about this: https://youtrack.jetbrains.com/issue/GO-5653#comment=27-2855172

I get same error when I copy Applications from one Macbook to another , maybe the copy that overlay the "/usr/local/include" dir , so move it and use global librarys .
you can execute :
sudo mv /usr/local/include /usr/local/include_old

and try again

I have same issue too.
Can someone tell us which way we should go?

sudo mv /usr/local/include /usr/local/include_old

@cc14514 This solved my issue. Thank you so much :)

Why doesn't Apple's migration assistant take care of something like this???? Thank you for posting.

cc @FiloSottile several users seem to be running into this, but I'm not sure what Go could do.

@cc14514 How did you know about this solution? It has been bothering me for a long time. thank you very much.

I get same error when I copy Applications from one Macbook to another , maybe the copy that overlay the "/usr/local/include" dir , so move it and use global librarys .
you can execute :
sudo mv /usr/local/include /usr/local/include_old

and try again

Thanks, solved my issues too!

I get same error when I copy Applications from one Macbook to another , maybe the copy that overlay the "/usr/local/include" dir , so move it and use global librarys .
you can execute :
sudo mv /usr/local/include /usr/local/include_old

and try again

Works perfectly! Just migrated to my new machine and came across the issue when I ran a Swift script. Thanks again.

sudo mv /usr/local/include /usr/local/include_old

Worked perfectly! Thanks @cc14514

In case you don't want to mess with the whole /usr/local/include directory - you can also just rm /usr/local/include/block.h

@cc14514 This solved my issue. Thank you so much :)

I'm glad to help you.

@cc14514 How did you know about this solution? It has been bothering me for a long time. thank you very much.

you are welcome, It's been bothering me for a long time too.

In case you don't want to mess with the whole /usr/local/include directory - you can also just rm /usr/local/include/block.h

It helped me a lot, thanks very much.

The crypto/x509 darwin cgo code was deleted entirely only the other day in CL 232397. That will be part of go1.16 so this issue should be fixed now for the next release.

Yay!

Was this page helpful?
0 / 5 - 0 ratings