-
-
Notifications
You must be signed in to change notification settings - Fork 17
If ExifTool is used, binary compiled using perlcc depends on Config.so and cwd.so, even if --static/--staticxs is used. #423
Comments
A true static binary needs the Perl to be compiled static, with all modules be compiled static also. It is possible, but I never heard that anyone did that. |
Is it possible to compile everything statically base on the install instruction for cperl (shown below) ? :D If yes, could you suggest which switches one should use ? Many thanks !
|
Also interested if one can compile cperl statically with its modules - for the goal of embedding the interpreter statically to run some scripts, similar to what might (?) be accomplished with staticperl. Maybe it even can be a lightweight alternative to WebPerl and compile fully into WebAssembly. It would also be very useful for |
Here's how I tried configuring cperl to compile statically: On my system it breaks with:
|
@rurban I tried to compile cperl with all modules in static way: At the end of compilation (linking time of the final cperl executable?) I got this error:
This is not so many errors, so hopefully can be fixed easily |
Maybe it's PL_nan warning is concerning though: it seems that two ifdef branches trigger on my system (WSLv1, Ubuntu 18.04) and it gets defined twice: |
The duplicate Normalize symbols are easy to fix, and should be in a seperate ticket. The nan stuff is an upstream problem, and indeed a severe bug |
Also, regular expression module still got put into some dynamic_ext_re |
A more lightweight setup: ./Configure -sde -Dprefix=$PREFIX -Dstatic_ext="Encode Config IO Fcntl Cwd Storable Digest/MD5 List/Util Time/HiRes File/Glob PerlIO/scalar"
bash +x Makefile.SH
make -j4
# succeeds
# remove installman line
make install
# fails
|
What is XS and how do I link it statically? |
Basically, static perl compiles fine (except for NaN issue), but Glob module fails:
|
It seems that the reason is that XSLoader module and XSLoader::load() doesn't work well. I found XSLoader in Makefile:
So it seems it still wants to do dynamic loading for something. What does it try to load dynamically for globbinb? libc? |
Here lives that Glob.pm file: https://github.com/perl11/cperl/tree/0f5b639e779cc36fc203afefe79c7810906fac65/ext/File-Glob Is XSLoader FFI supposed to support XSLoader::load() even if https://github.com/perl11/cperl/blob/0f5b639e779cc36fc203afefe79c7810906fac65/ext/File-Glob/Glob.xs is compiled statically? Disalbing usedl completely, unfortunately leads to:
|
It seems that all static modules that use XSLoader have this problem: during make install or just in runtime. Here's a log of a similar problem of PerlIO/Scalar while running perlcc:
|
It seems that static modules also misbehave in perlcc-produced source code: Compiling without
tlmgr.c source code: tlmgr.zip |
To summarize the encountered problems:
XSLoader seems to be inside DynaLoader.o package which by default is linked into libperl.a. |
If ExifTool is used, binary compiled using perlcc depends on Config.so and Cwd.so, even if --static/--staticxs is used.
The reason might be that ExifTool utilizes Config.so .
The problem is that the binary compiled requires cperl installation and is not portable any more.
That is to say, the binary cannot run on another machine without cperl at the expected position.
Output of strace is shown below
Could you suggest how to build the "true" static binary under this circumstance ? Many thanks !
The text was updated successfully, but these errors were encountered: