Closed defencedog closed 1 year ago
@defencedog i have yet to see what could be the issue. Something with the python packaging step maybe. Do you have any idea where to look. I am not an expert in this.
@defencedog There are some new fixes in chemicalfun related to linking to spdlog. https://bitbucket.org/gems4/chemicalfun/pull-requests/8 - see if chemical fun now works for you?
make.log.txt install.log.txt cmake.log.txt
Its builds OK but when importing in python it fails. I think its a problem specific to Android platform. Perhaps other users can lend hand in debugging
Python 3.9.13 (main, Jul 5 2022, 04:09:08)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import chemicalfun as cf
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 import chemicalfun as cf
File /data/data/com.termux/files/usr/lib/python3.9/site-packages/chemicalfun/__init__.py:1, in <module>
----> 1 from chemicalfun.PyChemicalFun import *
ImportError: dlopen failed: cannot locate symbol "_Py_FalseStruct" referenced by "/data/data/com.termux/files/usr/lib/python3.9/site-packages/chemicalfun/PyChemicalFun.cpython-39.so"...
@gdmiron
On Android I uninstalled libspdlog
which provided necessary libspdlog.so
I compiled spdlog
using git
. This will produce static library libspdlog.a
instead of .so
Before building edit CMakeLists.txt
& make this switch ON
option(SPDLOG_BUILD_PIC "Build position independent code (-fPIC)" OFF)
or else you will receive such errors while building chemicalfun
(git version as well)
ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'spdlog::details::registry::~registry()'; recompile with -fPIC
>>> defined in /data/data/com.termux/files/usr/lib/libspdlog.a(spdlog.cpp.o)
>>> referenced by registry-inl.h:286 (/data/data/com.termux/files/home/spdlog/include/spdlog/details/registry-inl.h:286)
>>> spdlog.cpp.o:(spdlog::dump_backtrace()) in archive /data/data/com.termux/files/usr/lib/libspdlog.a
https://github.com/gabime/spdlog/blob/v1.x/CMakeLists.txt#L65
Build command for spdlog: cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX
Build command for chemicalfun: export LDFLAGS=-lpython3.9 && MATHLIB=m cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX
Hi @defencedog, I recently made an update to chemicalfun trying to fix the link with spdlog. Now uses spdlog=1.11.0
and external fmt=9.1.0
. Hopefully this fixes all these linking problems. You can try to recompile chemicalfun using spdlog=1.11.0
and external fmt=9.1.0
- master branch https://bitbucket.org/gems4/chemicalfun/src/master/ . I am currently updating ThermoFun with latest changes.
I have successfully build & installed chemicalfun git version but there is a weird issue
cmake .. -DPYTHON_EXECUTABLE=/data/data/com.termux/files/usr/bin/python3.9 -DCMAKE_INSTALL_PREFIX=/data/data/com.termux/files/usr
The final output
Running under python throws error, but shows installed