Makefile 如何为正确的PCRE设置标志?/g_regex_split_full:assertion';正则表达式!=空';失败

Makefile 如何为正确的PCRE设置标志?/g_regex_split_full:assertion';正则表达式!=空';失败,makefile,pcre,glib,ldflags,Makefile,Pcre,Glib,Ldflags,打电话的时候 tokens = g_regex_split (arv_gv_device_get_url_regex (), filename, 0); 我正跌跌撞撞地犯这个错误 (process:15239): GLib-WARNING **: unknown option bit(s) set (process:15239): GLib-CRITICAL **: g_regex_split_full: assertion 'regex != NULL' failed 是油嘴滑舌的一部分

打电话的时候

tokens = g_regex_split (arv_gv_device_get_url_regex (), filename, 0);
我正跌跌撞撞地犯这个错误

(process:15239): GLib-WARNING **: unknown option bit(s) set
(process:15239): GLib-CRITICAL **: g_regex_split_full: assertion 'regex != NULL' failed
是油嘴滑舌的一部分

在线搜索使我相信错误可能与编译器引用错误的pcre(=与Perl兼容的正则表达式库)有关。(参见此处对类似错误的讨论:)

我将如何定义编译器拾取的pcre?在Makefile中设置什么标志


其他信息

$ locate libpcre.so
/lib/x86_64-linux-gnu/libpcre.so.3
/lib/x86_64-linux-gnu/libpcre.so.3.13.1
/usr/lib/x86_64-linux-gnu/libpcre.so

$dpkg-s libpcre3
包装:libpcre3
状态:安装正常已安装
优先权:必选
章节:libs
安装尺寸:466
维护者:Ubuntu开发者
架构:amd64
连拱:相同
资料来源:pcre3
版本:1:8.31-2
取决于:libc6(>=2.14)
预紧:连拱支撑

休息时间:大约(将NULL传递给
g_regex_split
时,
regex!=NULL
断言失败,在您的情况下,这意味着
arv_gv_device_get_url_regex
的返回值是
NULL
。听起来您在创建regex时没有检查以确保它实际成功


至于为什么
g_regex_new
没有成功,您没有包含该代码,因此很难回答,但是关于“未知选项位设置”的警告确实提供了一个线索。仔细查看您传递给
g_regex_new
的标志,并找出哪一个正在导致警告修复,这可能会使
g_regex\u new
返回实际实例,而不是
NULL
,这将修复断言失败。当然,您仍然应该在运行时检查返回值并适当处理错误,而不是让它们变成断言失败…

什么版本的您的系统上安装了pcre?您的系统上安装了多个版本的pcre吗?/lib/x86_64-linux-gnu/libpcre.so.3和/lib/x86_64-linux-gnu/libpcre.so.3.13.1
$ dpkg -s libpcre3
Package: libpcre3
Status: install ok installed
Priority: required
Section: libs
Installed-Size: 466
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: same
Source: pcre3
Version: 1:8.31-2
Depends: libc6 (>= 2.14)
Pre-Depends: multiarch-support
Breaks: approx (<< 4.4-1~), cduce (<< 0.5.3-2~), cmigrep (<< 1.5-7~), galax (<< 1.1-7~), libpcre-ocaml (<< 6.0.1~), liquidsoap (<< 0.9.2-3~), ocsigen (<< 1.3.3-1~)
Conflicts: libpcre3-dev (<= 4.3-3)
Description: Perl 5 Compatible Regular Expression Library - runtime files
This is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
.
This package contains the runtime libraries.
Original-Maintainer: Mark Baker <mark@mnb.org.uk>