LNK错误:在静态链接的应用程序中使用“dlopen”需要在运行时使用共享库 [英] LNK ERROR:Using 'dlopen' in statically linked apps requires at runtime the shared lib

查看:2414
本文介绍了LNK错误:在静态链接的应用程序中使用“dlopen”需要在运行时使用共享库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此链接错误,我正在使用Linux的mongoose web服务器,任何想法?:


mongoose.c:3114:在静态链接中使用''dlopen''应用程序在运行时需要用于链接的glibc版本的共享库


mongoose.c:3081:在静态链接的应用程序中使用''getpwnam''需要在运行时从共享库中获取共享库glibc版本用于链接

I am getting this link error, I am using mongoose web server with Linux, any idea?:

mongoose.c:3114: Using ''dlopen'' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

mongoose.c:3081: Using ''getpwnam'' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

推荐答案

我假设您正在向服务器提供共享库。此用户提供的共享库可能需要其他共享库。您必须确保服务器可以访问所有共享库,包括编译器共享库,如stdc ++,可能还有lib c。


系统变量LD_LIBRARY_PATH是常用的方法服务器在哪里可以找到所有共享库。您的目录添加由分号(;)分隔的路径。您可能必须重新启动服务器。
I assume you are supplying a shared library to the server. This user supplied shared library might need other shared libraries. You have to make sure the server can access all of the shared libraries, including the compiler shared libraries like stdc++, and probably lib c.

The system variable LD_LIBRARY_PATH is the usual way to tell the server where to find all of the shared libraries. You directory add paths to it separated by semi-colons(;). You might have to restart the server.


我需要在运行可执行文件之前设置LD_LIBRARY_PATH。


现在我改为创建所有静态库共享库,我也提供-static标志来创建execubale,我需要删除那个-static标志,我还提供路径/ opt / lib,我保留所有静态库。


最终可执行文件创建,但是我得到了这个dlopen,如果我取出-static标志,那么它就消失了,这两条消息不会出现
I need to set LD_LIBRARY_PATH before I run the executable.

Right now I made all static libs instead shared libs, also I am supplying -static flag to create execubale, do I need to remove that -static flag, also I supply path /opt/lib where I kept all static libs.

finally executable creates, but I gets this "dlopen", if I takeout -static flag , then it goes away, these two messages not coming



我需要在运行可执行文件之前设置LD_LIBRARY_PATH。
I need to set LD_LIBRARY_PATH before I run the executable.



是的,你这样做。 LD_LIBRARY_PATH也可以与编译器一起用于在共享库中进行链接。

-static标志表示不要使用C / C ++共享库。我不建议任何人使用静态标志进行任何应用程序。使用它时,我遇到了类似的碰撞和烧伤问题。


在您的情况下,某些库正在使用dlopen无法找到的共享库。我怀疑它是lib c或stdc ++。将这些路径放在LD_LIBRARY_PATH中,我怀疑问题会消失。

Yes, you do. LD_LIBRARY_PATH can also be used with the compiler for linking in shared libraries.

The -static flag says don''t use the C/C++ shared libraries. I don''t suggest anyone using the static flag for any application. I had similar crash and burns problems when using it.

In your case, some library is using a shared library that dlopen can''t find. I suspect its either lib c or stdc++. Put these paths in your LD_LIBRARY_PATH and I suspect the problem will go away.


这篇关于LNK错误:在静态链接的应用程序中使用“dlopen”需要在运行时使用共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