question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error with latest python 3.7.4

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Martonicommented, Oct 8, 2019

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 :

$ ./configure --enable-shared
$ make
$ sudo make install

Then, under the cocotb directory (I had to configure my libpath for local lib also):

$ cd mycocotb/
$ export LD_LIBRARY_PATH=/usr/local/lib
$ virtualenv --python=/usr/local/bin/python3.7 envp37
$ source envp37/bin/activate
$  python --version
Python 3.7.4
$ python -m pip install cocotb
$ make

And things done 👍

2reactions
themperekcommented, Oct 8, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found