如何在Automake和libtool-using项目中构建* .so模块?(How to build *.so module in Automake and a libtool-using project?)
我有和其他人一样的问题:
- 我有一个
*.la
文件,由libtool在Automake项目(例如module.la
)中生成,- 但我需要
*.so
才能将它用于dlopen()
(例如module.so
)。但是:项目使用
--disable-shared
进行配置和构建,以确保创建的主二进制文件是一个大的静态链接程序,例如main.x
(更易于部署和调试)。 因此*.so
文件不会被创建。程序
main.x
是一个巨大的类似框架的应用程序,它能够通过dlopen()
加载扩展(模块dlopen()
- 尽管它是静态链接的。当我手动构建
module.so
时,这工作正常。 但是把这个工作放在Makefile.am
对我来说似乎是不可能的。 是的,我可以写lib_LTLIBRARIES
,但是用我的标准--disable-shared
我没有得到*.so
文件。lib_LTLIBRARIES = module.la module_so_SOURCES = module.cpp
文件
module.la
被创建,其中dlopen()
拒绝加载(当然)。我试图将规则放入
Makefile.am
,手动构建它,并且工作正常:# Makefile.am (yes, .am) all: mm_cpp_logger.so SUFFIXES = .so %.so: %.cpp $(CXX) $(CXXFLAGS) -fPIC -fpic -c -I $(top_srcdir)/include -o $@ $< %.so: %.o $(CXX) $(LDFLAGS) -shared -fPIC -fpic -o $@ $<
但这只能是一种解决方法。 我没有获得像依赖检查和安装等所有不错的自动功能。
我如何构建
module.so
,并在Makefile.am
使用--disable-shared
(或者具有相同的效果)构建主程序?
- 我可以使用特殊的automake规则将
*.la
文件处理为*.so
文件吗?- 我可以在任何情况下调整
lib_LTLIBRARIES
进程来创建*.so
文件吗?I have the same problem as others have:
- I have a
*.la
file generated by libtool in an Automake project (e.g.module.la
),- but I need the
*.so
of it to use it fordlopen()
(eg.module.so
).But: project is configured and built with
--disable-shared
to make sure the created main binary is one big statically linked program, e.g.main.x
(easier for deployment and debugging). Thus*.so
files are not created.The program
main.x
is a huge framework-like application which is capable of loading extensions (modules) viadlopen()
-- despite it being linked statically.This works fine when I build
module.so
by hand. But putting this to work inMakefile.am
seems impossible to me. Yes, I can writelib_LTLIBRARIES
, but with my standard--disable-shared
I do not get a*.so
file.lib_LTLIBRARIES = module.la module_so_SOURCES = module.cpp
The file
module.la
is created, whichdlopen()
refuses to load (of course).I tried to put rules into
Makefile.am
building it manually and that works:# Makefile.am (yes, .am) all: mm_cpp_logger.so SUFFIXES = .so %.so: %.cpp $(CXX) $(CXXFLAGS) -fPIC -fpic -c -I $(top_srcdir)/include -o $@ $< %.so: %.o $(CXX) $(LDFLAGS) -shared -fPIC -fpic -o $@ $<
But this can only be a workaround. I do not get all the nice auto-features like dependency-checking and installation.
How can I build
module.so
with still building the main program with--disable-shared
(or with the same effect) in theMakefile.am
-way?
- can I postprocess
*.la
files to*.so
files with a special automake rule?- can I tweak the
lib_LTLIBRARIES
process to create*.so
files in any case?
原文:https://stackoverflow.com/questions/13948916
最满意答案
您可以强制CDI将servlet视为bean,并通过将bean发现模式更改为
all
来执行注入。本文提供了一些有用的背景和一个例子:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="all"> </beans>
或者,在WDT中,您可以通过右键单击项目并选择Java EE Tools - > Generate CDI Beans Deployment Descriptor Stub来生成此项,并确保从下拉“Bean发现模式”选项中选择所有项目。
不利的一面是应用程序需要更长时间才能启动,但这是一个可以避免重新编译的权衡。
You can force CDI to treat the servlet as a bean and perform injection by changing the bean discovery mode to
all
.This article provides some useful background and an example of this:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="all"> </beans>
Or, in WDT, you can generate this by right-clicking the project and selecting Java EE Tools -> Generate CDI Beans Deployment Descriptor Stub, and be sure to select
all
from the drop-down "Bean discovery mode" selection.The downside is the performance hit since the app will take longer to start up, but that's a tradeoff you could make to avoid recompiling.
相关问答
更多-
Websphere Liberty概要文件中的Java EE依赖注入(Java EE Dependency Injection in Websphere Liberty profile)[2024-01-04]
您可以强制CDI将servlet视为bean,并通过将bean发现模式更改为all来执行注入。 本文提供了一些有用的背景和一个例子:根据所提供的信息,我看到两种可能的解决方案。 1)您可以检查服务器运行时环境首选项页面(窗口 - >首选项 - >服务器 - >运行时环境),并确保Liberty运行时条目有效并指向正确的路径(到wlp文件夹)。 如果无效,则需要解决此问题然后重试。 2)检查您的项目实际上是否定位到Liberty运行时。 它似乎是针对完整版本的WebSphere Application Server。 如果是这种情况,请将目标更改为Liberty运行时,然后重试。 I see two possible solutions ...设置WebSphere Liberty概要文件HTTP访问日志记录(Setting up WebSphere Liberty Profile HTTP Access Logging)[2023-12-20]
假设此端点正确启动,您应该使用的是什么。 请注意,defaultHttpEndpoint也会侦听这些端口。 您确定您的端点(id =“HTTPS”)是否正确绑定到这些端口? 我使用以下内容,请注意我正在覆盖/扩展默认端点(id =“defaultHttpEndpoint”)以启用远程访问和http访问日志记录:Websphere 8.5 Liberty Profile - Servlet API setLocale(Websphere 8.5 Liberty Profile - Servlet API setLocale)[2024-04-17]
我建议在WASdev社区使用此页面向IBM报告错误。 如果您不熟悉WASdev社区,那么它也是了解有关Liberty配置文件的更多信息的好地方,它有一些很棒的教程。 I would recommend reporting the bugs to IBM using this page on the WASdev community. If you're not familiar with the WASdev community, it's also a great place to learn more ...Tax2290.war的WEB-INF / lib目录中的sqljdbc.jar文件包含一个具有相同名称的嵌入式JAR文件,并且嵌入的sqljdbc.jar文件长度为0,而另一个文件sqljdbc.jar.old似乎像一个有效的档案。 这是Liberty令人窒息的嵌入式JAR文件。 您应该能够通过从sqljdbc.jar中删除0长度的JAR文件来解决该问题 - 或者将其替换为有效的JAR。 也就是说,Liberty应该可以提供更好的错误信息,或者能够更好地处理这种情况,所以我建议在IBM支持下打开一个PMR ...自8.5.4版本起,Liberty支持IIOP的RMI。 有关如何配置的信息,请访问: https : //www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/rwlp_config_iiopEndpoint.html SOAP通过HTTP / HTTPS端口可用,并使用httpEndpoints进行配置。 有一个有用的教程,用于配置SOAP / HTTP并开发一个在此使用它的客户端/服务器应用程序: h ...@aguibert是对的! 将@RequestScoped添加到Class和create()方法中就可以了! 谢谢! @aguibert was right! Adding @RequestScoped to the Class and to the create() method did it! Thank you!我现在尝试了(使用wlp-webProfile7-16.0.0.3)它有效。 这是CLI输出: 选择[1]我同意,或[2]我不同意:1 第1步(共5步):下载servlet-3.0 ...第2步(共5步):安装servlet-3.0 ...第3步(共5步):下载jsp-2.2 ...第4步(共5步):安装jsp-2.2 ...步骤5 5:清理临时文件...... 所有资产均已成功安装。 开始产品验证...产品验证成功完成。 你能再试一次吗? 也许存储库暂时失效了。 如果仍然无效,您使用的是哪个JDK? I ...无法配置Websphere Liberty Profile 8.5.5.7(Cannot configure Websphere Liberty Profile 8.5.5.7)[2023-12-01]
有几个类似的报道。 通常,Clean服务器重新启动将修复它。 从工具中右键单击服务器视图中的服务器。 在下次启动时单击干净的服务器,然后重新启动服务器。 一般来说,这可以解决问题。 我们正在研究它。 There have been a few similar reports. Usually a Clean server restart will fix it. From the tools right click on the server in the server view. Click on the ...Eclipse中的WebSphere Liberty JAX-WS Web服务生成(WebSphere Liberty JAX-WS Web Service Generation in Eclipse)[2024-01-19]
尝试设置目标运行时。 右键单击WAR项目,然后选择Properties ,然后选择Targeted Runtimes 。 选中您创建的运行时环境旁边的复选框,可以在Runtime Explorer视图中看到该复选框。 Try setting a target runtime. Right-click the WAR project, then select Properties, then Targeted Runtimes. Select the checkbox next to the Runtime ...相关文章
更多- Gradle构建多模块项目
- pychseg - A Python Chinese Segment Project - Google Project Hosting
- python top project of 2013
- lily project
- 软件项目风险管理(Project Risk Management)
- Nutch 1-build
- zoj 2966 Build The Electric System
- Becoming a data scientist
- Clojure常用模块
- Hadoop 2.1.0 beta 发布,HDFS提供SnapShot模块
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)