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

Error in building pupil_detectors setup.py #1331

Closed
behrooza opened this issue Oct 16, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@behrooza
Copy link

commented Oct 16, 2018

I got the following error while I was trying to build setup.py in "pupil/pupil_src/shared_modules/pupil_detectors" :
cl : Command line warning D9025 : overriding '/W3' with '/w'
cl : Command line warning D9002 : ignoring unknown option '-std=c++17'
detector_2d.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\type_traits(1271): error C2338: You've instantiated std::aligned_storage<Len, Align> with an extended alignment (in other words, Align > alignof(max_align_t)). Before VS 2017 15.8, the member type would non-conformingly have an alignment of only alignof(max_align_t). VS 2017 15.8 was fixed to handle this correctly, but the fix inherently changes layout and breaks binary compatibility (only for uses of aligned_storage with extended alignments). Please define either (1) _ENABLE_EXTENDED_ALIGNED_STORAGE to acknowledge that you understand this message and that you actually want a type with an extended alignment, or (2) _DISABLE_EXTENDED_ALIGNED_STORAGE to silence this message and get the old non-conformant behavior.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\type_traits(1291): note: see reference to class template instantiation 'std::_Aligned<144,16,double,false>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\type_traits(1298): note: see reference to class template instantiation 'std::_Aligned<144,16,int,false>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\type_traits(1305): note: see reference to class template instantiation 'std::_Aligned<144,16,short,false>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\type_traits(1312): note: see reference to class template instantiation 'std::_Aligned<144,16,char,false>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\type_traits(1320): note: see reference to class template instantiation 'std::aligned_storage<144,16>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\type_traits(1352): note: see reference to alias template instantiation 'aligned_storage_t<144,16>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\type_traits(1357): note: see reference to class template instantiation 'std::aligned_union<1,_Ty>' being compiled
with
[
_Ty=singleeyefitter::Detector2DResult
]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\memory(1820): note: see reference to alias template instantiation 'aligned_union_t<1,singleeyefitter::Detector2DResult>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\memory(1866): note: see reference to class template instantiation 'std::_Ref_count_obj<_Ty>' being compiled
with
[
_Ty=singleeyefitter::Detector2DResult
]
c:\work\pupil\pupil_src\shared_modules\pupil_detectors\detect_2d.hpp(76): note: see reference to function template instantiation 'std::shared_ptrsingleeyefitter::Detector2DResult std::make_sharedsingleeyefitter::Detector2DResult,(void)' being compiled
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe' failed with exit status 2

it seems that I have to define _ENABLE_EXTENDED_ALIGNED_STORAGE somewhere but I dont know where!!
I am using python 3.6.6 and Visual Studio 2017 15.8!
I was wondering whether anybody could run pupil lab from source on Windows!! :-?

Thanks for your kind help :)

@stevcode

This comment has been minimized.

Copy link

commented Oct 16, 2018

I too ran across this issue and have "fixed" it. The issue does stem from the recent Visual Studio 2017 v15.8 update. There are 3 files the following line of code needs to be added to:

#define _ENABLE_EXTENDED_ALIGNED_STORAGE

The 3 files are:

/pupil_src/shared_modules/pupil_detectors/detector_2d.cpp
/pupil_src/shared_modules/pupil_detectors/detector_3d.cpp
/pupil_src/shared_modules/pupil_detectors/singleeyefitter/EyeModelFitter.cpp

Adding to EyeModelFitter.cpp is easy, just adding it to the top of the file.

The other 2 files do not exist in source code though. They are auto-generated by:

/pupil_src/shared_modules/pupil_detectors/detector_2d.pyx
/pupil_src/shared_modules/pupil_detectors/detector_3d.pyx

These 2 Cython files auto-generate their respective .cpp files, but when other files try to utilize detector_2d.cpp or detector_3d.cpp, they run into this issue. You can just add the #define code to the top of those 2 files and the build process will work as intended. However, the two .cpp aren't part of the source code, so if you re-download from source, or try to do a clean build, you have to manually go in and edit the .cpp files again.

The fix for this issue is to modify the Cython code in detector_2d.pyx and detector_3d.pyx so that their auto-generated .cpp files include the line #define _ENABLE_EXTENDED_ALIGNED_STORAGE. I just haven't been able to figure out how to do this, due to my unfamiliarity with Cython.

@behrooza

This comment has been minimized.

Copy link
Author

commented Oct 17, 2018

Thank you so much! It is working now.

I think some lines of code should be added to check the MSVC version and then define _ENABLE_EXTENDED_ALIGNED_STORAGE based on the MSVC version!!

@behrooza behrooza closed this Oct 17, 2018

cboulay added a commit to cboulay/pupil that referenced this issue Apr 27, 2019

cboulay added a commit to cboulay/pupil that referenced this issue Apr 29, 2019

divyamsaran added a commit to divyamsaran/pupil-docs that referenced this issue Jun 14, 2019

Update windows.md: build setup.py
Recent VS 2017 update (15.8 and 15.8) throw an error to define _ENABLE_EXTENDED_ALIGNED_STORAGE in three files. While 2 of these are generated by Cython and a permanent fix would be to update those scripts, a possible workaround is to manually add these tags to the 3 files. Source: pupil-labs/pupil#1331 (comment)
Also updated the actual source for pupil_detectors\setup.py

pfaion added a commit to pfaion/pupil that referenced this issue Jul 17, 2019

Exclude temp fix for EXTENDED_ALIGNED_STORAGE
This was just added to make the code compile with the newest Visual Studio v15.9.
See issue pupil-labs#1331 for more information.
This should not get handled with this PR as we need to adress this separately in multiple places in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.