-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/go: unexpected files left in tmpdir: [dsymutil-f087bc] #59026
Comments
It is reproducible.
It reproduces with the system C compiler if the compiler version is clang-14.0.3.
But if the system C compiler version is clang-14.0.0, it does not reproduce. |
I looked over the LLVM source code for dsymutil. Looks to me as though it only creates temp files when it is generating a "universal" binary (which I don't think would apply here). It also uses a template of the form "dsym.tmp%%%%%.dwarf", which doesn't look like what you are we're encountering here. Is there any chance we could narrow down the test a bit? Perhaps figure out which testpoint within the cmd/go tests is causing the bad behavior? |
Can you bisect the |
Do you know if the leftover temporary file is from a compiling action or a linking action? If it is for linking, the Go linker probably could invoke |
I found the temp files under these cases' temp directory:
|
It is from a linking action. Clang (or dsymutil) creates the temp file under $TMPDIR env variable, instead of the go linker's temporary directory. |
It's hard for me. The system C compiler of my mac is clang-14.0.0. And my friend's system C compiler is clang-14.0.3. I don't know how to install clang between these two versions. |
Would it be possible to reproduce with building a C program with clang 14.0.3? If so, we could conclude it is a bug in clang.
I'm curious what makes you conclude that it is from the linking? The Go linker could potentially change the environment variable when invoking clang. Not sure if this is preferable. |
I use the '-x' flag to get all build commands and execute one by one to see which command generate the temp file:
Now execute the command in |
$ cat test.c
#include <stdio.h>
int main() {
printf("hello\n");
}
$ mkdir tmp
$ TMPDIR=$PWD/tmp "/opt/homebrew/opt/llvm/bin/clang" test.c -o test.o -ggdb -c
$ ls tmp
$ TMPDIR=$PWD/tmp "/opt/homebrew/opt/llvm/bin/clang" test.o -o test -ggdb
$ ls tmp
$ TMPDIR=$PWD/tmp /opt/homebrew/opt/llvm/bin/dsymutil -f test -o test.k
$ ls tmp
dsymutil-5f58bc |
I am having the same problem. I am compiling Go 1.20.2 from source, but also using clang 14.0.3 on macOS Ventura 13.3. I clone the Go repo, check out the branch, "release-branch-1.20," and then run this command:
Here's the output of
The relevant part of the output is:
|
@578559967 Thanks. So this is a bug in LLVM dsymutil. Maybe you want to report there? |
If we can get more information on the nature of the |
I report there and they fix it quickly. But it may take a long time for apple to upgrade clang. It's better to workaround on the Go side as @bcmills said. |
@keith gives a option of dsymutil to workaround:
|
Thanks. We could consider the |
IIUC, |
Instead of passing the flag you can set |
This is the workaround I initially thought about. |
Either approach seems ok to me. Since the workaround seems tiny and low-risk, I think it's probably worth working around on the master branch so that contributors can successfully run |
FWIW, I ran into this today while working on issue #59446. I exported |
|
Change https://go.dev/cl/490818 mentions this issue: |
Some versions of dsymutils, notably the one in clang 14.0.3, which is shipped in some versions of Xcode, have a bug that it creates a temporary directory but doesn't clean it up at exit. The temporary directory is created in DSYMUTIL_REPRODUCER_PATH (if set, otherwise TMPDIR). Work around the issue by setting DSYMUTIL_REPRODUCER_PATH to the linker's temporary directory, so the linker will clean it up at exit anyway. Fixes golang#59026. Change-Id: Ie3e90a2d6a01f90040dc2eac91e8e536ccdda5a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/490818 Reviewed-by: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Cherry Mui <[email protected]>
Some versions of dsymutils, notably the one in clang 14.0.3, which is shipped in some versions of Xcode, have a bug that it creates a temporary directory but doesn't clean it up at exit. The temporary directory is created in DSYMUTIL_REPRODUCER_PATH (if set, otherwise TMPDIR). Work around the issue by setting DSYMUTIL_REPRODUCER_PATH to the linker's temporary directory, so the linker will clean it up at exit anyway. Fixes golang#59026. Change-Id: Ie3e90a2d6a01f90040dc2eac91e8e536ccdda5a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/490818 Reviewed-by: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Cherry Mui <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Install clang with
brew install llvm
.Then build go with
CC=/opt/homebrew/opt/llvm/bin/clang CXX=/opt/homebrew/opt/llvm/bin/clang++ ./all.bash
under src.What did you expect to see?
build pass
What did you see instead?
The text was updated successfully, but these errors were encountered: