Code Monkey home page Code Monkey logo

Comments (5)

dfarley1 avatar dfarley1 commented on June 11, 2024

cc @betterlch

from python-hyperscan.

betterlch avatar betterlch commented on June 11, 2024

cc @betterlch
I just know that 0.2.0 works in python3.7~


Here are other work about python3.10:

I linked libhs.so as _hyperscn.so, and I get this

ImportError: dynamic module does not define module export function (PyInit__hyperscan)

And then I use

strace python3 -c 'import hyperscan'

It has no more help.
I don't how C extending works in python3, so I have no ideas.

from python-hyperscan.

darvid avatar darvid commented on June 11, 2024

just added a new environment variable to enable dynamic linking when building, PYTHON_HYPERSCAN_STATIC (defaults to true). try pulling latest and building with:

PYTHON_HYPERSCAN_STATIC=false poetry install

from python-hyperscan.

betterlch avatar betterlch commented on June 11, 2024

just added a new environment variable to enable dynamic linking when building, PYTHON_HYPERSCAN_STATIC (defaults to true). try pulling latest and building with:

PYTHON_HYPERSCAN_STATIC=false poetry install

Something maybe not as you wish:

running build_ext
building 'hyperscan._hyperscan' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include/openssl11 -I/usr/include/openssl11 -fPIC -I/usr/include/hs -I/usr/include/hs -I/tmp/tmpf0_08_r3/.venv/include -I/usr/local/include/python3.10 -c src/hyperscan/hyperscanmodule.c -o /root/py/python-hyperscan/build/temp.linux-x86_64-cpython-310/src/hyperscan/hyperscanmodule.o
src/hyperscan/hyperscanmodule.c: In function ‘ch_match_handler’:
src/hyperscan/hyperscanmodule.c:124:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (unsigned int i = 0; i < size; i++) {
   ^
src/hyperscan/hyperscanmodule.c:124:3: note: use option -std=c99 or -std=gnu99 to compile your code
src/hyperscan/hyperscanmodule.c: In function ‘Database_compile’:
src/hyperscan/hyperscanmodule.c:270:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (uint64_t i = 0; i < elements; i++) {
   ^
src/hyperscan/hyperscanmodule.c:331:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (uint64_t i = 0; i < elements; i++) {
     ^
src/hyperscan/hyperscanmodule.c:384:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
         for (uint64_t i = 0; i < elements; i++) {
         ^
src/hyperscan/hyperscanmodule.c: In function ‘Database_scan’:
src/hyperscan/hyperscanmodule.c:547:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (uint32_t i = 0; i < num_buffers; i++) {
     ^
error: command '/usr/bin/gcc' failed with exit code 1

Resolved by change code to std format c11

And new error is here:

Preparing build environment with build-system requirements setuptools, poetry>=0.12Building hyperscan (0.4.0)
A setup.py file already exists. Using it.
running build
running build_py
copying src/hyperscan/hyperscanmodule.c -> /root/py/python-hyperscan/build/lib.linux-x86_64-cpython-310/hyperscan
running build_ext
building 'hyperscan._hyperscan' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include/openssl11 -I/usr/include/openssl11 -fPIC -I/usr/include/hs -I/usr/include/hs -I/tmp/tmp5r6qyfy_/.venv/include -I/usr/local/include/python3.10 -c src/hyperscan/hyperscanmodule.c -o /root/py/python-hyperscan/build/temp.linux-x86_64-cpython-310/src/hyperscan/hyperscanmodule.o
gcc -pthread -shared -L/usr/lib64/openssl11 -lssl -lcrypto -L/usr/lib64/openssl11 -lssl -lcrypto /root/py/python-hyperscan/build/temp.linux-x86_64-cpython-310/src/hyperscan/hyperscanmodule.o /opt/pcre/.libs/libpcre.a /opt/pcre/.libs/libpcre_la-pcre_byte_order.o /opt/pcre/.libs/libpcre_la-pcre_compile.o /opt/pcre/.libs/libpcre_la-pcre_config.o /opt/pcre/.libs/libpcre_la-pcre_dfa_exec.o /opt/pcre/.libs/libpcre_la-pcre_exec.o /opt/pcre/.libs/libpcre_la-pcre_fullinfo.o /opt/pcre/.libs/libpcre_la-pcre_get.o /opt/pcre/.libs/libpcre_la-pcre_globals.o /opt/pcre/.libs/libpcre_la-pcre_jit_compile.o /opt/pcre/.libs/libpcre_la-pcre_maketables.o /opt/pcre/.libs/libpcre_la-pcre_newline.o /opt/pcre/.libs/libpcre_la-pcre_ord2utf8.o /opt/pcre/.libs/libpcre_la-pcre_refcount.o /opt/pcre/.libs/libpcre_la-pcre_string_utils.o /opt/pcre/.libs/libpcre_la-pcre_study.o /opt/pcre/.libs/libpcre_la-pcre_tables.o /opt/pcre/.libs/libpcre_la-pcre_ucd.o /opt/pcre/.libs/libpcre_la-pcre_valid_utf8.o /opt/pcre/.libs/libpcre_la-pcre_version.o /opt/pcre/.libs/libpcre_la-pcre_xclass.o /opt/pcre/.libs/libpcre_la-pcre_chartables.o /opt/pcre/.libs/libpcreposix_la-pcreposix.o /opt/pcre/.libs/libpcrecpp_la-pcrecpp.o /opt/pcre/.libs/libpcrecpp_la-pcre_scanner.o /opt/pcre/.libs/libpcrecpp_la-pcre_stringpiece.o -lchimera -lhs -o /root/py/python-hyperscan/build/lib.linux-x86_64-cpython-310/hyperscan/_hyperscan.cpython-310-x86_64-linux-gnu.so
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libchimera.a(ch_compile.cpp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libchimera.a(ch_runtime.c.o): relocation R_X86_64_32S against undefined symbol `mmbit_maxlevel_direct_lut' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libchimera.a(ch_alloc.c.o): relocation R_X86_64_32 against symbol `malloc@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
error: command '/usr/bin/gcc' failed with exit code 1

from python-hyperscan.

betterlch avatar betterlch commented on June 11, 2024
  1. download and make install hypercan 5.4.0 with doc guide
  2. use cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON .. remake hyperscan/build/chimera --> hyperscan/build/lib/libchimera.a
  3. add /opt/pcre/ and build pcre-8.4.5 to gen /opt/pcre/.libs for build python-hyperscan
  4. poetry build -vvv (maybe need update cmake an add c11 support in python-hyperscan sourcecode)

Done!

from python-hyperscan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.