typed_python icon indicating copy to clipboard operation
typed_python copied to clipboard

setup.py compile error

Open punkdit opened this issue 4 years ago • 3 comments

This is with python3.9 and llvm-10.1:

gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D_FORTIFY_SOURCE=2 -I/usr/local/include/python3.9 -I/usr/local/lib/python3.9/site-packages/numpy/core/include -c typed_python/all.cpp -o build/temp.linux-x86_64-3.9/typed_python/all.o -O2 -fstack-protector-strong -Wformat -Wdate-time -Werror=format-security -std=c++14 -Wno-sign-compare -Wno-narrowing -Wno-sign-compare -Wno-terminate -Wno-reorder -Wno-bool-compare -Wno-cpp In file included from typed_python/Type.hpp:36:0, from typed_python/AllTypes.hpp:22, from typed_python/_types.cpp:28, from typed_python/all.cpp:26: typed_python/ShaHash.hpp: In function ‘ShaHash operator+(const ShaHash&, const ShaHash&)’: typed_python/ShaHash.hpp:185:23: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((ShaHash*)data)[0] = l; ^ typed_python/ShaHash.hpp:185:25: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((ShaHash*)data)[0] = l; ^ In file included from typed_python/all.cpp:31:0: typed_python/PyInstance.cpp: In lambda function: typed_python/PyInstance.cpp:1014:9: error: could not convert ‘{{{1, 0l}, 0}, "typed_python._types.Type", sizeof (PyInstance), 0, PyInstance::tp_dealloc, 0, 0, 0, 0, PyInstance::tp_repr, 0, 0, 0, PyInstance::tp_hash, PyInstance::tp_call, PyInstance::tp_str, 0, 0, 0, 263168ul, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}’ from ‘’ to ‘PyTypeObject {aka _typeobject}’ }; ^ typed_python/PyInstance.cpp: In static member function ‘static PyTypeObject* PyInstance::typeCategoryBaseType(Type::TypeCategory)’: typed_python/PyInstance.cpp:1097:9: error: could not convert ‘{{{{1, 0l}, 0}, (std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator, (operator new(32ul), (, ((std::__cxx11::string*)))))->std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str<char, std::char_traits, std::allocator >(), sizeof (PyInstance), 0, PyInstance::tp_dealloc, 0, 0, 0, 0, PyInstance::tp_repr, 0, 0, 0, PyInstance::tp_hash, PyInstance::tp_call, PyInstance::tp_str, 0, 0, 0, 263168ul, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, PyInstance::allTypesBaseType(), classDict, 0, 0, 0, 0, 0, PyInstance::tp_new_type, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, category}’ from ‘’ to ‘NativeTypeCategoryWrapper’ }; ^ typed_python/PyInstance.cpp: In static member function ‘static PyTypeObject* PyInstance::typeObjInternal(Type*)’: typed_python/PyInstance.cpp:1218:5: error: could not convert ‘{{{{1, 0l}, 0}, ((* & inType->Type::name(0)), (operator new(32ul), (, ((std::__cxx11::string*)))))->std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str<char, std::char_traits, std::allocator >(), sizeof (PyInstance), 0, PyInstance::tp_dealloc, 0, 0, 0, 0, PyInstance::tp_repr, PyInstance::numberMethods(inType), PyInstance::sequenceMethodsFor(inType), PyInstance::mappingMethods(inType), PyInstance::tp_hash, PyInstance::tp_call, PyInstance::tp_str, PyInstance::tp_getattro, PyInstance::tp_setattro, PyInstance::bufferProcs(), (PyInstance::typeCanBeSubclassed(inType) ? 263168ul : 262144ul), inType->Type::doc(), 0, 0, PyInstance::tp_richcompare, 0, (((((unsigned int)cat + 4294967275u <= 1u || cat == (Type::TypeCategory)33u) || (cat == (Type::TypeCategory)24u || cat == (Type::TypeCategory)28u)) || (cat == (Type::TypeCategory)17u)) ? PyInstance::tp_iter : 0u), PyInstance::tp_iternext, PyInstance::typeMethods(inType), 0, 0, 0, PyDict_New(), ((inType->Type::getTypeCategory() == (Type::TypeCategory)30u) ? PyInstance::tp_descr_get : 0u), 0, 0, 0, 0, PyInstance::tp_new, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, inType}’ from ‘’ to ‘NativeTypeWrapper’ }; ^ In file included from typed_python/all.cpp:60:0: typed_python/StringType.cpp: In static member function ‘static StringType::layout* StringType::singleFromCodepoint(int64_t)’: typed_python/StringType.cpp:964:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint16_t*)new_layout->data)[0] = codePoint; ^ typed_python/StringType.cpp:967:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint32_t*)new_layout->data)[0] = codePoint; ^ typed_python/StringType.cpp: In static member function ‘static uint32_t StringType::getord(StringType::layout*)’: typed_python/StringType.cpp:987:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] return ((uint16_t*)lhs->data)[0]; ^ typed_python/StringType.cpp:990:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] return ((uint32_t*)lhs->data)[0]; ^ typed_python/StringType.cpp: In static member function ‘static StringType::layout* StringType::getitem(StringType::layout*, int64_t)’: typed_python/StringType.cpp:1023:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint16_t*)new_layout->data)[0] = ((uint16_t*)lhs->data)[offset]; ^ typed_python/StringType.cpp:1026:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint32_t*)new_layout->data)[0] = ((uint32_t*)lhs->data)[offset]; ^ At global scope: cc1plus: warning: unrecognized command line option ‘-Wno-terminate’ error: command '/usr/bin/gcc' failed with exit code 1

