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

i386 build of Alizams fails due to GCC_USE_ASM_64IMPL set in itkMathDetail.h #3771

Closed
yurivict opened this issue Nov 27, 2022 · 10 comments · Fixed by #3774
Closed

i386 build of Alizams fails due to GCC_USE_ASM_64IMPL set in itkMathDetail.h #3771

yurivict opened this issue Nov 27, 2022 · 10 comments · Fixed by #3774
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Comments

@yurivict
Copy link

Description

Alizams fails with this error:

/usr/bin/c++ -DFORCE_PLATFORM_XCB -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_SQL_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DTMP_USE_53_SPATIAL_ENUMS -DUSE_WORKSTATION_MODE -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/b -I/usr/local/include/vxl/core -I/usr/local/include/vxl/vcl -I/usr/local/include/vxl/v3p/netlib -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/mdcm/Utilities/mdcmuuid -I/wrkdirs/usr/ports/graphics/alizams/work/.build/mdcm/Utilities/mdcmuuid -I/wrkdirs/usr/ports/graphics/alizams/work/.build/mdcm/Utilities/mdcmzlib -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/mdcm/Utilities/mdcmzlib -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/mdcm/Utilities/mdcmopenjpeg/src/lib/openjp2 -I/wrkdirs/usr/ports/graphics/alizams/work/.build/mdcm/Utilities/mdcmopenjpeg/src/lib/openjp2 -I/wrkdirs/usr/ports/graphics/alizams/work/.build/mdcm/Utilities/mdcmopenjpeg -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/mdcm/Utilities/mdcmcharls -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/mdcm/Source/Common -I/wrkdirs/usr/ports/graphics/alizams/work/.build/mdcm/Source/Common -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/mdcm/Source/DataDictionary -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/mdcm/Source/DataStructureAndEncodingDefinition -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/mdcm/Source/MediaStorageAndFileFormat -I/wrkdirs/usr/ports/graphics/alizams/work/.build/mdcm/Utilities -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/mdcm/Utilities -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/common -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/GUI -I/wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/dicom -I/wrkdirs/usr/ports/graphics/alizams/work/.build -isystem /usr/local/include/ITK-5.3 -isystem /usr/local/include/eigen3 -isystem /usr/local/include/qt5 -isystem /usr/local/include/qt5/QtCore -isystem /usr/local/lib/qt5/mkspecs/freebsd-clang -isystem /usr/local/include/qt5/QtGui -isystem /usr/local/include -isystem /usr/local/include/qt5/QtWidgets -isystem /usr/local/include/qt5/QtPrintSupport -isystem /usr/local/include/qt5/QtSvg -isystem /usr/local/include/qt5/QtSql -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -msse2  -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -msse2 -DNDEBUG -fPIC -std=c++14 -MD -MT CMakeFiles/alizams.dir/common/structures.cpp.o -MF CMakeFiles/alizams.dir/common/structures.cpp.o.d -o CMakeFiles/alizams.dir/common/structures.cpp.o -c /wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/common/structures.cpp
In file included from /wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/common/structures.cpp:1:
In file included from /wrkdirs/usr/ports/graphics/alizams/work/AlizaMS-1.8.3-34-ge36859b/common/structures.h:8:
In file included from /usr/local/include/ITK-5.3/itkImage.h:21:
In file included from /usr/local/include/ITK-5.3/itkImageRegion.h:34:
In file included from /usr/local/include/ITK-5.3/itkContinuousIndex.h:21:
In file included from /usr/local/include/ITK-5.3/itkPoint.h:23:
In file included from /usr/local/include/ITK-5.3/itkVector.h:351:
In file included from /usr/local/include/ITK-5.3/itkVector.hxx:21:
In file included from /usr/local/include/ITK-5.3/itkMath.h:32:
/usr/local/include/ITK-5.3/itkMathDetail.h:317:10: error: use of undeclared identifier '_mm_cvtsd_si64'
  return _mm_cvtsd_si64(_mm_set_sd(x));
         ^
/usr/local/include/ITK-5.3/itkMathDetail.h:326:10: error: use of undeclared identifier '_mm_cvtss_si64'; did you mean '_mm_cvtss_si32'?
  return _mm_cvtss_si64(_mm_set_ss(x));
         ^
/usr/lib/clang/14.0.5/include/xmmintrin.h:1306:1: note: '_mm_cvtss_si32' declared here
_mm_cvtss_si32(__m128 __a)
^
2 errors generated.

Versions

InsightToolkit-5.3.r04
Alizams-1.8.3-34-ge36859b
clang-14
FreeBSD 13.1

@yurivict yurivict added the type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances label Nov 27, 2022
@issakomi
Copy link
Member

issakomi commented Nov 28, 2022

I could reproduce the problem on Debian 11 32-bit x86 clean VMware install.
Minimal example:

