Error with latest python 3.7.4
See original GitHub issueI compiled the latest python on my computer (debian) with standard options :
./configure
make
sudo make install
Then I used it with virtualenv in my cocotb project :
$ cd mycocotb/
$ virtualenv --python=/usr/local/bin/python3.7 envp37
$ source envp37/bin/activate
$ python --version
Python 3.7.4
$ python -m pip install cocotb
$ make
I get the following gcc error :
gcc -Werror -Wcast-qual -Wcast-align -Wwrite-strings -Wall -Wno-unused-parameter -fno-common -g -DDEBUG -fpic -DICARUS -Wstrict-prototypes -Waggregate-return -DFILTER -DICARUS -shared -Xlinker -L/usr/local/lib -o /usr/local/projects/videautom/gateware/hw_validation/spi2ksz/cocotb/build/libs/x86_64/libgpilog.so /usr/local/projects/videautom/gateware/hw_validation/spi2ksz/cocotb/build/obj/x86_64/gpi_logging.o -lpython3.7m
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(ceval.o): relocation R_X86_64_PC32 against symbol `_PyRuntime' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
/usr/local/projects/videautom/gateware/hw_validation/spi2ksz/cocotb/envp37/lib/python3.7/site-packages/cocotb/share/makefiles/Makefile.rules:58: recipe for target '/usr/local/projects/videautom/gateware/hw_validation/spi2ksz/cocotb/build/libs/x86_64/libgpilog.so' failed
I modified the Makefile.inc in installed package to get -fPIC:
vim cocotb/envp37/lib/python3.7/site-packages/cocotb/share/makefiles
[replace -fpic with -fPIC]
And I have exactly the same error:
gcc -Werror -Wcast-qual -Wcast-align -Wwrite-strings -Wall -Wno-unused-parameter -fno-common -g -DDEBUG -fPIC -DICARUS -Wstrict-prototypes -Waggregate-return -DFILTER -DICARUS -shared -Xlinker -L/usr/local/lib -o /usr/local/projects/videautom/gateware/hw_validation/spi2ksz/cocotb/build/libs/x86_64/libgpilog.so /usr/local/projects/videautom/gateware/hw_validation/spi2ksz/cocotb/build/obj/x86_64/gpi_logging.o -lpython3.7m
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(ceval.o): relocation R_X86_64_PC32 against symbol `_PyRuntime' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
/usr/local/projects/videautom/gateware/hw_validation/spi2ksz/cocotb/envp37/lib/python3.7/site-packages/cocotb/share/makefiles/Makefile.rules:58: recipe for target '/usr/local/projects/videautom/gateware/hw_validation/spi2ksz/cocotb/build/libs/x86_64/libgpilog.so' failed
If somebody have an idea ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Using version Python 3.7.4 and still getting syntax error
It looks like you are using ipython. It uses its own version of Python (here 3.5.6) while your path uses a 3.7.4 version....
Read more >Python Release Python 3.7.4
Python 3.7.4. Release Date: July 8, 2019. Note: The release you are looking at is Python 3.7.4, a bugfix release for the legacy...
Read more >Could not install python: no match found for 3.7.4 in [ ... ] #158
Python 3.7.4 is no longer available because the buildpack only supports the 2 latest patch versions of each version line (2.7, 3.5, 3.6,...
Read more >Installing Python 3 and Pyenv on MacOS, Windows, and Linux
In other cases, the command above could fail completely, indicting that python is not installed at all. ... So to install python 3.7.4...
Read more >Download and Install Python 3 Latest Version - GeeksforGeeks
Step 2: Underneath the Python Releases for Windows find the Latest Python 3 Release – Python 3.10.5 (the latest stable release as of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I found the solution. In fact I compiled python myself with official python source. To use it with cocotb I had to add option
--enable-shared
.Here the procedure that worked for me is :
Then, under the cocotb directory (I had to configure my libpath for local lib also):
And things done 👍
I can only guess this is something with the way you compile/link your python version since with coda and python 3.7.4 it works for me.