Cannot make Cython work
- Dominant language
- Perl
- Stars
- 3.9k
- Forks
- 213
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
Need some help to make cython work.
Trying to convert this simple Fibonacci program:
```
import timeit
def fib(n):
if n <= 1:
return max(n,0)
else:
return fib(n-1)+fib(n-2)
print("fib(10)", fib(10))
t = timeit.timeit(lambda: fib(10), number=100000)
print(t)
```
I’m using this shell command:
```cython —embed -3 fib.py```
and obtain the file `fib.c` that must be compiled.
After some search I can find the include folder of Python3.9 and try to compile with this command:
```clang -I /private/var/containers/Bundle/Application/E160CFBA-CB49-4E82-AAA2-4DED2E15E11B/a-Shell.app/Library/include/python3.9/ fib.c```
But this is the result:
```
In file included from fib.c:4:
In file included from /private/var/containers/Bundle/Application/E160CFBA-CB49-4E82-AAA2-4DED2E15E11B/a-Shell.app/Library/include/python3.9/Python.h:75:
/private/var/containers/Bundle/Application/E160CFBA-CB49-4E82-AAA2-4DED2E15E11B/a-Shell.app/Library/include/python3.9/pyport.h:741:2: error: "LONG_BIT
definition appears wrong for platform (bad gcc/glibc config?)."
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
^
In file included from fib.c:4:
In file included from /private/var/containers/Bundle/Application/E160CFBA-CB49-4E82-AAA2-4DED2E15E11B/a-Shell.app/Library/include/python3.9/Python.h:148:
/private/var/containers/Bundle/Application/E160CFBA-CB49-4E82-AAA2-4DED2E15E11B/a-Shell.app/Library/include/python3.9/pythread.h:128:13: fatal error:
'pthread.h' file not found
# include
^~~~~~~~~~~
2 errors generated.
```
Need some help to go further, pls!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.