error installing polyglot package in stack heroku-18 and python3.6.12 runtime - python-3.x

I want to deploy a flask server that is capable of upload files and text pre-processing techniques using packages like spacy, polyglot, etc.
while installing the polyglot package in Heroku(i.e. stack Heroku-18) it's always throwing error like below
ERROR: Command errored out with exit status 1:
command: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u83b_12_/PyICU/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u83b_12_/PyICU/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-9jw5frbg/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/PyICU
cwd: /tmp/pip-install-u83b_12_/PyICU/
Complete output (95 lines):
(running 'icu-config --version')
Building PyICU 2.6 for ICU 60.2 (max ICU major version supported: 68)
(running 'icu-config --cxxflags --cppflags')
Adding CFLAGS="-std=c++11 -I/usr/include" from /tmp/build_83566000/.apt/usr/bin/icu-config
(running 'icu-config --ldflags')
Adding LFLAGS="-L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata" from /tmp/build_83566000/.apt/usr/bin/icu-config
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
copying PyICU.py -> build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/icu
copying icu/__init__.py -> build/lib.linux-x86_64-3.6/icu
running build_ext
building '_icu' extension
creating build/temp.linux-x86_64-3.6
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/app/.heroku/python/include/python3.6m -c _icu.cpp -o build/temp.linux-x86_64-3.6/_icu.o -std=c++11 -I/usr/include -DPYICU_VER="2.6" -DPYICU_ICU_MAX_VER="68"
In file included from /usr/include/c++/7/clocale:42:0,
from /usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:41,
from /usr/include/c++/7/bits/localefwd.h:40,
from /usr/include/c++/7/string:43,
from /tmp/build_83566000/.apt/usr/include/unicode/std_string.h:37,
from /tmp/build_83566000/.apt/usr/include/unicode/unistr.h:38,
from common.h:106,
from _icu.cpp:27:
./locale.h:29:23: error: ‘Locale’ was not declared in this scope
PyObject *wrap_Locale(Locale *locale, int flags);
^~~~~~
./locale.h:29:23: note: suggested alternative: ‘scalb’
PyObject *wrap_Locale(Locale *locale, int flags);
^~~~~~
scalb
./locale.h:29:31: error: ‘locale’ was not declared in this scope
PyObject *wrap_Locale(Locale *locale, int flags);
^~~~~~
./locale.h:29:31: note: suggested alternative: ‘locale_t’
PyObject *wrap_Locale(Locale *locale, int flags);
^~~~~~
locale_t
./locale.h:29:39: error: expected primary-expression before ‘int’
PyObject *wrap_Locale(Locale *locale, int flags);
^~~
./locale.h:29:48: error: expression list treated as compound expression in initializer [-fpermissive]
PyObject *wrap_Locale(Locale *locale, int flags);
^
./locale.h:30:29: error: ‘Locale’ does not name a type; did you mean ‘scalb’?
PyObject *wrap_Locale(const Locale &locale);
^~~~~~
scalb
./locale.h:30:43: error: ‘PyObject* wrap_Locale(const int&)’ redeclared as different kind of symbol
PyObject *wrap_Locale(const Locale &locale);
^
./locale.h:29:11: note: previous declaration ‘PyObject* wrap_Locale’
PyObject *wrap_Locale(Locale *locale, int flags);
^~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:41:0,
from /usr/include/c++/7/bits/localefwd.h:40,
from /usr/include/c++/7/string:43,
from /tmp/build_83566000/.apt/usr/include/unicode/std_string.h:37,
from /tmp/build_83566000/.apt/usr/include/unicode/unistr.h:38,
from common.h:106,
from _icu.cpp:27:
/usr/include/c++/7/clocale:53:11: error: ‘::lconv’ has not been declared
using ::lconv;
^~~~~
/usr/include/c++/7/clocale:54:11: error: ‘::setlocale’ has not been declared
using ::setlocale;
^~~~~~~~~
/usr/include/c++/7/clocale:55:11: error: ‘::localeconv’ has not been declared
using ::localeconv;
^~~~~~~~~~
In file included from /usr/include/c++/7/bits/localefwd.h:40:0,
from /usr/include/c++/7/string:43,
from /tmp/build_83566000/.apt/usr/include/unicode/std_string.h:37,
from /tmp/build_83566000/.apt/usr/include/unicode/unistr.h:38,
from common.h:106,
from _icu.cpp:27:
/usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:52:23: error: ‘uselocale’ was not declared in this scope
extern "C" __typeof(uselocale) __uselocale;
^~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:52:23: note: suggested alternative: ‘u_fsetlocale’
extern "C" __typeof(uselocale) __uselocale;
^~~~~~~~~
u_fsetlocale
/usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h: In function ‘int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’:
/usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:75:53: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
^
/usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h:100:33: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
__gnu_cxx::__uselocale(__old);
^
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u83b_12_/PyICU/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u83b_12_/PyICU/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-9jw5frbg/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/PyICU Check the logs for full command output.
requirements.txt
spacy==2.2.4
en-core-web-sm # https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz
langdetect==1.0.8
googletrans==3.0.0
contractions==0.0.25
inflect==5.0.2
emoji==0.6.0
Flask==1.1.2
nltk==3.5
beautifulsoup4==4.9.3
pandas==1.1.4
python-dotenv==0.15.0
pybind11==2.6.1
fasttext # git+https://github.com/facebookresearch/fastText.git
gunicorn==20.0.4
polyglot # git+https://github.com/aboSamoor/polyglot.git#master
sklearn==0.0
Aptfile
# you can list packages
apt-get install --reinstall build-essential libicu-dev g++
# or include links to specific .deb files
#http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-precise-amd64.deb
http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu-dev_67.1-4_amd64.deb
# or add custom apt repos
:repo:deb http://cz.archive.ubuntu.com/ubuntu artful main universe
runtime.txt
python-3.6.12
I referred and tried the below links but no use.
references: https://github.com/aboSamoor/polyglot/issues/152

