I am trying to build Python 3.4 from source, using emscripten .
I have downloaded and successfully installed emscripten. I have created a build folder outside the source tree. These are the steps I have carried out so far:
Run configure: $ emconfigure ../Python-3.4.3/configure --without-threads --without-pymalloc --enable-shared --disable-ipv6 --build=i686-linux-gnu
I noticed that a check for LONG_BIT in ../Python-3.4.3/Include/pyport.h conflicts with the #define SIZEOF_LONG
defined in one of emscriptens headers, so I have commented out the check in ../Python-3.4.3/Include/pyport.h
After running configure successfully, I then run emmmake make
in my build folder
I check that the built python file is indeed LLVM bytecode by running file python
. Having satisfied myself that all is well, I attempt to link the generated libpython3-4.so with the bytecode as follows:
$ llvm-link libpython3.4.so python -o python.bc
I get the following error message:
ERROR: Linking globals named '_Py_open_cloexec_works': symbol multiply defined!
A quick search through the source code shows the symbol is NOT multiply defined:
$ grep -rnw ../Python-3.4.3 -e "_Py_open_cloexec_works" --include=\*.{c,h}
../Python-3.4.3/Python/fileutils.c:33:int _Py_open_cloexec_works = -1;
../Python-3.4.3/Python/fileutils.c:784: atomic_flag_works = &_Py_open_cloexec_works;
../Python-3.4.3/Modules/posixmodule.c:7702:extern int _Py_open_cloexec_works;
../Python-3.4.3/Modules/posixmodule.c:7725: int *atomic_flag_works = &_Py_open_cloexec_works;
../Python-3.4.3/Modules/_io/fileio.c:210:extern int _Py_open_cloexec_works;
../Python-3.4.3/Modules/_io/fileio.c:232: int *atomic_flag_works = &_Py_open_cloexec_works;
So I run nm
on libpython3.4.so, to check the exported symbols, and I got the following error message:
nm: libpython3.4.so: File format not recognised
I have run out of ideas now. Can anyone help me solve the linkage issues?
[[ Additional Info ]]
Instead of nm
, you can use the powerful objdump
. Try objdump -t you_file
or objdump -T you_file
.
Example: objdump -t lib.o
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.