質問編集履歴

6

修正

2022/10/09 12:14

投稿

aaaa____
aaaa____

スコア24

test CHANGED
File without changes
test CHANGED
@@ -212,3 +212,39 @@
212
212
  ```
213
213
  となりました.
214
214
 
215
+ ### 追記2
216
+ LDFLAGSの方も修正して
217
+
218
+ ```ここに言語を入力
219
+ // #cgo CFLAGS: -I/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/include/python3.10
220
+ // #cgo LDFLAGS: -L/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib -lpython3.10
221
+ // #include <Python.h>
222
+ ```
223
+
224
+ のようにしたらエラー内容が変わりました.
225
+
226
+ エラー内容.
227
+ ```こ
228
+ MacBook-Air sound_wav % go build -o main
229
+ # sound_wav
230
+ Undefined symbols for architecture arm64:
231
+ "_Pa_CloseStream", referenced from:
232
+ _main in _x003.o
233
+ "_Pa_GetDefaultOutputDevice", referenced from:
234
+ _main in _x003.o
235
+ "_Pa_GetDeviceInfo", referenced from:
236
+ _main in _x003.o
237
+ "_Pa_Initialize", referenced from:
238
+ _main in _x003.o
239
+ "_Pa_OpenStream", referenced from:
240
+ _main in _x003.o
241
+ "_Pa_StartStream", referenced from:
242
+ _main in _x003.o
243
+ "_Pa_StopStream", referenced from:
244
+ _main in _x003.o
245
+ "_Pa_Terminate", referenced from:
246
+ _main in _x003.o
247
+ ld: symbol(s) not found for architecture arm64
248
+ clang: error: linker command failed with exit code 1 (use -v to see invocation)
249
+ ```
250
+

5

修正

2022/10/08 12:57

投稿

aaaa____
aaaa____

スコア24

test CHANGED
File without changes
test CHANGED
@@ -159,14 +159,17 @@
159
159
  5 warnings and 1 error generated.
160
160
  ```
161
161
 
162
- ~~となってしまいました.
162
+ ~~となってしまいました.~~ 
163
- ~~ 追記へ続く
163
+ 追記へ続く
164
+
164
165
  結局,どこで何を入れれば成功するのでしょうか.
165
166
  ご教授よろしくお願いいたします.
166
167
 
167
168
 
168
169
  これ以前の経過も書き記したnoteを以下にリンクしておきます.
169
170
  https://note.com/clean_camel994/n/nd573d3211451
171
+
172
+
170
173
 
171
174
  ### 追記
172
175
  ```
@@ -179,6 +182,7 @@
179
182
  ```
180
183
 
181
184
  となったので,これの真ん中を辿って
185
+
182
186
  ```ここに言語を入力
183
187
  MacBook-Air / % cd opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10
184
188
  MacBook-Air 3.10 % ls

4

修正

2022/10/08 12:56

投稿

aaaa____
aaaa____

スコア24

test CHANGED
File without changes
test CHANGED
@@ -159,8 +159,8 @@
159
159
  5 warnings and 1 error generated.
160
160
  ```
161
161
 
162
- となってしまいました.
162
+ ~~となってしまいました.
163
-
163
+ ~~ 追記へ続く
164
164
  結局,どこで何を入れれば成功するのでしょうか.
165
165
  ご教授よろしくお願いいたします.
166
166
 

3

修正

2022/10/08 12:54

投稿

aaaa____
aaaa____

スコア24

test CHANGED
File without changes
test CHANGED
@@ -178,20 +178,33 @@
178
178
  '/opt/homebrew/lib/python3.10/site-packages']
179
179
  ```
180
180
 
181
- となったので,これの真ん中を使って
181
+ となったので,これの真ん中を辿って
182
+ ```ここに言語を入力
183
+ MacBook-Air / % cd opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10
184
+ MacBook-Air 3.10 % ls
185
+ Headers Resources bin lib
186
+ Python _CodeSignature include share
187
+ MacBook-Air 3.10 % cd include
188
+ MacBook-Air include % ls
189
+ python3.10
190
+ MacBook-Air include % cd python3.10
191
+ MacBook-Air python3.10 % ls
192
+ Python.h genobject.h pyhash.h
182
- ```
193
+ ```
194
+ となったので,
195
+
196
+
197
+ ```
183
- // #cgo CFLAGS: -I/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10
198
+ // #cgo CFLAGS: -I/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/include/python3.10
184
199
  // #cgo LDFLAGS: -L/Users/sonoyamayuto/Library/Python/3.9/lib -lpython
185
200
  // #include <Python.h>
186
201
  ```
187
- としたのですが,エラーは相変わらず
202
+ としたら先ほどのエラー変わり,
188
- ```
203
+ ```
189
- MacBook-Air sound_wav % go build -o main
204
+ MacBook-Air sound_wav % go build -o main
190
- # sound_wav
205
+ # sound_wav
206
+ ld: library not found for -lpython
191
- ./main.go:5:11: fatal error: 'Python.h' file not found
207
+ clang: error: linker command failed with exit code 1 (use -v to see invocation)
192
- #include <Python.h>
193
- ^~~~~~~~~~
194
- 1 error generated.
195
208
  ```
196
209
  となりました.
197
210
 

2

修正

2022/10/08 12:35

投稿

aaaa____
aaaa____

スコア24

test CHANGED
File without changes
test CHANGED
@@ -168,3 +168,30 @@
168
168
  これ以前の経過も書き記したnoteを以下にリンクしておきます.
169
169
  https://note.com/clean_camel994/n/nd573d3211451
170
170
 
171
+ ### 追記
172
+ ```
173
+ MacBook-Air ~ % python3 -c "import sys, pprint; pprint.pprint(sys.path)"
174
+ ['',
175
+ '/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python310.zip',
176
+ '/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10',
177
+ '/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload',
178
+ '/opt/homebrew/lib/python3.10/site-packages']
179
+ ```
180
+
181
+ となったので,これの真ん中を使って
182
+ ```
183
+ // #cgo CFLAGS: -I/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10
184
+ // #cgo LDFLAGS: -L/Users/sonoyamayuto/Library/Python/3.9/lib -lpython
185
+ // #include <Python.h>
186
+ ```
187
+ としたのですが,エラーは相変わらず
188
+ ```
189
+ MacBook-Air sound_wav % go build -o main
190
+ # sound_wav
191
+ ./main.go:5:11: fatal error: 'Python.h' file not found
192
+ #include <Python.h>
193
+ ^~~~~~~~~~
194
+ 1 error generated.
195
+ ```
196
+ となりました.
197
+

1

修正

2022/10/08 12:01

投稿

aaaa____
aaaa____

スコア24

test CHANGED
File without changes
test CHANGED
@@ -65,7 +65,7 @@
65
65
 
66
66
  ```ここに言語を入力
67
67
  // #cgo CFLAGS: -I/Library/Developer/CommandLineTools/usr/bin/python3.9
68
- // #cgo LDFLAGS: -L/Users/sonoyamayuto/Library/Python/3.9/lib -lpython
68
+ // #cgo LDFLAGS: -L/Users/usrname/Library/Python/3.9/lib -lpython
69
69
  // #include <Python.h>
70
70
  ```
71
71