• 8008阅读
  • 8回复

【提问】一个重要的问题,就是怎么样静态连接,让可执行程序脱离运行环境 [复制链接]

上一主题 下一主题
离线hetal
 

只看楼主 倒序阅读 楼主  发表于: 2005-10-25
1.我在官方网上查了很多,没有收活
2.我在手册上发现了如下几点,不过还是不知道是怎么弄的
QMAKE_CFLAGS_MT
This variable contains the compiler flags for creating a multi-threaded application or when the version of Qt that you link against is a multi-threaded statically linked library. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.

QMAKE_CFLAGS_MT_DBG
This variable contains the compiler flags for creating a debuggable multi-threaded application or when the version of Qt that you link against is a debuggable multi-threaded statically linked library. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.

POST_TARGETDEPS
All libraries that the target depends on can be listed in this variable. Some backends do not support this, these include MSVC Dsp, and ProjectBuilder .pbproj files. Generally this is support internally by these build tools, this is usefull for explicitly listing dependant static libraries.
This list will go after all builtin (and $$PRE_TARGETDEPS) dependencies.

PRE_TARGETDEPS
All libraries that the target depends on can be listed in this variable. Some backends do not support this, these include MSVC Dsp, and ProjectBuilder .pbproj files. Generally this is support internally by these build tools, this is usefull for explicitly listing dependant static libraries.
This list will go before all builtin dependencies.
还望高手指点[p:1]
离线myer

只看该作者 1楼 发表于: 2005-10-26
安装编译的时候,采用静态编译

具体参考:
configure -help
http://user.qzone.qq.com/56430808
离线hetal

只看该作者 2楼 发表于: 2005-10-26
在windows下,又怎么办呢?
而且我试过了修改Makefile,加了-static 不过编译出来还是不行,要依赖其运行环境
只看该作者 3楼 发表于: 2005-10-26
不行滴~要带2个运行库,有几M大呢
离线hetal

只看该作者 4楼 发表于: 2005-10-31
确实很郁闷,这样对发布不好,我想是肯定有的,只是我没有找到办法
离线坤义
只看该作者 5楼 发表于: 2006-04-11
我也碰到这样的问题了 顶啊 高人帮忙啊
离线XChinux

只看该作者 6楼 发表于: 2006-04-11
看置顶帖 中的“常见的几个Qt编程问题的处理”
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线sinl

只看该作者 7楼 发表于: 2006-04-12
有的时候光加一个-static的编译选项是不行的,因为QT也使用了很多第三方库,而有些linux发行版似乎只提供了这些第三方库的共享库(比如:RedFlag 桌面版4.0只提供了fontconfig的共享库,这样就要去掉Qt4的fontconfig的编译选项,当然你也可以自己编译一个静态的fontconfig库然后再编译Qt),我有时候为了追求最大限度的环境适应性,都关掉QT4的大部分编译选项,这样基本可以在完全没有Qt的环境下运行。


不过还是有例外情况,那就是如果你使用了Qt4的插件开发库,就不能使用静态编译了,不过我觉得要是真的做插件开发就自己直接用c++实现也很好,我尝试过。
离线guyansrg

只看该作者 8楼 发表于: 2006-04-21
我用Mole Box 把运行所需要的动态库跟自己的程序一块儿打包,
这样就没问题了
快速回复
限100 字节
 
上一个 下一个