punkdit avatar Feb 25 '21 12:02 punkdit

Hmm... I haven't tried to compile this for 3.9. Last time I tried, llvmlite didn't work on it.

For the compile error you're getting: Probably the PyObject layout has changed slightly in 3.9. You can see on PyInstance.cpp:1041 that we are matching the fieldname change from 3.7 to 3.8 of tp_print -> tp_vectorcall_offset, so it's probably something similar.

I can try to look at this later, or you can give fixing it a shot. There may be other minor incompatibility issues with 3.9 (for instance, if anything changed in the AST syntax, we'll need to mirror that as well).

On Thu, Feb 25, 2021 at 7:22 AM Simon Burton [email protected] wrote:

This is with python3.9 and llvm-10.1:

gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -D_FORTIFY_SOURCE=2 -I/usr/local/include/python3.9 -I/usr/local/lib/python3.9/site-packages/numpy/core/include -c typed_python/all.cpp -o build/temp.linux-x86_64-3.9/typed_python/all.o -O2 -fstack-protector-strong -Wformat -Wdate-time -Werror=format-security -std=c++14 -Wno-sign-compare -Wno-narrowing -Wno-sign-compare -Wno-terminate -Wno-reorder -Wno-bool-compare -Wno-cpp In file included from typed_python/Type.hpp:36:0, from typed_python/AllTypes.hpp:22, from typed_python/_types.cpp:28, from typed_python/all.cpp:26: typed_python/ShaHash.hpp: In function ‘ShaHash operator+(const ShaHash&, const ShaHash&)’: typed_python/ShaHash.hpp:185:23: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((ShaHash*)data)[0] = l; ^ typed_python/ShaHash.hpp:185:25: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((ShaHash*)data)[0] = l; ^ In file included from typed_python/all.cpp:31:0: typed_python/PyInstance.cpp: In lambda function: typed_python/PyInstance.cpp:1014:9: error: could not convert ‘{{{1, 0l}, 0}, "typed_python._types.Type", sizeof (PyInstance), 0, PyInstance::tp_dealloc, 0, 0, 0, 0, PyInstance::tp_repr, 0, 0, 0, PyInstance::tp_hash, PyInstance::tp_call, PyInstance::tp_str, 0, 0, 0, 263168ul, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}’ from ‘’ to ‘PyTypeObject {aka _typeobject}’ }; ^ typed_python/PyInstance.cpp: In static member function ‘static PyTypeObject* PyInstance::typeCategoryBaseType(Type::TypeCategory)’: typed_python/PyInstance.cpp:1097:9: error: could not convert ‘{{{{1, 0l}, 0}, (std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator, (operator new(32ul), (, ((std::__cxx11::string*)))))->std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str<char, std::char_traits, std::allocator >(), sizeof (PyInstance), 0, PyInstance::tp_dealloc, 0, 0, 0, 0, PyInstance::tp_repr, 0, 0, 0, PyInstance::tp_hash, PyInstance::tp_call, PyInstance::tp_str, 0, 0, 0, 263168ul, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, PyInstance::allTypesBaseType(), classDict, 0, 0, 0, 0, 0, PyInstance::tp_new_type, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, category}’ from ‘’ to ‘NativeTypeCategoryWrapper’ }; ^ typed_python/PyInstance.cpp: In static member function ‘static PyTypeObject* PyInstance::typeObjInternal(Type*)’: typed_python/PyInstance.cpp:1218:5: error: could not convert ‘{{{{1, 0l}, 0}, ((* & inType->Type::name(0)), (operator new(32ul), (, ((std::__cxx11::string*)))))->std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str<char, std::char_traits, std::allocator >(), sizeof (PyInstance), 0, PyInstance::tp_dealloc, 0, 0, 0, 0, PyInstance::tp_repr, PyInstance::numberMethods(inType), PyInstance::sequenceMethodsFor(inType), PyInstance::mappingMethods(inType), PyInstance::tp_hash, PyInstance::tp_call, PyInstance::tp_str, PyInstance::tp_getattro, PyInstance::tp_setattro, PyInstance::bufferProcs(), (PyInstance::typeCanBeSubclassed(inType) ? 263168ul : 262144ul), inType->Type::doc(), 0, 0, PyInstance::tp_richcompare, 0, (((((unsigned int)cat + 4294967275u <= 1u || cat == (Type::TypeCategory)33u) || (cat == (Type::TypeCategory)24u || cat == (Type::TypeCategory)28u)) || (cat == (Type::TypeCategory)17u)) ? PyInstance::tp_iter : 0u), PyInstance::tp_iternext, PyInstance::typeMethods(inType), 0, 0, 0, PyDict_New(), ((inType->Type::getTypeCategory() == (Type::TypeCategory)30u) ? PyInstance::tp_descr_get : 0u), 0, 0, 0, 0, PyInstance::tp_new, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, inType}’ from ‘’ to ‘NativeTypeWrapper’ }; ^ In file included from typed_python/all.cpp:60:0: typed_python/StringType.cpp: In static member function ‘static StringType::layout* StringType::singleFromCodepoint(int64_t)’: typed_python/StringType.cpp:964:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint16_t*)new_layout->data)[0] = codePoint; ^ typed_python/StringType.cpp:967:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint32_t*)new_layout->data)[0] = codePoint; ^ typed_python/StringType.cpp: In static member function ‘static uint32_t StringType::getord(StringType::layout*)’: typed_python/StringType.cpp:987:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] return ((uint16_t*)lhs->data)[0]; ^ typed_python/StringType.cpp:990:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] return ((uint32_t*)lhs->data)[0]; ^ typed_python/StringType.cpp: In static member function ‘static StringType::layout* StringType::getitem(StringType::layout*, int64_t)’: typed_python/StringType.cpp:1023:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint16_t*)new_layout->data)[0] = ((uint16_t*)lhs->data)[offset]; ^ typed_python/StringType.cpp:1026:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint32_t*)new_layout->data)[0] = ((uint32_t*)lhs->data)[offset]; ^ At global scope: cc1plus: warning: unrecognized command line option ‘-Wno-terminate’ error: command '/usr/bin/gcc' failed with exit code 1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/APrioriInvestments/typed_python/issues/384, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6OHBGPDT3E7ACGPIEPIDTTAY6H7ANCNFSM4YGM5PSA .

braxtonmckee avatar Feb 25 '21 14:02 braxtonmckee

What is the recommended python version to use?

punkdit avatar Feb 25 '21 14:02 punkdit

The CI runs tests on 3.6 - 3.8 on linux and macOS.

On Thu, Feb 25, 2021 at 9:45 AM Simon Burton [email protected] wrote:

What is the recommended python version to use?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/APrioriInvestments/typed_python/issues/384#issuecomment-785947016, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6OHBA4HG455XTSP4SCFYLTAZPBRANCNFSM4YGM5PSA .

braxtonmckee avatar Feb 25 '21 14:02 braxtonmckee