Skip to content

Alpine linux support #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lmalmeida opened this issue Dec 20, 2021 · 10 comments
Closed

Alpine linux support #170

lmalmeida opened this issue Dec 20, 2021 · 10 comments
Assignees
Labels
enhancement New feature or request patch released

Comments

@lmalmeida
Copy link

The current binary does not support Alpine Linux or RHEL 6.
An alternative is to build a (fully) static binary.

Example command line to build:

native-image --static -jar log4j2-scanner-2.3.7.jar log4j2-scanner-2.3.7 -H:-CheckToolchain -H:+AllowIncompleteClasspath 

I suggest primarily a change on the documentation

@xeraph
Copy link
Contributor

xeraph commented Dec 20, 2021

@lmalmeida Would you test this binary? I will release it if it works as expected.
logpresso-log4j2-scan-2.3.7-linux-static.tar.gz

@xeraph xeraph self-assigned this Dec 20, 2021
@xeraph xeraph added the enhancement New feature or request label Dec 20, 2021
@lmalmeida
Copy link
Author

Seems to work.
For reference, I've used containers to test it, similar to:

#FROM centos:6
FROM tomcat:alpine
COPY log4j2-scan-static /tmp
RUN /tmp/log4j2-scan-static /

@xeraph
Copy link
Contributor

xeraph commented Dec 20, 2021

@lmalmeida Thank you very much. --static switch was what I looking for. Additionally, I had to install yum install glibc-static to use --static switch.

@xeraph
Copy link
Contributor

xeraph commented Dec 20, 2021

@lmalmeida Just released v2.4.0. Would you test it?

@jgstew
Copy link
Contributor

jgstew commented Dec 20, 2021

Does this static option remove the dependency on glibc? Does the same option work on windows to remove the need for VC++ runtime?

@xeraph
Copy link
Contributor

xeraph commented Dec 20, 2021

@jgstew Yes. I applied same option for windows build.

$ file log4j2-scan
log4j2-scan: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=c19344ff54e5eaa74a485f5be0f45df5c4b533f8, not stripped

@lmalmeida
Copy link
Author

Tested v2.4.1. Seems to work. Thanks

@lmalmeida lmalmeida reopened this Dec 20, 2021
@lmalmeida
Copy link
Author

BTW, for windows, it still has dependencies.

D:\temp>dumpbin /dependents log4j2-scan.exe
Microsoft (R) COFF/PE Dumper Version 14.30.30706.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file log4j2-scan.exe

File Type: EXECUTABLE IMAGE

  Image has the following dependencies:

    VERSION.dll
    ADVAPI32.dll
    WS2_32.dll
    USERENV.dll
    MSWSOCK.dll
    USER32.dll
    KERNEL32.dll
    VCRUNTIME140.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-environment-l1-1-0.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-convert-l1-1-0.dll
    api-ms-win-crt-stdio-l1-1-0.dll
    api-ms-win-crt-filesystem-l1-1-0.dll
    api-ms-win-crt-math-l1-1-0.dll
    api-ms-win-crt-locale-l1-1-0.dll
    IPHLPAPI.DLL

  Summary

        2000 .data
        3000 .pdata
       14000 .rdata
        5000 .reloc
        4000 .rodata
      61F000 .svm_hea
      47A000 .text

@xeraph
Copy link
Contributor

xeraph commented Dec 20, 2021

Oh no.. then --static doesn't work for windows version. Fixed v2.4.0 release note.

@xeraph
Copy link
Contributor

xeraph commented Dec 22, 2021

@lmalmeida Do you have any idea? Segmentation fault when System.getProperty() or new SimpleDateFormat() is invoked. #192 (comment)

I guess I'll have to give up static build...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request patch released
Projects
None yet
Development

No branches or pull requests

3 participants