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

llgo run . get stuck on MacOs M3 #306

Open
luoliwoshang opened this issue Jun 13, 2024 · 3 comments
Open

llgo run . get stuck on MacOs M3 #306

luoliwoshang opened this issue Jun 13, 2024 · 3 comments

Comments

@luoliwoshang
Copy link
Contributor

luoliwoshang commented Jun 13, 2024

update

The Go versions 1.21 and 1.22 installed via brew can run normally. The following tests are all based on the Go versions downloaded and installed from the official Go website: https://go.dev/dl/

main content

After testing, currently 1.19 and 1.20 go can run demo


This is where the version with the bug is counted

go 1.19

version run normal note
1.19.13 ⭕️ got "ld: warning" when install
1.19.12 ⭕️ got "ld: warning" when install
1.19.11 ⭕️ got "ld: warning" when install
1.19.10 ⭕️ got "ld: warning" when install
1.19.9 ⭕️ got "ld: warning" when install
1.19.8 ⭕️ got "ld: warning" when install
1.19.7 ⭕️ got "ld: warning" when install
1.19.6 ⭕️ got "ld: warning" when install
1.19.5 ⭕️ got "ld: warning" when install
1.19.4 ⭕️ got "ld: warning" when install
1.19.3 ⭕️ got "ld: warning" when install
1.19.2 ⭕️ got "ld: warning" when install
1.19.1 ⭕️ got "ld: warning" when install
1.19.0 ⭕️ got "ld: warning" when install

go 1.20

version run normal note
1.20.14 ⭕️
1.20.13 ⭕️
1.20.12 ⭕️
1.20.11 ⭕️
1.20.10 ⭕️
1.20.9 ⭕️ got "ld: warning" when install
1.20.8 ⭕️ got "ld: warning" when install
1.20.7 ⭕️ got "ld: warning" when install
1.20.6 ⭕️ got "ld: warning" when install
1.20.5 ⭕️ got "ld: warning" when install
1.20.4 ⭕️ got "ld: warning" when install
1.20.3 ⭕️ got "ld: warning" when install
1.20.2 ⭕️ got "ld: warning" when install
1.20.1 ⭕️ got "ld: warning" when install
1.20.0 ⭕️ got "ld: warning" when install

go 1.21

version run normal note
1.21.10 got stuck
1.21.9 got stuck
1.21.8 got stuck
1.21.7 got stuck
1.21.6 got stuck
1.21.5 got stuck
1.21.4 got stuck
1.21.3 got stuck
1.21.2 got stuck
1.21.1 got stuck
1.21.0 got stuck

go 1.22

version run normal note
1.22.4 got stuck
1.22.3 got stuck
1.22.2 got stuck
1.22.1 got stuck
1.22.0 got stuck

ld warning like this

# github.com/goplus/llgo/chore/llvmtargets
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
# github.com/goplus/llgo/chore/llpyg
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
# github.com/goplus/llgo/chore/gentests
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
# github.com/goplus/llgo/chore/llgen
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
# github.com/goplus/llgo/cmd/llgo
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly

Bug Report

When I followed the install process to install llgo, when I ran the first Demo, it got stuck, and I couldn't kill the program using control + c
https://github.com/goplus/llgo?tab=readme-ov-file#how-to-install

❯ brew update                       
==> Updating Homebrew...
Already up-to-date.

❯ brew install libgc
==> Downloading https://ghcr.io/v2/homebrew/core/bdw-gc/manifests/8.2.6
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/1a31747893b037cd6bd4dff1f1fa238c2ed3e182ca7214bf0615257326a9ca17--bdw-gc-8.2.6.bottle_manifest.json
==> Fetching bdw-gc
==> Downloading https://ghcr.io/v2/homebrew/core/bdw-gc/blobs/sha256:6ba6ddd8c881ecca1b67e30767731cefdeffd8244400f7168b1f219b3feba6b9
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/1a3717b86327266df2c54ab3b73637e148a8889020e50a61b356212f6f243f67--bdw-gc--8.2.6.arm64_sonoma.bottle.tar.gz
==> Pouring bdw-gc--8.2.6.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/bdw-gc/8.2.6: 74 files, 1.8MB
==> Running `brew cleanup bdw-gc`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

brew install llvm@17  
==> Downloading https://formulae.brew.sh/api/formula.jws.json
##O=-#   #                                                                                                                     
==> Downloading https://formulae.brew.sh/api/cask.jws.json
##O#-  #                                                                                                                       
==> Downloading https://ghcr.io/v2/homebrew/core/llvm/17/manifests/17.0.6
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/7301a1bce3eecd3a15496e04bc113e37e85e4a756a4edc1e55fdb4beafddd689--llvm@17-17.0.6.bottle_manifest.json
==> Fetching dependencies for llvm@17: lz4, xz and zstd
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/manifests/1.9.4
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/379e59b981667f9585b33a2ff318769d8edca3ce6fd2e9a67ed291ae3e0cc872--lz4-1.9.4.bottle_manifest.json
==> Fetching lz4
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/blobs/sha256:5a8b7116d978e403c525e61794c60b43480d0afc83e499a763f7f14641bbc9
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/cfb2864b638ce3847b31fa1f44483b5edcf090a414eaa5306c8b7ff2dc0ba44a--lz4--1.9.4.arm64_sonoma.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/xz/manifests/5.4.6
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/b2cc4077807c100af6e0253f51d186f187ff55165638cbe3a4aa16d1c4762660--xz-5.4.6.bottle_manifest.json
==> Fetching xz
==> Downloading https://ghcr.io/v2/homebrew/core/xz/blobs/sha256:01ced87d92d0c1131c069108efb14f6940f9e528e2d044ac41d9a0d8f5169f2
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/a8def111ef35d2c9d46e56ff2c6c7b623b61be0f395014454e9f11db2db16981--xz--5.4.6.arm64_sonoma.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/zstd/manifests/1.5.6
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/29403e0df5404d8aeca0e750ac135ec9ef44fc5eeb6df69170ed602acabf0ffb--zstd-1.5.6.bottle_manifest.json
==> Fetching zstd
==> Downloading https://ghcr.io/v2/homebrew/core/zstd/blobs/sha256:2028141683f55bffcd0693b9e49eef1e3dabc1e184214cacb173ca9bd54da
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/af6fd07ad9cd935975dd761af51c9baba7eb782dda7630d4abd399fa98e53578--zstd--1.5.6.arm64_sonoma.bottle.tar.gz
==> Fetching llvm@17
==> Downloading https://ghcr.io/v2/homebrew/core/llvm/17/blobs/sha256:a86a41bd356df1fdbd8eef983fff672937a39cad37b00ef37ca94365fc
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/14c826a7725959dfe15c249541432f6cd4cb3a4801d4b9d16561c08fd9656643--llvm@17--17.0.6.arm64_sonoma.bottle.tar.gz
==> Installing dependencies for llvm@17: lz4, xz and zstd
==> Installing llvm@17 dependency: lz4
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/manifests/1.9.4
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/379e59b981667f9585b33a2ff318769d8edca3ce6fd2e9a67ed291ae3e0cc872--lz4-1.9.4.bottle_manifest.json
==> Pouring lz4--1.9.4.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/lz4/1.9.4: 23 files, 638.5KB
==> Installing llvm@17 dependency: xz
==> Downloading https://ghcr.io/v2/homebrew/core/xz/manifests/5.4.6
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/b2cc4077807c100af6e0253f51d186f187ff55165638cbe3a4aa16d1c4762660--xz-5.4.6.bottle_manifest.json
==> Pouring xz--5.4.6.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/xz/5.4.6: 164 files, 2.6MB
==> Installing llvm@17 dependency: zstd
==> Downloading https://ghcr.io/v2/homebrew/core/zstd/manifests/1.5.6
Already downloaded: /Users/zhangzhiyang/Library/Caches/Homebrew/downloads/29403e0df5404d8aeca0e750ac135ec9ef44fc5eeb6df69170ed602acabf0ffb--zstd-1.5.6.bottle_manifest.json
==> Pouring zstd--1.5.6.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/zstd/1.5.6: 32 files, 2.2MB
==> Installing llvm@17
==> Pouring llvm@17--17.0.6.arm64_sonoma.bottle.tar.gz
==> Caveats
To use the bundled libc++ please add the following LDFLAGS:
  LDFLAGS="-L/opt/homebrew/opt/llvm@17/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@17/lib/c++"

