由于重新定义pthread_key_create / pthread_setspecific / pthread_getspecific

发布于 2025-01-24 22:27:48 字数 1075 浏览 1 评论 0原文

我深表歉意,因为我在20多年的时间内从未以专业的身份与C打交道,所以也许这里有一个明显的解决方案。

在MingW64中构建时,我可以到达链接器为jq.exe运行的地步,但是pthread特定的代码给我错误:

ccld jq.exe

(这只是以下三个类似的错误之一:)

c:/msys64/mingw64/bin /../ lib/gcc/x86_64-w64-mingw32/11.3.0 /../../../../../../../../../ x86_64-w64-w64-mingw32/bin/ld.exe :c:/msys64/mingw64/bin /../ lib/gcc/x86_64-w64-w64-mingw32/11.3.0 /../../../../../../ lib \ lib \ libpthread.a(libwinpthread_la-thread-thread-thread-read.o.o ):(。text+0x12e0):`pthread_key_create'的多重定义'; 。首先在此处定义

我已经使用PACMAN安装了我认为是必要的库/工具,但是是否有一些可以阻止配置/制作过程包括Pthread库,因为看来预处理器正在尝试避免使用包括< pthread.h> ?这是解决这个问题的正确方法吗?

我的构建步骤:

  • 构建了Oniguruma库(V 5.9.6),并将其放入JQ/模块/Oniguruma中。
  • autoreconf -fi
  • ./configure
  • 制作散文
  • 脚本/crossCompile win64 - 可持续共享-enable-enable-static-enable-able-all-static -target = win64-x86_64-host = x86_64-w64-w64-mingw64-mingw32 -with-niguruma-with-oniguruma =/home/build/proto/win64/usr/local

在编译步骤结束时,链接器失败,因为来自JV.C的Win32线程代码与已链接的WinPthread文件中的定义相撞。

谢谢!

I apologize as I haven't dealt with C in a professional capacity in over 20 years, so maybe there's an obvious fix here.

When building within mingw64 I can get to the point where the linker is running for jq.exe, but the pthread specific code is giving me errors:

CCLD jq.exe

(and this is just one of three similar errors that follow:)

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../lib\libpthread.a(libwinpthread_la-thread.o):(.text+0x12e0): multiple definition of `pthread_key_create'; ./.libs/libjq.a(jv.o):C:\msys64\home\build\ws\jq\build\win64\tmp/../../../src/jv.c:338: first defined here

I have used pacman to install what I believed were the necessary libraries/tools, but is there something that will prevent the configure/make process from including the pthread library since it looks like the preprocessor is trying to avoid including <pthread.h> ? Is that even the correct approach for this problem?

My build steps:

  • built the oniguruma library (v 5.9.6) and put that into jq/modules/oniguruma.
  • autoreconf -fi
  • ./configure
  • make distclean
  • scripts/crosscompile win64 --disable-shared --enable-static --enable-all-static --target=win64-x86_64 --host=x86_64-w64-mingw32 --with-oniguruma=/home/build/proto/win64/usr/local

At the end of the compilation step, the linker fails because the WIN32 threading code from jv.c is colliding with the definitions in the winpthread files that are being linked in.

THANKS!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

执妄 2025-01-31 22:27:48

我可以在msys2 shell中构建JQ 1.6,但是我不需要autoreconfscripts/crossCompile

这是我所做的(我的系统上已经有Onigurama 6.9.8):

# change the next line to point to the proper destination
INSTALLPREFIX=C:/TEMP/jq
./configure --prefix=$INSTALLPREFIX &&
 # fix building DLLs
 sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool &&
 make install-strip &&
 echo SUCCESS

I can build jq 1.6 just fine in MSYS2 shell, but I didn't need autoreconf or scripts/crosscompile at all.

Here's what I did (I already had onigurama 6.9.8 on my system):

# change the next line to point to the proper destination
INSTALLPREFIX=C:/TEMP/jq
./configure --prefix=$INSTALLPREFIX &&
 # fix building DLLs
 sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool &&
 make install-strip &&
 echo SUCCESS
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文