Related

Unity WebGL build failed, seems something wrong with il2cpp

It runs good at a windows platform. But when I switch platform to webgl and build it, there is an error as following. As a beginner of Unity, it hard for me to figure out what happened, so I try to search for some answers. But there seems few similar questions.
Building Library\Bee\artifacts\WebGL\il2cpp\master_WebGL_wasm\9tk2_eric0.lump.o failed with output:
In file included from Library/Bee/artifacts/WebGL/il2cpp/master_WebGL_wasm/ipux_Generic0.lump.cpp:3:
D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\il2cpp\libil2cpp\os\Generic\WaitObject.cpp:94:36: error: 'SetWaitObject' is a private member of 'il2cpp::os::ThreadImpl'
currentThread->SetWaitObject(this);
^
D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\il2cpp\libil2cpp\os\Posix\ThreadImpl.h:105:14: note: declared private here
void SetWaitObject(posix::PosixWaitObject* waitObject);
^
In file included from Library/Bee/artifacts/WebGL/il2cpp/master_WebGL_wasm/ipux_Generic0.lump.cpp:3:
D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\il2cpp\libil2cpp\os\Generic\WaitObject.cpp:94:50: error: cannot initialize a parameter of type 'posix::PosixWaitObject *' with an rvalue of type 'il2cpp::os::WaitObject *'
currentThread->SetWaitObject(this);
^~~~
D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\il2cpp\libil2cpp\os\Posix\ThreadImpl.h:105:52: note: passing argument to parameter 'waitObject' here
void SetWaitObject(posix::PosixWaitObject* waitObject);
^
In file included from Library/Bee/artifacts/WebGL/il2cpp/master_WebGL_wasm/ipux_Generic0.lump.cpp:3:
D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\il2cpp\libil2cpp\os\Generic\WaitObject.cpp:148:36: error: 'SetWaitObject' is a private member of 'il2cpp::os::ThreadImpl'
currentThread->SetWaitObject(NULL);
^
D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\il2cpp\libil2cpp\os\Posix\ThreadImpl.h:105:14: note: declared private here
void SetWaitObject(posix::PosixWaitObject* waitObject);
^
In file included from Library/Bee/artifacts/WebGL/il2cpp/master_WebGL_wasm/ipux_Generic0.lump.cpp:3:
D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\il2cpp\libil2cpp\os\Generic\WaitObject.cpp:161:36: error: 'SetWaitObject' is a private member of 'il2cpp::os::ThreadImpl'
currentThread->SetWaitObject(NULL);
^
D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\il2cpp\libil2cpp\os\Posix\ThreadImpl.h:105:14: note: declared private here
void SetWaitObject(posix::PosixWaitObject* waitObject);
^
In file included from Library/Bee/artifacts/WebGL/il2cpp/master_WebGL_wasm/ipux_Generic0.lump.cpp:3:
D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\il2cpp\libil2cpp\os\Generic\WaitObject.cpp:227:17: error: no member named 'AcquireSemaphore' in 'il2cpp::os::ThreadImpl'
thread->AcquireSemaphore();
~~~~~~ ^
D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\il2cpp\libil2cpp\os\Generic\WaitObject.cpp:238:28: error: no member named 'TryTimedAcquireSemaphore' in 'il2cpp::os::ThreadImpl'
bool ret = thread->TryTimedAcquireSemaphore(timeout);
~~~~~~ ^
D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\il2cpp\libil2cpp\os\Generic\WaitObject.cpp:264:33: error: no member named 'ReleaseSemaphore' in 'il2cpp::os::ThreadImpl'
object->thread->ReleaseSemaphore();
~~~~~~~~~~~~~~ ^
7 errors generated.
emcc2: error: 'D:/1installfiles/unity/Editor/2021.3.12f1c1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/llvm\clang++.exe -target wasm32-unknown-emscripten -DEMSCRIPTEN -fno-inline-functions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-cxx-exceptions -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=19 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=D:\1installfiles\unity\Editor\2021.3.12f1c1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\cache\sysroot -Xclang -iwithsysroot/include\compat -D__webgl__ -Wno-c++11-extensions -Wno-nonportable-include-path -ffunction-sections -fno-unwind-tables -fomit-frame-pointer -fno-threadsafe-statics -std=c++11 -Wno-#warnings -Wswitch -Wno-trigraphs -Wno-tautological-compare -Wno-invalid-offsetof -Wno-implicitly-unsigned-literal -Wno-integer-overflow -Wno-shift-negative-value -Wno-unknown-attributes -Wno-implicit-function-declaration -Wno-null-conversion -Wno-missing-declarations -Wno-unused-value -Wno-pragma-once-outside-header -fvisibility=hidden -fexceptions -fno-rtti -fno-strict-overflow -ffunction-sections -fdata-sections -fmessage-length=0 -pipe -DBASELIB_INLINE_NAMESPACE=il2cpp_baselib -DIL2CPP_MONO_DEBUGGER_DISABLED -DRUNTIME_IL2CPP -DGC_NOT_DLL -DIL2CPP_DEFAULT_DATA_DIR_PATH=Data -DNDEBUG -I. -ID:/1installfiles/unity/Editor/2021.3.12f1c1/Editor/Data/il2cpp/libil2cpp/pch -ID:/1installfiles/unity/Editor/2021.3.12f1c1/Editor/Data/il2cpp/libil2cpp -ID:/1installfiles/unity/Editor/2021.3.12f1c1/Editor/Data/il2cpp/external/baselib/Include -ID:/1installfiles/unity/Editor/2021.3.12f1c1/Editor/Data/il2cpp/external/baselib/Platforms/WebGL/Include -ID:/1installfiles/unity/Editor/2021.3.12f1c1/Editor/Data/il2cpp/external/bdwgc/include -Oz -fcolor-diagnostics -fdiagnostics-absolute-paths -UGC_THREADS -UUSE_MMAP -UUSE_MUNMAP -c -xc++ Library/Bee/artifacts/WebGL/il2cpp/master_WebGL_wasm/ipux_Generic0.lump.cpp -o Library/Bee/artifacts/WebGL/il2cpp/master_WebGL_wasm/9tk2_eric0.lump.o' failed (1)
I tried to change settings in player settings\seeting for webgl. But it didn't work.

