Open SunnyCaptain opened 2 months ago
If you really need to use a static linked executable, here is the solution:
https://github.com/ossrs/srs/blob/3e811ba34a478b675282d4af394c4a33300d5c8e/trunk/configure#L227
change to:
SrsLinkOptions="${SrsLinkOptions} -static";
But I don't think the fully static linked executable is a good idea.
-static-libstdc++
will use static linked libstdc++
to replace the libstdc++.so
,
-static-libgcc
will remove libgcc_s.so
,
With those 2 link options will make your executable portable enough.
@suzp1984 I believe it is acceptable to support statically linking libc by modifying the following:
SrsLinkOptions="${SrsLinkOptions} -static-libstdc++ -static";
Could you please file a PR to address this?
PS: Previously, we only statically linked libc++, not libc, because most of libc is compatible.
I closed pull request #4152 because the current side effects of using -static
are unclear. Despite statically linking glibc, some functions are still dynamically linked, which could potentially cause other issues.
If you are willing to take the risk, you can modify the code yourself by replacing -static-libstdc++
with -static
in the configure
script.
TRANS_BY_GPT4
I specified the -- static option when configuring, but the compiled SRS program is still dynamically linked. There is no such problem in version 3.0, but upgrading to version 4.0 will cause this issue, which has been bothering me for a long time. I hope the experts can give me some advice!
=======================================================================================
我在configure时指定了--static选项,但是编译得到的srs程序仍然是dynamically linked,在3.0版本没有这个问题,但是升级4.0版本就会这样,困扰了很长时间,望大佬们赐教!