secrethet / crunch

Automatically exported from code.google.com/p/crunch
Other
0 stars 0 forks source link

Linux Compilation Fails on 64bits system #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Here's a patch to fix the compilation on a linux 64bits system. I've compared 
the 32 and 64 bits files produced and they have same size. Also, the dds image 
looks exactly the same. However, there are some bytes that differ but doesn't 
seem to be a major issue though.

Original issue reported on code.google.com by boudreau...@gmail.com on 3 Dec 2012 at 4:59

GoogleCodeExporter commented 8 years ago
fix a small issue with the other patch..

Original comment by boudreau...@gmail.com on 3 Dec 2012 at 5:19

GoogleCodeExporter commented 8 years ago
I ran into this compilation error too. I think the issue though is that uint32 
is defined as uint, which is unsigned int - so on a 64-bit platform it is 
64-bit, and the compiler gives an error since defining the same function with 
uint32 and uint64 is actually the same thing. Using uint32_t might be better. 
But, just commenting out the uint32 versions of is_power_of_2 and next_pow2 
gets it to build on linux64.

Original comment by alonza...@gmail.com on 12 Dec 2012 at 7:30

GoogleCodeExporter commented 8 years ago
For the record, attached a modified patch with a minor change.

Original comment by boudreau...@gmail.com on 9 Jan 2013 at 5:15

Attachments:

GoogleCodeExporter commented 8 years ago
Here's my fix for this. I chose the template route because that'll retain 
better behaviour on i386; and my patch also fixes some other compilation 
errors, the fixes being to prefix with “this->”.

I do agree that using <stdint.h> (uint32_t etc.) is preferred, though; indeed, 
I've used this in one place – casting between integers and pointers isn't 
valid, but we can go via intptr_t. (Make no assumptions about pointer sizes – 
the Linux x32 architecture is 32-bit long and 32-bit pointer, but otherwise 
amd64.)

Original comment by justanot...@googlemail.com on 25 Jan 2013 at 3:58

Attachments:

GoogleCodeExporter commented 8 years ago
this patches fail when applyed:

alejandro@desktop:~/crunch-read-only/crnlib$ patch < linux_64_compilation.patch 
patching file crn_math.h
Hunk #1 FAILED at 56.
Hunk #2 FAILED at 79.
Hunk #3 FAILED at 91.
3 out of 3 hunks FAILED -- saving rejects to file crn_math.h.rej
patching file crnlib.cpp
Hunk #1 FAILED at 52.
Hunk #2 FAILED at 456.
2 out of 2 hunks FAILED -- saving rejects to file crnlib.cpp.rej
patching file crn_decomp.h
Hunk #1 FAILED at 374.
1 out of 1 hunk FAILED -- saving rejects to file crn_decomp.h.rej

Original comment by xplane...@gmail.com on 27 Feb 2013 at 12:43