build numba from source on Windows 64x machine

I'm trying to build build NUMBA package form its source to generate a wheel out of it. I know there is a wheel for windows but I want to do some test on my local Windows 64X machine. I have installed NUMPY, LLVMLITE dependencies and I'm using MinGW c++ compiler and not visual studio. I get a below error, what am I missing here?
py : C:\Workspace\Python_Runtime\Python\lib\site-packages\setuptools\distutils_patch.py:25:
UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.In Zeile:1 Zeichen:1
+ py setup.py bdist_wheel 2>&1 > error.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (C:\Workspace\Py...tuptools first.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
warnings.warn(TBB not found Using OpenMP from: True running bdist_wheel running build got version from file C:\Workspace\Python_Runtime\numba-0.54.1\numba/_version.py {'version': '0.54.1', 'full': '39aef3deb073a67b0bf121e099ecf5b33d799f40'}
running build_py
running build_ext
building 'numba._dispatcher' extension
C compiler: gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes
compile options: '-D__MSVCRT_VERSION__=0x1927 -
IC:\\Workspace\\Python_Runtime\\Python\\lib\\site-packages\\numpy\\core\\include -
IC:\Workspace\Python_Runtime\Python\include -IC:\Workspace\Python_Runtime\Python\include -c'
gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -D__MSVCRT_VERSION__=0x1927 -
IC:\\Workspace\\Python_Runtime\\Python\\lib\\site-packages\\numpy\\core\\include -
IC:\Workspace\Python_Runtime\Python\include -IC:\Workspace\Python_Runtime\Python\include -c
numba/_dispatcher.cpp -o build\temp.win-amd64-3.9\Release\numba\_dispatcher.o
gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -D__MSVCRT_VERSION__=0x1927 -
IC:\\Workspace\\Python_Runtime\\Python\\lib\\site-packages\\numpy\\core\\include -
IC:\Workspace\Python_Runtime\Python\include -IC:\Workspace\Python_Runtime\Python\include -c numba/_hashtable.c -o build\temp.win-amd64-3.9\Release\numba\_hashtable.o
gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -D__MSVCRT_VERSION__=0x1927 -
IC:\\Workspace\\Python_Runtime\\Python\\lib\\site-packages\\numpy\\core\\include -
IC:\Workspace\Python_Runtime\Python\include -IC:\Workspace\Python_Runtime\Python\include -c numba/core/typeconv/typeconv.cpp -o build\temp.win-amd64 3.9\Release\numba\core\typeconv\typeconv.o
gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -D__MSVCRT_VERSION__=0x1927 -
IC:\\Workspace\\Python_Runtime\\Python\\lib\\site-packages\\numpy\\core\\include -
IC:\Workspace\Python_Runtime\Python\include -IC:\Workspace\Python_Runtime\Python\include -c numba/_typeof.c -o build\temp.win-amd64-3.9\Release\numba\_typeof.o
cc1plus.exe: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
cc1plus.exe: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
numba/_hashtable.c:102:1: warning: '_Numba_hashtable_hash_int' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_hash_int(const void *key)
^
numba/_hashtable.c:108:1: warning: '_Numba_hashtable_hash_ptr' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_hash_ptr(const void *key)
^
numba/_hashtable.c:114:1: warning: '_Numba_hashtable_compare_direct' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_compare_direct(const void *key, const _Numba_hashtable_entry_t *entry)
^
numba/_hashtable.c:133:1: warning: '_Numba_hashtable_new_full' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_new_full(size_t data_size, size_t init_size,
^
numba/_hashtable.c:178:1: warning: '_Numba_hashtable_new' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_new(size_t data_size,
^
numba/_hashtable.c:188:1: warning: '_Numba_hashtable_size' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_size(_Numba_hashtable_t *ht)
^
numba/_hashtable.c:259:1: warning: '_Numba_hashtable_get_entry' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_get_entry(_Numba_hashtable_t *ht, const void *key)
^
numba/_hashtable.c:312:1: warning: '_Numba_hashtable_set' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_set(_Numba_hashtable_t *ht, const void *key,
^
numba/_hashtable.c:354:1: warning: '_Numba_hashtable_get' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_get(_Numba_hashtable_t *ht, const void *key, void *data, size_t data_size)
^
numba/_hashtable.c:368:1: warning: '_Numba_hashtable_pop' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_pop(_Numba_hashtable_t *ht, const void *key, void *data, size_t data_size)
^
numba/_hashtable.c:377:1: warning: '_Numba_hashtable_delete' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_delete(_Numba_hashtable_t *ht, const void *key)
^
numba/_hashtable.c:391:1: warning: '_Numba_hashtable_foreach' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_foreach(_Numba_hashtable_t *ht,
^
numba/_hashtable.c:451:1: warning: '_Numba_hashtable_clear' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_clear(_Numba_hashtable_t *ht)
^
numba/_hashtable.c:470:1: warning: '_Numba_hashtable_destroy' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_destroy(_Numba_hashtable_t *ht)
^
numba/_hashtable.c:491:1: warning: '_Numba_hashtable_copy' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
_Numba_hashtable_copy(_Numba_hashtable_t *src)
^
In file included from C:/Program Files/R/Rtools/mingw_64/x86_64-w64 mingw32/include/c++/cassert:43:0,
from numba/_dispatcher.cpp:5:
numba/_dispatcher.cpp: In function 'PyObject* call_cfunc(Dispatcher*, PyObject*, PyObject*, PyObject*, PyObject*)':
numba/_dispatcher.cpp:383:41: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
assert(PyCFunction_GET_FLAGS(cfunc) == METH_VARARGS | METH_KEYWORDS);
^
g++ -g -shared build\temp.win-amd64-3.9\Release\numba\_dispatcher.o build\temp.win-amd64 3.9\Release\numba\_hashtable.o build\temp.win-amd64-3.9\Release\numba\_typeof.o build\temp.win amd64-3.9\Release\numba\core\typeconv\typeconv.o -
LC:\\Workspace\\Python_Runtime\\Python\\lib\\site-packages\\numpy\\core\\lib -
LC:\Workspace\Python_Runtime\Python\libs -LC:\Workspace\Python_Runtime\Python\PCbuild\amd64 -lnpymath -lpython39 -o build\lib.win-amd64-3.9\numba\_dispatcher.cp39-win_amd64.pyd build\temp.win-amd64-3.9\Release\numba\_typeof.o: In function `typecode_using_fingerprint': C:\Workspace\Python_Runtime\numba-0.54.1/numba/_typeof.c:617: undefined reference to `__imp__Numba_hashtable_get'
C:\Workspace\Python_Runtime\numba-0.54.1/numba/_typeof.c:639: undefined reference to `__imp__Numba_hashtable_set' build\temp.win-amd64-3.9\Release\numba\_typeof.o: In function `typeof_init':
C:\Workspace\Python_Runtime\numba-0.54.1/numba/_typeof.c:1115: undefined reference to `__imp__Numba_hashtable_new'
collect2.exe: error: ld returned 1 exit status
error: Command "g++ -g -shared build\temp.win-amd64-3.9\Release\numba\_dispatcher.o build\temp.win-amd64-3.9\Release\numba\_hashtable.o build\temp.win-amd64 3.9\Release\numba\_typeof.o build\temp.win-amd64-3.9\Release\numba\core\typeconv\typeconv.o
-LC:\\Workspace\\Python_Runtime\\Python\\lib\\site-packages\\numpy\\core\\lib -
LC:\Workspace\Python_Runtime\Python\libs -LC:\Workspace\Python_Runtime\Python\PCbuild\amd64 -lnpymath -lpython39 -o build\lib.win-amd64-3.9\numba\_dispatcher.cp39-win_amd64.pyd" failed with
exit status 1

Cant install allennlp with pip on mac

I am trying to install allennlp on my mac. I have tried installing macOS headers which solved the missing headers problem but now i am experiencing new problems.
The error when i run pip install allennlp:
Running setup.py bdist_wheel for jsonnet ... error
Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qf/jkn4v43j08xgst0r9yxyl0dc0000gn/T/pip-install-i4nyb384/jsonnet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/qf/jkn4v43j08xgst0r9yxyl0dc0000gn/T/pip-wheel-eof7cc6k --python-tag cp37:
running bdist_wheel
running build
running build_ext
x86_64-apple-darwin13.4.0-clang++ -c -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 core/desugarer.cpp -o core/desugarer.o
In file included from core/desugarer.cpp:17:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/cassert:21:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/assert.h:44:
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:111:82: error: use of undeclared identifier 'labs'; did you mean 'abs'?
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:111:44: note: 'abs' declared here
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:113:81: error: use of undeclared identifier 'llabs'
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:116:35: error: unknown type name 'ldiv_t'
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:116:95: error: use of undeclared identifier 'ldiv'; did you mean 'div'?
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:116:42: note: 'div' declared here
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:118:34: error: unknown type name 'lldiv_t'
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:118:94: error: use of undeclared identifier 'lldiv'
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
^
In file included from core/desugarer.cpp:19:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:642:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/cstring:61:
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:74:64: error: use of undeclared identifier 'strchr'
char* __libcpp_strchr(const char* __s, int __c) {return (char*)strchr(__s, __c);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:81:75: error: use of undeclared identifier 'strpbrk'
char* __libcpp_strpbrk(const char* __s1, const char* __s2) {return (char*)strpbrk(__s1, __s2);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:88:65: error: use of undeclared identifier 'strrchr'; did you mean 'strchr'?
char* __libcpp_strrchr(const char* __s, int __c) {return (char*)strrchr(__s, __c);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:76:13: note: 'strchr' declared here
const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:95:76: error: use of undeclared identifier 'memchr'
void* __libcpp_memchr(const void* __s, int __c, size_t __n) {return (void*)memchr(__s, __c, __n);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:102:74: error: use of undeclared identifier 'strstr'; did you mean 'strchr'?
char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:78:13: note: 'strchr' declared here
char* strchr( char* __s, int __c) {return __libcpp_strchr(__s, __c);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:102:74: error: no matching function for call to 'strchr'
char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:78:13: note: candidate disabled: <no message provided>
char* strchr( char* __s, int __c) {return __libcpp_strchr(__s, __c);}
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:102:81: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'const char *'
char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}
^~~~
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:78:32: note: passing argument to parameter '__s' here
char* strchr( char* __s, int __c) {return __libcpp_strchr(__s, __c);}
^
In file included from core/desugarer.cpp:19:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:642:
/Library/Developer/CommandLineTools/usr/include/c++/v1/cstring:70:9: error: no member named 'memcpy' in the global namespace; did you mean 'memchr'?
using ::memcpy;
~~^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:97:13: note: 'memchr' declared here
const void* memchr(const void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);}
^
In file included from core/desugarer.cpp:19:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:642:
/Library/Developer/CommandLineTools/usr/include/c++/v1/cstring:71:9: error: no member named 'memmove' in the global namespace
using ::memmove;
~~^
/Library/Developer/CommandLineTools/usr/include/c++/v1/cstring:72:9: error: no member named 'strcpy' in the global namespace; did you mean 'strchr'?
using ::strcpy;
~~^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:76:13: note: 'strchr' declared here
const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}
^
In file included from core/desugarer.cpp:19:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:642:
/Library/Developer/CommandLineTools/usr/include/c++/v1/cstring:73:9: error: no member named 'strncpy' in the global namespace
using ::strncpy;
~~^
/Library/Developer/CommandLineTools/usr/include/c++/v1/cstring:74:9: error: no member named 'strcat' in the global namespace; did you mean 'strchr'?
using ::strcat;
~~^
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:76:13: note: 'strchr' declared here
const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}
^
In file included from core/desugarer.cpp:19:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:642:
/Library/Developer/CommandLineTools/usr/include/c++/v1/cstring:75:9: error: no member named 'strncat' in the global namespace
using ::strncat;
~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Makefile:118: core/desugarer.o] Error 1
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/qf/jkn4v43j08xgst0r9yxyl0dc0000gn/T/pip-install-i4nyb384/jsonnet/setup.py", line 75, in <module>
test_suite="python._jsonnet_test",
File "/anaconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 143, in setup
return distutils.core.setup(**attrs)
File "/anaconda3/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/anaconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/anaconda3/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 188, in run
self.run_command('build')
File "/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/anaconda3/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/private/var/folders/qf/jkn4v43j08xgst0r9yxyl0dc0000gn/T/pip-install-i4nyb384/jsonnet/setup.py", line 54, in run
raise Exception('Could not build %s' % (', '.join(LIB_OBJECTS)))
Exception: Could not build core/desugarer.o, core/formatter.o, core/libjsonnet.o, core/lexer.o, core/parser.o, core/pass.o, core/static_analysis.o, core/string_utils.o, core/vm.o, third_party/md5/md5.o
----------------------------------------
Failed building wheel for jsonnet
Running setup.py clean for jsonnet
Failed to build jsonnet
My compiler and gcc:
(base) Sakets-MacBook-Pro:usr saketkhandelwal$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
(base) Sakets-MacBook-Pro:usr saketkhandelwal$ clang --version
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /anaconda3/bin
How do i fix this, i have tried reinstalling command line tools and package headers but still no luck.
I suppose you can resolve this by updating to latest version of
anaconda
Try to install jsonnet separately using conda install -c
conda-forge jsonnet and then pip install allennlp
Please refer to this issue on allennlp github for more details :
Pip3 install failing on jsonnet

How to link .so library properly in C++?

I have project structure like this,
a.pb.h --- includes --> protobuf.h
b.grpc.pb.h --- includes --> a.pb.h & grpcpp.h
Also there are a.pb.cc and b.grpc.cc files.
A C++ wrapper with extern C which is wrapper.cc and wrapper.h which includes b.grpc.pb.h and grpcpp.h.
The function inside extern C is char* helloWorld(const char*, const char*, const char*);
Creating .o of a.pb.h and b.grpc.pb.h:
g++ -fpic -std=c++11 `pkg-config --cflags protobuf grpc` -c -o a.pb.o a.pb.cc
g++ -fpic -std=c++11 `pkg-config --cflags protobuf grpc` -c -o b.grpc.pb.o b.grpc.pb.cc
Steps to create libcombined.so:
The grpc and protobuf so are already provided under /usr/local/lib.
First created .so of a.pb.o and b.grpc.pb.o to compile wrapper file as:
g++ -shared -o libcombined.so *.o
Compiled wrapper as:
g++ -fpic wrapper.cc -l:./libcombined.so -c -o wrapper.o -std=c++11
.so of a.pb.o, b.grpc.pb.o and wrapper.o as libcombined.so:
g++ -shared -o libcombinedwrapper.so *.o
Compiled main.c as:
gcc main.c -l:./libcombinedwrapper.so -o main -ldl
I am calling helloWorld from my main.c file which is:
#include <stdio.h>
#include <dlfcn.h>
int main(){
char* (*fn)(const char*,const char*,const char*);
void *handle = dlopen("path_to/libcombined.so",RTLD_NOW);
if(handle==NULL){
fprintf(stderr, "Error: %s\n", dlerror());
}
fn = (char* (*)(const char*,const char*,const char*))dlsym(handle, "helloWorld");
if (!fn) {
/* no such symbol */
fprintf(stderr, "Error: %s\n", dlerror());
dlclose(handle);
return 0;
}
char* msg = fn("asd","asdas","asdasd");
printf("%s",msg);
return 0;
}
Error after executing: ./main
Error: path_to/libcombinedwrapper.so: undefined symbol: _ZN6google8protobuf2io20ZeroCopyOutputStream15WriteAliasedRawEPKvi
Error: ./main: undefined symbol: helloWorld
Segmentation fault (core dumped)
The first above error is from symbol from protobuf.h file.
Can someone please suggest what I am doing wrong while linking or is there something I am doing wrong in main.c file?
g++ -shared -o libcombined.so *.o
You need to also link in all dependencies of the objects (libgrpc here).
You can add -Wl,--no-allow-shlib-undefined to verify that libcombined.so is linking everything it needs.
P.S. To avoid core dump, you should exit or return once dlopen fails.
P.P.S. It is generally a very bad idea(TM) to link *.o. Use proper Makefile to avoid unnecessary compilations and explicitly list objects that you are intending to put into libcombined.so.

kernel demo build error

In my limited experience with kernel program, my os is Ubuntu16.04,and use sudo apt-get install linux-headers-`uname -r` to install kernel header,and the kernel_hello.c file is
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("DUAL BSD/GPL")
MODULE_AUTHOR("YANQIN")
MODULE_DESCRIPTION("kernel module hello")
MODULE_VERSION("1.0")
static int hello_init(void)
{
printk(KERN_ALERT "hello_init() start\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "hello_exit() start\n");
}
module_init(hello_init);
module_exit(hello_exit);
and the Makefile is
KERNAL_DIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
obj-m := kernel_hello.o
default:
$(MAKE) -C $(KERNAL_DIR) M=$(PWD) modules
but the build result is like this
yq#ubuntu:~/kernelProgram$ make
make -C /lib/modules/4.10.0-28-generic/build M=/home/yq/kernelProgram modules
make[1]: Entering directory '/usr/src/linux-headers-4.10.0-28-generic'
CC [M] /home/yq/kernelProgram/kernel_hello.o
In file included from ./include/linux/module.h:18:0,
from /home/yq/kernelProgram/kernel_hello.c:2:
./include/linux/moduleparam.h:21:1: error: expected ‘,’ or ‘;’ before ‘static’
static const char __UNIQUE_ID(name)[] \
^
./include/linux/module.h:161:32: note: in expansion of macro ‘__MODULE_INFO’
#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
^
/home/yq/kernelProgram/kernel_hello.c:6:1: note: in expansion of macro ‘MODULE_AUTHOR’
MODULE_AUTHOR("YANQIN")
^
In file included from /home/yq/kernelProgram/kernel_hello.c:2:0:
/home/yq/kernelProgram/kernel_hello.c: In function ‘__inittest’:
/home/yq/kernelProgram/kernel_hello.c:19:13: error: ‘hello_init’ undeclared (first use in this function)
module_init(hello_init);
^
./include/linux/module.h:131:11: note: in definition of macro ‘module_init’
{ return initfn; } \
^
/home/yq/kernelProgram/kernel_hello.c: At top level:
./include/linux/module.h:132:6: error: ‘init_module’ aliased to undefined symbol ‘hello_init’
int init_module(void) __attribute__((alias(#initfn)));
^
/home/yq/kernelProgram/kernel_hello.c:19:1: note: in expansion of macro
‘module_init’
module_init(hello_init);
^
scripts/Makefile.build:301: recipe for target
'/home/yq/kernelProgram/kernel_hello.o' failed
make[2]: *** [/home/yq/kernelProgram/kernel_hello.o] Error 1
Makefile:1524: recipe for target '_module_/home/yq/kernelProgram' failed
make[1]: *** [_module_/home/yq/kernelProgram] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.10.0-28-generic'
Makefile:7: recipe for target 'default' failed
make: *** [default] Error 2
i don't know why it saids the linux kernel header has error
Calls to MODULE_LICENSE and other MODULE_* macros, which setup information about the module, should be terminated with ; like common C instructions

Resources