a compatible RE2 API( 2021-11-01) by calling Rust library regex(rure)
$ git clone https://gitee.com/openeuler/re2-rust.git
$ cd re2-rust
使用rust-lang/regex的版本号为1.6.0 安装过程如下:
$ git clone -b 1.6.0 --depth=1 https://github.com/rust-lang/regex.git
$ cd regex
$ patch -p1 < ../patch/rure.patch
$ cd regex-capi
$ cargo build --verbose
对于编译完成的librure.a
和librure.so
文件需要进行手工安装
# note: go to re2-rust root directory first.
$ cd ../../
# put the librure.a and librure.so into the /usr/lib
$ sudo cp regex/target/debug/librure.a /usr/lib
$ sudo cp regex/target/debug/librure.so /usr/lib
# make librure.so visible
$ sudo ldconfig
手工安装rure.h文件
# copy the rure.h
$ sudo cp regex/regex-capi/include/rure.h /usr/include
使用rure库: 使用regex/regex-capi/ctest/目录下的 test.c文件进行测试
$ gcc test.c -o test -lrure
$ ./test
$ make
$ sudo make install