llvm@17 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.

If you need to have llvm@17 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/llvm@17/bin:$PATH"' >> ~/.zshrc

For compilers to find llvm@17 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/llvm@17/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/llvm@17/include"
==> Summary
🍺  /opt/homebrew/Cellar/llvm@17/17.0.6: 6,642 files, 1.5GB
==> Running `brew cleanup llvm@17`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> llvm@17
To use the bundled libc++ please add the following LDFLAGS:
  LDFLAGS="-L/opt/homebrew/opt/llvm@17/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@17/lib/c++"

llvm@17 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.

If you need to have llvm@17 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/llvm@17/bin:$PATH"' >> ~/.zshrc

For compilers to find llvm@17 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/llvm@17/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/llvm@17/include"
  echo 'export PATH="/opt/homebrew/opt/llvm@17/bin:$PATH"' >> ~/.zshrc
  export LDFLAGS="-L/opt/homebrew/opt/llvm@17/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/llvm@17/include"
go install -v ./...
# github.com/goplus/llgo/chore/llvmtargets
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
# github.com/goplus/llgo/chore/llpyg
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
# github.com/goplus/llgo/cmd/llgo
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
# github.com/goplus/llgo/chore/gentests
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
# github.com/goplus/llgo/chore/llgen
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly

When I executed Demo, he got stuck.

llgo on  main [$?]
❯ pwd                                                             
/Users/xxxx/Documents/Code/goplus/llgo

llgo on  main [$?]
❯ export LLGOROOT="/Users/xxxxx/Documents/Code/goplus/llgo"                                    

llgo on  main [$?]
❯ cd _demo/hello/

llgo/_demo/hello on  main
❯ llgo run .         
^C^C^C^C

When I execute it directly in the source program, it works, but once I execute go install. /.
After that, use llgo run. It will get stuck.

llgo/cmd/llgo on  main
❯ go run llgo.go run /Users/zhangzhiyang/Documents/Code/goplus/llgo/_demo/hello/hello.go
# command-line-arguments
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
Hello world

Environment

mac version: MacOS 14.2 M3 MacBook Pro (2023)

uname -a
Darwin ... 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:54:55 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8122 arm64

go version

go version go1.21.4 darwin/arm64

clang version

clang -v           
Homebrew clang version 17.0.6
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm@17/bin

In versions 1.19 and 1.20 of Go, the installed llgo works normally

llgo/_demo/hello 
❯ llgo run .      
Hello world
@luoliwoshang luoliwoshang changed the title llgo run . get stuck on macos M3 llgo run . get stuck on MacOs M3 Jun 13, 2024
@aofei
Copy link
Member

aofei commented Jun 13, 2024

Try llgo run -v . to see if there is any output.

@luoliwoshang
Copy link
Contributor Author

luoliwoshang commented Jun 13, 2024

Try llgo run -v . to see if there is any output.

There is no output.

llgo/_demo/hello 
❯ llgo run -v .
^C^C^C^C^C

When I execute it directly in the source program, it works, but once I execute go install. /.
After that, use llgo run. It will get stuck.

llgo/cmd/llgo on  main
❯ go run llgo.go run /Users/zhangzhiyang/Documents/Code/goplus/llgo/_demo/hello/hello.go
# command-line-arguments
ld: warning: reexported library with install name '/opt/homebrew/opt/llvm@17/lib/libunwind.1.dylib' found at '/opt/homebrew/Cellar/llvm@17/17.0.6/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
Hello world

@luoliwoshang
Copy link
Contributor Author

luoliwoshang commented Jun 13, 2024

When I use 1.19 go, it can be installed and used normally.

llgo/_demo/hello 
❯ llgo run .      
Hello world

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

No branches or pull requests

3 participants