Help me to compile a packzip tools
-
- Posts: 52
- Joined: Tue Sep 14, 2021 7:40 am
Help me to compile a packzip tools
Hai bro,i don't know why when i compile your tool for termux with architecture arm or aarch64 i always found 3 warning and for error
This the logs of my console
~/packzip $ make
cc -O2 -c libs/7z_advancecomp/*.cc
cc -O2 -c libs/lzma/LzmaDec.c libs/lzma/Lzma2Dec.c libs/lzma/Bra86.c libs/lzma/LzFind.c libs/lzma/LzmaEnc.c libs/lzma/Lzma2Enc.c -D_7ZIP_ST -D_7Z_TYPES_
cc -O2 -c libs/uberflate/uberflate.c
cc -O2 -c compression/advancecomp.cpp
cc -O2 -c compression/adler32.c
cc -O2 -c libs/zopfli/*.c
cc packzip.c -O2 -o packzip *.o -lstdc++ -lz -lm -static
packzip.c:288:48: warning: incompatible pointer types passing 'int *' to parameter of type 'size_t *' (aka 'unsigned long *') [-Wincompatible-pointer-types]
ZopfliCompress(&opt, type, in, insz, &out, &outsz);
^~~~~~
./libs/zopfli/zopfli.h:91:50: note: passing argument to parameter 'outsize' here
unsigned char** out, size_t* outsize);
^
packzip.c:336:89: warning: incompatible pointer types passing 'size_t *' (aka 'unsigned long *') to parameter of type 'int *' [-Wincompatible-pointer-types]
else { free(out_data); out_data = myzopfli(in_data, in_size, &ret_t, ZOPFLI_FORMAT_ZLIB); ret = ret_t; }
^~~~~~
packzip.c:273:37: note: passing argument to parameter 'ret_outsz' here
u8 *myzopfli(u8 *in, int insz, int *ret_outsz, int type) {
^
packzip.c:342:89: warning: incompatible pointer types passing 'size_t *' (aka 'unsigned long *') to parameter of type 'int *' [-Wincompatible-pointer-types]
else { free(out_data); out_data = myzopfli(in_data, in_size, &ret_t, ZOPFLI_FORMAT_DEFLATE); ret = ret_t; }
^~~~~~
packzip.c:273:37: note: passing argument to parameter 'ret_outsz' here
u8 *myzopfli(u8 *in, int insz, int *ret_outsz, int type) {
^
packzip.c:486:37: error: function definition is not allowed here
void *SzAlloc(void *p, size_t size) { return(real_calloc(size, 1)); } // xmalloc doesn't return in case of error
^
packzip.c:487:37: error: function definition is not allowed here
void SzFree(void *p, void *address) { if(address) real_free(address); }
^
packzip.c:488:22: error: use of undeclared identifier 'SzAlloc'; did you mean 'g_Alloc'?
ISzAlloc g_Alloc = { SzAlloc, SzFree };
^~~~~~~
g_Alloc
packzip.c:488:10: note: 'g_Alloc' declared here
ISzAlloc g_Alloc = { SzAlloc, SzFree };
^
packzip.c:488:31: error: use of undeclared identifier 'SzFree'
ISzAlloc g_Alloc = { SzAlloc, SzFree };
^
3 warnings and 4 errors generated.
make: *** [Makefile:14: all] Error 1
Please fix it
Oh ya btw i give little change for the makefile but it still cant please help
This the logs of my console
~/packzip $ make
cc -O2 -c libs/7z_advancecomp/*.cc
cc -O2 -c libs/lzma/LzmaDec.c libs/lzma/Lzma2Dec.c libs/lzma/Bra86.c libs/lzma/LzFind.c libs/lzma/LzmaEnc.c libs/lzma/Lzma2Enc.c -D_7ZIP_ST -D_7Z_TYPES_
cc -O2 -c libs/uberflate/uberflate.c
cc -O2 -c compression/advancecomp.cpp
cc -O2 -c compression/adler32.c
cc -O2 -c libs/zopfli/*.c
cc packzip.c -O2 -o packzip *.o -lstdc++ -lz -lm -static
packzip.c:288:48: warning: incompatible pointer types passing 'int *' to parameter of type 'size_t *' (aka 'unsigned long *') [-Wincompatible-pointer-types]
ZopfliCompress(&opt, type, in, insz, &out, &outsz);
^~~~~~
./libs/zopfli/zopfli.h:91:50: note: passing argument to parameter 'outsize' here
unsigned char** out, size_t* outsize);
^
packzip.c:336:89: warning: incompatible pointer types passing 'size_t *' (aka 'unsigned long *') to parameter of type 'int *' [-Wincompatible-pointer-types]
else { free(out_data); out_data = myzopfli(in_data, in_size, &ret_t, ZOPFLI_FORMAT_ZLIB); ret = ret_t; }
^~~~~~
packzip.c:273:37: note: passing argument to parameter 'ret_outsz' here
u8 *myzopfli(u8 *in, int insz, int *ret_outsz, int type) {
^
packzip.c:342:89: warning: incompatible pointer types passing 'size_t *' (aka 'unsigned long *') to parameter of type 'int *' [-Wincompatible-pointer-types]
else { free(out_data); out_data = myzopfli(in_data, in_size, &ret_t, ZOPFLI_FORMAT_DEFLATE); ret = ret_t; }
^~~~~~
packzip.c:273:37: note: passing argument to parameter 'ret_outsz' here
u8 *myzopfli(u8 *in, int insz, int *ret_outsz, int type) {
^
packzip.c:486:37: error: function definition is not allowed here
void *SzAlloc(void *p, size_t size) { return(real_calloc(size, 1)); } // xmalloc doesn't return in case of error
^
packzip.c:487:37: error: function definition is not allowed here
void SzFree(void *p, void *address) { if(address) real_free(address); }
^
packzip.c:488:22: error: use of undeclared identifier 'SzAlloc'; did you mean 'g_Alloc'?
ISzAlloc g_Alloc = { SzAlloc, SzFree };
^~~~~~~
g_Alloc
packzip.c:488:10: note: 'g_Alloc' declared here
ISzAlloc g_Alloc = { SzAlloc, SzFree };
^
packzip.c:488:31: error: use of undeclared identifier 'SzFree'
ISzAlloc g_Alloc = { SzAlloc, SzFree };
^
3 warnings and 4 errors generated.
make: *** [Makefile:14: all] Error 1
Please fix it
Oh ya btw i give little change for the makefile but it still cant please help
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Help me to compile a packzip tools
For the first warning it's enough to declare outsz at line 274 as size_t.
For the second warning replace "int *ret_outsz" with "size_t *ret_outsz" at line 273.
For the others try moving the 3 lines at line 486 to line 483 (before the beginning of the lzma_compress function)
For the second warning replace "int *ret_outsz" with "size_t *ret_outsz" at line 273.
For the others try moving the 3 lines at line 486 to line 483 (before the beginning of the lzma_compress function)
-
- Posts: 52
- Joined: Tue Sep 14, 2021 7:40 am
Re: Offzip reimported difference
Help me.cause i want to compiled the packzip for termux has error 4 warning three
Code: Select all
~ $ cd /sdcard/packzip
/sdcard/packzip $ make
cc -s -O2 -fstack-protector-all -c libs/7z_advancecomp/*.cc
clang-12: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc -s -O2 -fstack-protector-all -c libs/lzma/LzmaDec.c libs/lzma/Lzma2Dec.c libs/lzma/Bra86.c libs/lzma/LzFind.c libs/lzma/LzmaEnc.c libs/lzma/Lzma2Enc.c -D_7ZIP_ST -D_7Z_TYPES_
clang-12: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc -s -O2 -fstack-protector-all -c libs/uberflate/uberflate.c
clang-12: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc -s -O2 -fstack-protector-all -c compression/advancecomp.cpp
clang-12: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc -s -O2 -fstack-protector-all -c compression/adler32.c
clang-12: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc -s -O2 -fstack-protector-all -c libs/zopfli/*.c
clang-12: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc packzip.c -s -O2 -fstack-protector-all -o packzip *.o -lstdc++ -lz -lm -static
packzip.c:288:48: warning: incompatible pointer types passing 'int *' to parameter of type 'size_t *' (aka 'unsigned long *') [-Wincompatible-pointer-types]
ZopfliCompress(&opt, type, in, insz, &out, &outsz);
^~~~~~
./libs/zopfli/zopfli.h:91:50: note: passing argument to parameter 'outsize' here
unsigned char** out, size_t* outsize);
^
packzip.c:336:89: warning: incompatible pointer types passing 'size_t *' (aka 'unsigned long *') to parameter of type 'int *' [-Wincompatible-pointer-types]
else { free(out_data); out_data = myzopfli(in_data, in_size, &ret_t, ZOPFLI_FORMAT_ZLIB); ret = ret_t; }
^~~~~~
packzip.c:273:37: note: passing argument to parameter 'ret_outsz' here
u8 *myzopfli(u8 *in, int insz, int *ret_outsz, int type) {
^
packzip.c:342:89: warning: incompatible pointer types passing 'size_t *' (aka 'unsigned long *') to parameter of type 'int *' [-Wincompatible-pointer-types]
else { free(out_data); out_data = myzopfli(in_data, in_size, &ret_t, ZOPFLI_FORMAT_DEFLATE); ret = ret_t; }
^~~~~~
packzip.c:273:37: note: passing argument to parameter 'ret_outsz' here
u8 *myzopfli(u8 *in, int insz, int *ret_outsz, int type) {
^
packzip.c:486:37: error: function definition is not allowed here
void *SzAlloc(void *p, size_t size) { return(real_calloc(size, 1)); } // xmalloc doesn't return in case of error
^
packzip.c:487:37: error: function definition is not allowed here
void SzFree(void *p, void *address) { if(address) real_free(address); }
^
packzip.c:488:22: error: use of undeclared identifier 'SzAlloc'; did you mean 'g_Alloc'?
ISzAlloc g_Alloc = { SzAlloc, SzFree };
^~~~~~~
g_Alloc
packzip.c:488:10: note: 'g_Alloc' declared here
ISzAlloc g_Alloc = { SzAlloc, SzFree };
^
packzip.c:488:31: error: use of undeclared identifier 'SzFree'
ISzAlloc g_Alloc = { SzAlloc, SzFree };
^
3 warnings and 4 errors generated.
make: *** [Makefile:14: all] Error 1
/sdcard/packzip $
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Help me to compile a packzip tools
I already replied you here, why did you post in another topic on a different matter???
-
- Posts: 52
- Joined: Tue Sep 14, 2021 7:40 am
Re: Help me to compile a packzip tools
IM sorry.but it has another error
Code: Select all
~/pz $ cd .. && rm -r pz && cp -r /sdcard/pz pz && cd pz && make
cc -s -O2 -fstack-protector-all -c libs/7z_advancecomp/*.cc
clang-13: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc -s -O2 -fstack-protector-all -c libs/lzma/LzmaDec.c libs/lzma/Lzma2Dec.c libs/lzma/Bra86.c libs/lzma/LzFind.c libs/lzma/LzmaEnc.c libs/lzma/Lzma2Enc.c -D_7ZIP_ST -D_7Z_TYPES_
clang-13: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc -s -O2 -fstack-protector-all -c libs/uberflate/uberflate.c
clang-13: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc -s -O2 -fstack-protector-all -c compression/advancecomp.cpp
clang-13: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc -s -O2 -fstack-protector-all -c compression/adler32.c
clang-13: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc -s -O2 -fstack-protector-all -c libs/zopfli/*.c
clang-13: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
cc packzip.c -s -O2 -fstack-protector-all -o packzip *.o -lstdc++ -lz -lm -static
packzip.c:288:49: error: use of undeclared identifier 'outsz'; did you mean 'puts'?
ZopfliCompress(&opt, type, in, insz, &out, &outsz);
^~~~~
puts
/data/data/com.termux/files/usr/include/stdio.h:135:5: note: 'puts' declared here
int puts(const char* __s);
^
packzip.c:290:32: error: use of undeclared identifier 'outsz'; did you mean 'puts'?
if(ret_outsz) *ret_outsz = outsz;
^~~~~
puts
/data/data/com.termux/files/usr/include/stdio.h:135:5: note: 'puts' declared here
int puts(const char* __s);
^
2 errors generated.
make: *** [Makefile:14: all] Error 1
~/pz $
-
- Posts: 52
- Joined: Tue Sep 14, 2021 7:40 am
Re: Help me to compile a packzip tools
Ok now, IM done with it.i do
1.line 274 i don't changed it cause it Will make error
2.i changed the Makefile. I delete the static option
1.line 274 i don't changed it cause it Will make error
Code: Select all
outzs not recognize it.do you mean putzs
2.i changed the Makefile. I delete the static option
Code: Select all
EXE = packzip
CFLAGS += -s -O2 -fstack-protector-all
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
SRC = $(EXE).c
all:
$(CC) $(CFLAGS) -c libs/7z_advancecomp/*.cc
$(CC) $(CFLAGS) -c libs/lzma/LzmaDec.c libs/lzma/Lzma2Dec.c libs/lzma/Bra86.c libs/lzma/LzFind.c libs/lzma/LzmaEnc.c libs/lzma/Lzma2Enc.c -D_7ZIP_ST -D_7Z_TYPES_
$(CC) $(CFLAGS) -c libs/uberflate/uberflate.c
$(CC) $(CFLAGS) -c compression/advancecomp.cpp
$(CC) $(CFLAGS) -c compression/adler32.c
$(CC) $(CFLAGS) -c libs/zopfli/*.c
$(CC) $(SRC) $(CFLAGS) -o $(EXE) *.o -lstdc++ -lz -lm # -static
install:
install -m 755 -d $(BINDIR)
install -m 755 $(EXE) $(BINDIR)/$(EXE)
.PHONY:
install
-
- Posts: 52
- Joined: Tue Sep 14, 2021 7:40 am
Re: Help me to compile a packzip tools
Thank aluigi,for helping me
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Help me to compile a packzip tools
At line 274 I said to declare outsz as size_t, from:
to
Code: Select all
int outsz = 0;
Code: Select all
size_t outsz = 0;
-
- Posts: 52
- Joined: Tue Sep 14, 2021 7:40 am
Re: Help me to compile a packzip tools
You said at line 273
-
- Posts: 52
- Joined: Tue Sep 14, 2021 7:40 am
Re: Help me to compile a packzip tools
Thanks,But now its work properly
-
- Posts: 52
- Joined: Tue Sep 14, 2021 7:40 am
Re: Help me to compile a packzip tools
This the code
At line 273-274
And line 484 until 487
And i changed the Makefile deleting the --static option
Bc when try to compile it
It has error dont find library file -lz -lm
At line 273-274
Code: Select all
u8 *myzopfli(u8 *in, int insz, size_t *ret_outsz, int type) {
int outsz = 0;
u8 *out = NULL;
And line 484 until 487
Code: Select all
void *SzAlloc(void *p, size_t size) { return(real_calloc(size, 1)); } // xmalloc doesn't return in case of error
void SzFree(void *p, void *address) { if(address) real_free(address); }
ISzAlloc g_Alloc = { SzAlloc, SzFree };
int lzma_compress(u8 *in, int insz, u8 *out, int outsz, int flags) {
And i changed the Makefile deleting the --static option
Bc when try to compile it
It has error dont find library file -lz -lm
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Help me to compile a packzip tools
Cool, so is it ok now?
No idea why -static doesn't link to -lz (zlib) and -lm (math), anyway that's only good for sharing a static binary, it's not good for local compiling (probably I left it by mistake or because I planned to release a pre-compiled binary)
No idea why -static doesn't link to -lz (zlib) and -lm (math), anyway that's only good for sharing a static binary, it's not good for local compiling (probably I left it by mistake or because I planned to release a pre-compiled binary)
-
- Posts: 52
- Joined: Tue Sep 14, 2021 7:40 am
Re: Help me to compile a packzip tools
Yeah,its ok
-
- Posts: 52
- Joined: Tue Sep 14, 2021 7:40 am
Re: Help me to compile a packzip tools
Yeah,its ok now
Its work well
Thanks
Its work well
Thanks
-
- Posts: 52
- Joined: Tue Sep 14, 2021 7:40 am
Re: Help me to compile a packzip tools
Yeah,its ok now
Its work well
Thanks
Its work well
Thanks