Build Dummy Example Failed in MacOS M1
- Langage dominant
- Go
- Étoiles
- 2.3k
- Forks
- 136
- Merge moyen
- 14 min
- PR mergées (30 j)
- 2
Description
## ENV
MacOS 2020 M1 chip
python3.9 (system)
## Replication
```shell
# prepare
mkdir dummy && cd dummy
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
go env -w GOBIN="/usr/local/go/bin/"
# init project and install as python package
go mod init dummy.com/dum
go get github.com/go-python/gopy/_examples/hi
# error happened here
gopy build -output=out -vm=python3 github.com/go-python/gopy/_examples/hi
```
Output:
```
--- Processing package: github.com/go-python/gopy/_examples/hi ---
--- building package ---
gopy build -output=out -vm=python3 github.com/go-python/gopy/_examples/hi
goimports -w hi.go
go build -mod=mod -buildmode=c-shared -o hi_go.so .
cmd had error: exit status 1 output:
# dummy.com/dum/out
/usr/local/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
ld: warning: directory not found for option '-L/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib'
ld: library not found for -lpython3.9
clang: error: linker command failed with exit code 1 (use -v to see invocation)
2023/03/19 13:35:14 error dispatching command: exit status 1
```
## Questions
The path `/App****/Python3.framework/Versions/3.9/lib` actually doesn't exist in my PC, so I think maybe it's because somewhere point to a wrong $PATH.
I found where the true python lib path is, and added it to $PATH, since this error seems due to lib not in the path:
```shell
sudo find /Library -name "python*"
# so here I got the python3 lib path in my PC
export PATH=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib:$PATH
# re-run
gopy build -output=out -vm=python3 github.com/go-python/gopy/_examples/hi
# still the error output
--- Processing package: github.com/go-python/gopy/_examples/hi ---
--- building package ---
gopy build -output=out -vm=python3 github.com/go-python/gopy/_examples/hi
goimports -w hi.go
go build -mod=mod -buildmode=c-shared -o hi_go.so .
cmd had error: exit status 1 output:
# dummy.com/dum/out
/usr/local/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
ld: warning: directory not found for option '-L/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib'
ld: library not found for -lpython3.9
clang: error: linker command failed with exit code 1 (use -v to see invocation)
2023/03/19 13:49:54 error dispatching command: exit status 1
```
Am I doing any step wrong? could you give me some advice, thanks! 😊
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par la commande gopy build pour github.com/go-python/gopy/_examples/hi et par l’étape de liaison de la bibliothèque partagée Go indiquée dans le rapport. Suivez la manière dont le chemin du framework/de la bibliothèque Python pour macOS arm64 est sélectionné, reproduisez l’échec avec Python 3.9 et considérez le travail terminé lorsque l’exemple se compile sans l’erreur -lpython3.9 manquant.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- go, macos, python
- Domaine
- build-system, devtools, operating-systems
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 42/100