Gigoteur / UnicornConsole

Unicorn Console: create quick fantasy game in Rust/Python/Lua/Rhai/Wasm !
MIT License
905 stars 47 forks source link

Ubuntu compile error " relocation R_X86_64_32S against `_Py_NotImplementedStruct' " #23

Closed titimoby closed 7 years ago

titimoby commented 7 years ago

From Ubuntu 16.04.2 I installed Rust to have cargo I installed the 3 requirements described. Launch of command "cargo build --features="cpython lua" --release" ended with the following error =>

error code below: = note: /usr/bin/ld: /home/thierry/projects/PX8/target/release/deps/libpython3_sys-c505fcaadb1041e8.rlib(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC /home/thierry/projects/PX8/target/release/deps/libpython3_sys-c505fcaadb1041e8.rlib: error adding symbols: Bad value collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: Could not compile px8.

hallucino commented 7 years ago

@titimoby could you tell me your rust version please ?

rustc --version
titimoby commented 7 years ago

rustc 1.18.0-beta.1 (4dce67253 2017-04-25)

and looking at this, I used beta channel on a previous test for a small rust tutorial. Is it better to get back to stable channel ?

hallucino commented 7 years ago

I'm not sure. Could you try with the nightly ?

titimoby commented 7 years ago

sure, I've no production constraint on rust. just exploring software to add to my kid's workshop

titimoby commented 7 years ago

rustc 1.18.0-nightly (2b4c91158 2017-04-25) python 3.6.1 same error.

I don't know how to check but I read that Python may be compiled sometimes without a enable-shared flag http://stackoverflow.com/questions/42582712/relocation-r-x86-64-32s-against-py-notimplementedstruct-can-not-be-used-when

titimoby commented 7 years ago

I used : PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --force 3.6.1

Then I checked using some python code import sysconfig print(sysconfig.get_config_var('CONFIG_ARGS'))

result was : '--prefix=/home/thierry/.pyenv/versions/3.6.1' '--enable-shared' '--libdir=/home/thierry/.pyenv/versions/3.6.1/lib' '--enable-unicode=ucs4' 'LDFLAGS=-L/home/thierry/.pyenv/versions/3.6.1/lib -Wl,-rpath=/home/thierry/.pyenv/versions/3.6.1/lib ' 'CPPFLAGS=-I/home/thierry/.pyenv/versions/3.6.1/include '

hallucino commented 7 years ago

ok :(

@dgrunwald: have you any idea ?

titimoby commented 7 years ago

maybe I first need to clean the build folder of PX8. Is it easy to do with cargo ?

hallucino commented 7 years ago

cargo clean

titimoby commented 7 years ago

I have good network, I used rm -rf and clone again ;) Result is coming...

titimoby commented 7 years ago

I don't know if I continue on this bug or if I open another ;) Build ended with bunch of warnings but no errors

Then : thierry-laptop% ./target/release/px8 ./target/release/px8: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory

hallucino commented 7 years ago

Warnings are related to rust syntax.

For this one it seems that the dynamic library is not found.

Could you try a 'ldconfig' to update the files please ?

titimoby commented 7 years ago

I added export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.pyenv/versions/3.6.1/lib

and PX8 launched. I have to stabilize my pyenv settings obviously. Thanks a lot. Maybe add something about rust version to use