Open Sembiance opened 7 years ago
Thanks to the issue since I try to use UnityPack and build the module. In my Windows 64 plateform, the (uint32) should cast to (long long) (It's mentioned in same stackoverflow link) to get the build done.
Is this still an issue in 0.4.0?
Still happening with the very latest github master version with python 3.6. And yes, changing the casts on line 2347 and 2369 from (uint32)
to (long long)
fixes it.
sembiance@lostcrag ~/tmp/decrunch $ sudo python setup.py install
running install
running bdist_egg
running egg_info
writing decrunch.egg-info/PKG-INFO
writing dependency_links to decrunch.egg-info/dependency_links.txt
writing top-level names to decrunch.egg-info/top_level.txt
reading manifest template 'MANIFEST.in'
writing manifest file 'decrunch.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building 'decrunch' extension
x86_64-pc-linux-gnu-g++ -pthread -fPIC -Icrunch -I/usr/include/python3.6m -c decrunch.cpp -o build/temp.linux-x86_64-3.6/decrunch.o -std=c++11
x86_64-pc-linux-gnu-g++ -pthread -fPIC -Icrunch -I/usr/include/python3.6m -c crn_decomp.cpp -o build/temp.linux-x86_64-3.6/crn_decomp.o -std=c++11
In file included from crn_decomp.cpp:18:
crunch/crn_decomp.h: In function ‘void* crnd::crnd_malloc(size_t, size_t*)’:
crunch/crn_decomp.h:2347:23: error: cast from ‘crnd::uint8*’ {aka ‘unsigned char*’} to ‘crnd::uint32’ {aka ‘unsigned int’} loses precision [-fpermissive]
2347 | CRND_ASSERT(((uint32)p_new & (CRND_MIN_ALLOC_ALIGNMENT - 1)) == 0);
| ^~~~~
crunch/crn_decomp.h:468:13: note: in definition of macro ‘CRND_ASSERT’
468 | (void)((!!(_exp)) || (crnd::crnd_assert(#_exp, __FILE__, __LINE__), 0))
| ^~~~
crunch/crn_decomp.h: In function ‘void* crnd::crnd_realloc(void*, size_t, size_t*, bool)’:
crunch/crn_decomp.h:2369:23: error: cast from ‘void*’ to ‘crnd::uint32’ {aka ‘unsigned int’} loses precision [-fpermissive]
2369 | CRND_ASSERT(((uint32)p_new & (CRND_MIN_ALLOC_ALIGNMENT - 1)) == 0);
| ^~~~~
crunch/crn_decomp.h:468:13: note: in definition of macro ‘CRND_ASSERT’
468 | (void)((!!(_exp)) || (crnd::crnd_assert(#_exp, __FILE__, __LINE__), 0))
| ^~~~
error: command 'x86_64-pc-linux-gnu-g++' failed with exit status 1
sembiance@lostcrag ~/tmp/decrunch $ x86_64-pc-linux-gnu-g++ --version
x86_64-pc-linux-gnu-g++ (Gentoo 9.1.0-r1 p1.1) 9.1.0
sembiance@lostcrag ~/tmp/decrunch $ python --version
Python 3.6.8
It builds if I change the (uint32) cast to (long) (a temporary, unadvised cheat I learned from http://stackoverflow.com/questions/1640423/error-cast-from-void-to-int-loses-precision#1640448)
Note: Using Python 3.4 doesn't fix this error.