Question

I recently do some study about executable compression. When compile the test.c C language source and compress it with UPX in Linux not windows. It is list in Terminal: UPX: test.so NotCompressibleException. The source code of test.c is:

int main(){
    int i = 0;
    printf("HelloWorld\n");
    return 0;
}

What am I guessing is that the executable file is too simple to compress? Or may be I missed something? If there is anyone know about this issue, Please tell me the reason. If nobody tell me I have to read source code to find out the issue. Ah! reading source code burden.

Was it helpful?

Solution

There are several reasons to output a NotCompressibleException, but in your case it is simply because the size of your binary is too small. UPX cannot handle binaries under 40Kb.

The best way to workaround this problem is to compile your binary in static mode, in order to get a bigger executable file. So, just try: gcc -static -o mytest mytest.c and then upx -o mytest-upx mytest.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top