Lymphatus / caesium-clt

Caesium Command Line Tools - Lossy/lossless image compression tool
http://saerasoft.com/caesium
Other
354 stars 34 forks source link

Compilation errors and exceptions #53

Closed djerryz closed 1 year ago

djerryz commented 1 year ago

My env:

Microsoft Windows 10 Build 19043
cmake version 3.23.0
mingw32-make.exe --version  -> GNU Make 4.3
gcc/g++ (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 12.2.0

Step:

cd ./libcaesium/
cargo build --release
cd ../caesium-clt
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DLIBCAESIUM_PATH=C:/XXXX/libcaesium/target/release -G "CodeBlocks - MinGW Makefiles"
cmake --build . --target caesiumclt

ERROR 1:

\src\helper.h:38:5: error: unknown type name 'bool'
   38 |     bool keep_metadata;

I Fix this error with #include <stdbool.h> Whether Windows or Linux.

ERROR 2:

helper.c:81:70: error: 'MAX_PATH' undeclared (first use in this function); did you mean 'MAX_PATH_SIZE'?
   81 |                     _fullpath(parameters.output_folder, opts.optarg, MAX_PATH);

I Fix this error with this replace MAX_PATH to MAX_PATH_SIZE.

ERROR 3:

src\error.h:23:5: error: expected identifier before numeric constant
   23 |     ERROR = 0,

I Fix this error with undef ERROR.

PR is : https://github.com/Lymphatus/caesium-clt/pull/54

finally , I successfully completed the compilation , get caesiumclt.exe and caesium.dll, i put them in C:\caesiumclt ,and add the floder to PATH , i can use caesiumclt.exe command now.

BUT another big problem is caesiumclt always return nothing as output, whatever image i give whatever quality parameter i set. eg:

# ls .\in\1.png
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         2022/11/4     15:50         249039 1.png

# caesiumclt.exe -q 80 -o ./out ./in/1.png
Collecting files...
(1/1) ./in/1.png -> C:\Users\ubuntu\Desktop\test\input\out\./in/1.png
Compressing...[WARNING] 7: Cannot calculate file size
243.20 KB -> 0.00 B [-100.00%]
-------------------------------
Compression completed in 0m0s2ms
243.20 KB -> 0.00 B [-100.00% | -243.20 KB]

# ls .\out\              //output nothing

need your help @Lymphatus

Lymphatus commented 1 year ago

I pushed a few changes for the 0.18.0 version that includes your changes in #54, plus I fixed what was wrong with the compression process. The tool was not compatible with the latest libcaesium and could not process files.