Closed wangziyannb closed 2 years ago
In the current NDK, the C++ standard library is called "libc++_shared.so". However, the C++ compiler will link against it automatically, so the solution is just to remove the explcit dependency on libstdc++. You can do this with the following patch:
--- a/mecab/configure.in
+++ b/mecab/configure.in
@@ -50,7 +50,7 @@ AC_TYPE_SIZE_T
AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_FUNC_MMAP
-AC_CHECK_LIB(stdc++, main, MECAB_LIBS="-lstdc++")
+# AC_CHECK_LIB(stdc++, main, MECAB_LIBS="-lstdc++") # Chaquopy: disabled
AC_CHECK_LIB(pthread,pthread_create)
AC_CHECK_LIB(pthread,pthread_join)
AC_CHECK_FUNCS(getenv)
Then, to regenerate configure
from configure.in
, you'll have to add the following line to build.sh before calling ./configure
:
./autogen.sh
As described in https://github.com/chaquo/chaquopy/issues/791, I usually test changes like this using the --no-unpack
option, and then create a permanent patch in the patches
subdirectory once everything's working.
Huge thanks to you! I finally succeeded to compile this library for chaquopy. By the way, autogen.sh requires libtool in docker env so I have to modify server/pypi/Dockerfile to do that.
I'm trying to compile a c++ library called mecab. Everything goes fine until it tries to use libstdc++.so to compile libmecab.so.
This is the output from the console:
After searching some materials about NDK, I find this link:
I'm not good at cross-compiling and NDK, so what can I do to fix this? Do I need to manually define an older NDK version or use some magic to force it to compile using libc++?
The mecab repo is here,, build dir is mecab inside. (mecab/mecab) To compile it in armv8i, I use a newer version config.sub from gcc
I'm using the same build.sh from chaquopy-libzmq, just a minor chage:
./configure --host=$HOST_TRIPLET --enable-utf8-only
Any help is appreciated.