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-gnuI noticed that a check for LONG_BIT in ../Python-3.4.3/Include/pyport.h conflicts with the
#define SIZEOF_LONGdefined in one of emscriptens headers, so I have commented out the check in ../Python-3.4.3/Include/pyport.hAfter running configure successfully, I then run
emmmake makein my build folderI 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 ]]
- clang version 3.6.0
- LLVM version 3.6.0svn