CMakeLists.txt:

cmake_minimum_required(VERSION 3.11)
project(TEST)
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} " -msse2")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -msse2")
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
add_executable(test test.cpp)
target_link_libraries(test ${ITK_LIBRARIES})

test.cpp:

#include "itkImage.h"
int main(int, char**)
{
	return 0;
}

If -msse2 compiler option is set for 32-bit x86 than __SSE2__ is defined, but SSE2 64-bit stuff is not available on 32-bit x86 of course, s. itkConfigure.in.h:

#if defined(__SSE2__) || defined(__x86_64__) || defined(_M_X64) || defined(__amd64)
#  define ITK_COMPILER_SUPPORTS_SSE2_64
#endif

In the past i didn't have the problem with 32-bit x86 build with -msse2, BTW.

I am not sure that i want to do a PR myself now, it is easy, but may have side effects somewhere else in ITK, who knows, i don't have time for that in the near future.

@yurivict for AlizaMS you can set ALIZA_DISABLE_SIMDMATH cmake option, it will prevent -msse2 option for 32-bit x86 AlizaMS build. Use -DALIZA_DISABLE_SIMDMATH:BOOL=OFF or s. in cmake-gui.

@yurivict
Copy link
Author

@issakomi I added -DALIZA_DISABLE_SIMDMATH:BOOL=OFF on i386, thanks.

@issakomi
Copy link
Member

I did draft PR nonetheless.

@issakomi
Copy link
Member

@yurivict

I added -DALIZA_DISABLE_SIMDMATH:BOOL=OFF on i386, thanks.

I am sorry, it should be -DALIZA_DISABLE_SIMDMATH:BOOL=ON, but you have probably got it already.

@yurivict
Copy link
Author

Yes, got it, thanks.

@issakomi
Copy link
Member

issakomi commented Nov 28, 2022

I have tried current master with default configuration and tests on Debian 11 32-bit x86. The results are not so good, 20 tests failed

The following tests FAILED:
	 41 - vnl_test_math (Failed)
	539 - itkSobelOperatorImageConvolutionHorizTest (Failed)
	540 - itkSobelOperatorImageFilterHorizTest (Failed)
	541 - itkSobelOperatorImageConvolutionVertTest (Failed)
	542 - itkSobelOperatorImageFilterVertTest (Failed)
	669 - itkImageFillBufferTest4.1 (SEGFAULT)
	790 - itkPatchBasedDenoisingImageFilterTestTensors (Failed)
	1256 - itkLargeMetaImageWriteReadTest2 (Failed)
	1257 - itkLargeMetaImageWriteReadTest3 (Failed)
	1280 - itkNiftiReadWriteDirectionTest (Failed)
	1284 - itkNiftiLargeImageRegionReadTest (Failed)
	1398 - itkLargeTIFFImageWriteReadTest2 (Failed)
	1399 - itkLargeTIFFImageWriteReadTest3 (Failed)
	1497 - itkUnsharpMaskImageFilterTest_DefaultsUChar (Failed)
	1836 - LabelOverlapMeasuresImageFilterFixture.test0 (Failed)
	2122 - itkFlatStructuringElementTest2 (Failed)
	2258 - itkEuclideanDistancePointSetMetricTest3 (Failed)
	2274 - itkMattesMutualInformationImageToImageMetricv4Test (Failed)
	2748 - itkSLICImageFilterTest1 (Failed)
	2847 - itkRigid3DPerspectiveTransformTest (Failed)

The types on 32-bit x86 Linux look like:

size of void*       = 4
size of char*       = 4
size of char        = 1
size of wchar_t     = 4
size of bool        = 1
size of short       = 2
size of int         = 4
size of long        = 4
size of long long   = 8
size of size_t      = 4
size of uintptr_t   = 4
size of float       = 4
size of double      = 8
size of long double = 12

Not sure that 32-bit x86 is still supported by ITK. AFAIK Fedora dropped 32-bit x86 (but there is still 32-bit armhfp), Debian still releases 32-bit x86. Better avoid, IMHO.

@dzenanz
Copy link
Member

dzenanz commented Nov 28, 2022

Didn't Linux Kernel drop support for i386 in 2012 (ref. 1 2) in version 3.8? There is even talk of dropping support for i486.

@issakomi
Copy link
Member

issakomi commented Nov 28, 2022

Yes, AFAIK, probably better say 32-bit x86, corrected
Linux deb 5.10.0-19-686-pae #1 SMP Debian 5.10.149-2 (2022-10-21) i686 GNU/Linux

@issakomi
Copy link
Member

Debian is also not precise
deb32

@dzenanz
Copy link
Member

dzenanz commented Nov 28, 2022

32-bit x86 is the widely used term. I think that technical name is IA32 (Intel Architecture, 32-bit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants