Trojan-Plus-Group / trojan-plus

More Experimental Effective Features for Trojan
GNU General Public License v3.0
83 stars 21 forks source link

如何编译成静态库 #11

Closed qiuzi closed 4 years ago

qiuzi commented 4 years ago

在GCC 6的系统里无法运行 其关联的lib和boost 有什么办法直接编译成完整的二进制静态形式

yuchting commented 4 years ago

Trojan Plus needs GCC 7.0+ to compile as C++17, so you need to upgrade you compiler first.

We highly recommend users to compile Trojan Plus rather than copy binary file to you system. as a open source project, clone+compile is the first choice.

qiuzi commented 4 years ago

/usr/bin/ld: /usr/local/lib/libcrypto.a(dso_dlfcn.o): in functiondlfcn_globallookup': dso_dlfcn.c:(.text+0x11): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: /usr/local/lib/mariadb/libmysqlclient.a(mariadb_lib.c.o): in function read_user_name': /root/mariadb-connector-c-3.1.7-src/libmariadb/mariadb_lib.c:511: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: CMakeFiles/trojan.dir/src/core/service.cpp.o: in functionService::Service(Config&, bool)': service.cpp:(.text+0x418a): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: /usr/local/lib/libcrypto.a(b_sock.o): in function BIO_gethostbyname': b_sock.c:(.text+0x51): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: /usr/local/lib/mariadb/libmysqlclient.a(mariadb_lib.c.o): in functionmysql_once_init': /root/mariadb-connector-c-3.1.7-src/libmariadb/mariadb_lib.c:3578: warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking [100%] Built target trojan ` 数据库这块不能通过

yuchting commented 4 years ago

Here are two options might help you:

  1. remove mysql(mariadb) from compiling options(parameters), mysql options is not a required.
  2. try to re-compile openssl (I DO remember it is static compiling way for openssl) and re-install gcc and try it again.

PS. I see all messages are warning, and trojan binary should be compiled completely, does it run error?

qiuzi commented 4 years ago

除mysql功能以外 其它正常

yuchting commented 4 years ago

Did your compile the original trojan, is it OK?

qiuzi commented 4 years ago

原版按照你给的cmake 方式依旧出现类似警告 mysql不可用 -DCMAKE_EXE_LINKER_FLAGS="-static -static-libstdc++"

qiuzi commented 4 years ago

发现用azure pipelines云可以自动生成程序

yuchting commented 4 years ago

In my opinion, you compiler environment might has some problem about glibc or other something. I haven't more experience about this.

Of course you can use the binary in Azure Pipelines, it was built for CentOS 64bit system.

qiuzi commented 4 years ago

我觉得借助微软云定期发布二进制版本 这样更便于推广