Skip to content
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

crc32 missing when compiling on Ubuntu 16.04 #48

Open
giampaolo opened this issue Mar 23, 2018 · 6 comments
Open

crc32 missing when compiling on Ubuntu 16.04 #48

giampaolo opened this issue Mar 23, 2018 · 6 comments

Comments

@giampaolo
Copy link

giampaolo commented Mar 23, 2018

~/svn/hakchi {master}$ make
...
make[1]: Entering directory '/home/giampaolo/svn/hakchi/build'
make[1]: Nothing to be done for 'first'.
make[1]: Leaving directory '/home/giampaolo/svn/hakchi/build'
sntool/sntool.cpp: In function ‘int checksum(const char*, int)’:
sntool/sntool.cpp:21:67: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
 #define info_printf(...) (disableInfo?0:fprintf(stdout,__VA_ARGS__))
                                                                   ^
sntool/sntool.cpp:134:9: note: in expansion of macro ‘info_printf’
         info_printf("input: %s, fs: %.8x\n",in,fs);
         ^
sntool/sntool.cpp: In function ‘int hsqs(const char*)’:
sntool/sntool.cpp:21:67: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 3 has type ‘uint32_t {aka unsigned int}’ [-Wformat=]
 #define info_printf(...) (disableInfo?0:fprintf(stdout,__VA_ARGS__))
                                                                   ^
sntool/sntool.cpp:267:17: note: in expansion of macro ‘info_printf’
                 info_printf("output fs: %zu\n",fs1);
                 ^
/tmp/ccvs0a6o.o: In function `sunxi_flash_ioctl(unsigned int, unsigned int, unsigned int, _IO_FILE*)':
sntool.cpp:(.text+0x10cf): undefined reference to `crc32'
sntool.cpp:(.text+0x1164): undefined reference to `crc32'
collect2: error: ld returned 1 exit status
Makefile:62: recipe for target 'bin/sntool' failed
make: *** [bin/sntool] Error 1
@1337v411
Copy link

Adding -lz to the g++ compiler seems to solve this issue

diff --git a/Makefile b/Makefile
index 1000036..d62bcac 100644
--- a/Makefile
+++ b/Makefile
@@ -59,4 +59,4 @@ build/macdylibbundler: 3rdparty/macdylibbundler/*
        @$(MAKE) -C $(<D)
 
 bin/sntool: sntool/sntool.cpp
-       @$(CROSS_COMPILE)g++ -I3rdparty/sunxi-tools -I3rdparty/mkbootimg -std=gnu++11 -Wall -Wextra $< -o $@
+       @$(CROSS_COMPILE)g++ -lz -I3rdparty/sunxi-tools -I3rdparty/mkbootimg -std=gnu++11 -Wall -Wextra $< -o $@

@madmonkey1907
Copy link
Owner

that rule now looks like this, somehow I forgot to fix it

bin/sntool: sntool/*.c*
        @$(MAKE) -C $(<D) && cp $(<D)/$(<D) $@

it's in a middle of update, so later

@giampaolo
Copy link
Author

Adding -lz to the g++ compiler seems to solve this issue

didn't work for me

@madmonkey1907
Copy link
Owner

need more info than that

madmonkey@madmonkey:~/games/nesclassic/hakchi$ make bin/sntool
make[1]: Entering directory '/home/madmonkey/games/nesclassic/hakchi/sntool'
crc32.o
sntool.o
sntool.elf
sntool
make[1]: Leaving directory '/home/madmonkey/games/nesclassic/hakchi/sntool'
madmonkey@madmonkey:~/games/nesclassic/hakchi$ 

you can also switch to sntool directory and type make there

@soitanen
Copy link

Hi! I have absolutely the same error output like in first message. If go inside sntool and run make from there I have this output:

soitanen@simulator ~/hakchi/sntool $ make
crc32.o
sntool.o
sntool.cpp: In function ‘int checksum(const char*, int)’:
sntool.cpp:21:67: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
 #define info_printf(...) (disableInfo?0:fprintf(stdout,__VA_ARGS__))
                                                                   ^
sntool.cpp:134:9: note: in expansion of macro ‘info_printf’
         info_printf("input: %s, fs: %.8x\n",in,fs);
         ^
sntool.cpp: In function ‘int hsqs(const char*)’:
sntool.cpp:21:67: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 3 has type ‘uint32_t {aka unsigned int}’ [-Wformat=]
 #define info_printf(...) (disableInfo?0:fprintf(stdout,__VA_ARGS__))
                                                                   ^
sntool.cpp:267:17: note: in expansion of macro ‘info_printf’
                 info_printf("output fs: %zu\n",fs1);
                 ^
sntool.elf
sntool

@windsorschmidt
Copy link

you can also switch to sntool directory and type make there

Thanks. This worked for me. Arch Linux x86/64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants