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

thd_incorrelate and OMP #278

Closed
leej3 opened this issue Jun 12, 2021 · 4 comments
Closed

thd_incorrelate and OMP #278

leej3 opened this issue Jun 12, 2021 · 4 comments

Comments

@leej3
Copy link
Collaborator

leej3 commented Jun 12, 2021

I am getting an error when compiling thd_incorrelate.c in the cmake build on MacOS.

FAILED: src/CMakeFiles/thd_objs.dir/thd_incorrelate.c.o
/Library/Developer/CommandLineTools/usr/bin/cc -DDYNAMIC_suffix=\".dylib\" -DREPLACE_XT -I../src/3DEdge/src -I../src/niml -I_deps/nifti_clib-build/nifti2 -I_deps/nifti_clib-src/nifti2 -I_deps/nifti_clib-build/znzlib -I_deps/nifti_clib-src/znzlib -I_deps/nifti_clib-build/nifticdf -I_deps/nifti_clib-src/nifticdf -I_deps/nifti_clib-build/niftilib -I_deps/nifti_clib-src/niftilib -I../src/f2c -Isrc -I../src -I../src/rickr -DUSE_TRACING -DHAVE_ZLIB -DREAD_WRITE_64 -DLINUX -DDARWIN -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -mmacosx-version-min=11.2 -fPIC -MD -MT src/CMakeFiles/thd_objs.dir/thd_incorrelate.c.o -MF src/CMakeFiles/thd_objs.dir/thd_incorrelate.c.o.d -o src/CMakeFiles/thd_objs.dir/thd_incorrelate.c.o -c ../src/thd_incorrelate.c
../src/thd_incorrelate.c:948:15: error: implicit declaration of function 'omp_get_thread_num' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
       ithr = omp_get_thread_num() ;
              ^
../src/thd_incorrelate.c:988:15: error: implicit declaration of function 'omp_get_thread_num' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
       ithr = omp_get_thread_num() ;
              ^
2 errors generated.

I can't remember too well but I don't think I ever managed to compile libmri openmp... without USE_OMP defined for it any instances of OpenMP code are appropriately removed by the C preprocessor... it seems this is not the case for thd_correlate.c

I don't know whether the intention is to support openmp for this file. The quick fix is to wrap the omp lines appropriately so that they are not compiled. The more thorough fix of supporting compilation of libmri in the cmake build is likely not feasible. Perhaps an intermediate solution would be to use openmp for thd_incorrelate.c... I don't have a sense of how entangled it is with other files grouped using the thd_objs cmake target.

@leej3
Copy link
Collaborator Author

leej3 commented Jun 26, 2021

Re: "Additionally suma is no longer compiling on MacOS... that error looks more extensive." Does this refer to a CircleCi build error for Mac OS?

If that is the case, I think that is resolved---there was two issues that I could tell, each just involving a tweak of "#include .." statements: in one case, for SUMA_input.c, an "#include .." pointed to a package that was just on a local machine (but we that dependency wasn't necessary, so could be fixed just by commenting that line); in another case, for 3dNwarpCalc.c, the recent addition of an if-condition required putting two simple "#include .."s in one branch of the condition.

@leej3 , could you please verify if these have resolved the issue(s) you were referring to?

I'm still getting this. For the thd_incorrelate.c error I think the ifdef logic just needs to be tidied a little to work when USE_OMP is not set as a compile definition.

Here is a full list of failures in case it is helpful, this is emitted by requesting that the build system continue with up to 100 errors (ninja -k 100):

[0/477] cd /Users/leej3/john_code/afni/src/python_scripts && bash /Users/emilylanghorn...e/make_sure_afnipy_is_installed.sh /Users/leej3/miniconda3/envs/afni_dev/bin/python3.9
[2/477] Building C object src/CMakeFiles/testcox.dir/testcox.c.o
FAILED: src/CMakeFiles/testcox.dir/testcox.c.o
/Library/Developer/CommandLineTools/usr/bin/gcc -DDYNAMIC_suffix=\".dylib\" -DREPLACE_XT -I../src/NIFTI::nifti2 -I../src/3DEdge/src -I../src/niml -I_deps/nifti_clib-build/nifti2 -I_deps/nifti_clib-src/nifti2 -I_deps/nifti_clib-build/znzlib -I_deps/nifti_clib-src/znzlib -I_deps/nifti_clib-build/nifticdf -I_deps/nifti_clib-src/nifticdf -I_deps/nifti_clib-build/niftilib -I_deps/nifti_clib-src/niftilib -I../src/f2c -Isrc -I../src -I../src/rickr -DUSE_TRACING -DHAVE_ZLIB -DREAD_WRITE_64 -DLINUX -DDARWIN -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -mmacosx-version-min=11.2 -fPIE -MD -MT src/CMakeFiles/testcox.dir/testcox.c.o -MF src/CMakeFiles/testcox.dir/testcox.c.o.d -o src/CMakeFiles/testcox.dir/testcox.c.o -c ../src/testcox.c
../src/testcox.c:27:4: error: implicit declaration of function 'enable_mcw_malloc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
   enable_mcw_malloc() ;
   ^
1 error generated.
[3/477] Building C object src/CMakeFiles/mrix.dir/suma_help.c.o
FAILED: src/CMakeFiles/mrix.dir/suma_help.c.o
/Library/Developer/CommandLineTools/usr/bin/gcc -DDYNAMIC_suffix=\".dylib\" -DREPLACE_XT -Dmrix_EXPORTS -I../src/3DEdge/src -I../src/niml -I_deps/nifti_clib-build/nifti2 -I_deps/nifti_clib-src/nifti2 -I_deps/nifti_clib-build/znzlib -I_deps/nifti_clib-src/znzlib -I_deps/nifti_clib-build/nifticdf -I_deps/nifti_clib-src/nifticdf -I_deps/nifti_clib-build/niftilib -I_deps/nifti_clib-src/niftilib -I../src/f2c -Isrc -I../src -I../src/rickr -I../src/coxplot -I../src/XmHTML/include/common -I../src/XmHTML/include/http -I../src/XmHTML/include/XmHTML -I../src/XmHTML/include -I../src/XmHTML/lib/common -isystem /usr/local/include -DUSE_TRACING -DHAVE_ZLIB -DREAD_WRITE_64 -DLINUX -DDARWIN -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -mmacosx-version-min=11.2 -fPIC -MD -MT src/CMakeFiles/mrix.dir/suma_help.c.o -MF src/CMakeFiles/mrix.dir/suma_help.c.o.d -o src/CMakeFiles/mrix.dir/suma_help.c.o -c ../src/suma_help.c
../src/suma_help.c:341:22: warning: address of array 'gwh->hint' will always evaluate to 'true' [-Wpointer-bool-conversion]
            if (gwh->hint) {
            ~~  ~~~~~^~~~
../src/suma_help.c:720:22: error: implicit declaration of function 'XtName' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
   if (!gwhc && (s = XtName(w))) { /* Try matching the hint to the widget name,
                     ^
../src/suma_help.c:720:20: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
   if (!gwhc && (s = XtName(w))) { /* Try matching the hint to the widget name,
                   ^ ~~~~~~~~~
../src/suma_help.c:727:20: warning: address of array 'gwhc->hint' will always evaluate to 'true' [-Wpointer-bool-conversion]
         if (gwhc->hint && !strcmp(s, gwhc->hint)) {
             ~~~~~~^~~~ ~~
3 warnings and 1 error generated.
[4/477] Building C object src/CMakeFiles/thd_objs.dir/thd_incorrelate.c.o
FAILED: src/CMakeFiles/thd_objs.dir/thd_incorrelate.c.o
/Library/Developer/CommandLineTools/usr/bin/gcc -DDYNAMIC_suffix=\".dylib\" -DREPLACE_XT -I../src/3DEdge/src -I../src/niml -I_deps/nifti_clib-build/nifti2 -I_deps/nifti_clib-src/nifti2 -I_deps/nifti_clib-build/znzlib -I_deps/nifti_clib-src/znzlib -I_deps/nifti_clib-build/nifticdf -I_deps/nifti_clib-src/nifticdf -I_deps/nifti_clib-build/niftilib -I_deps/nifti_clib-src/niftilib -I../src/f2c -Isrc -I../src -I../src/rickr -DUSE_TRACING -DHAVE_ZLIB -DREAD_WRITE_64 -DLINUX -DDARWIN -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -mmacosx-version-min=11.2 -fPIC -MD -MT src/CMakeFiles/thd_objs.dir/thd_incorrelate.c.o -MF src/CMakeFiles/thd_objs.dir/thd_incorrelate.c.o.d -o src/CMakeFiles/thd_objs.dir/thd_incorrelate.c.o -c ../src/thd_incorrelate.c
../src/thd_incorrelate.c:948:15: error: implicit declaration of function 'omp_get_thread_num' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
       ithr = omp_get_thread_num() ;
              ^
../src/thd_incorrelate.c:988:15: error: implicit declaration of function 'omp_get_thread_num' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
       ithr = omp_get_thread_num() ;
              ^
2 errors generated.
[5/477] Building C object src/SUMA/CMakeFiles/SUMA.dir/SUMA_display.c.o
FAILED: src/SUMA/CMakeFiles/SUMA.dir/SUMA_display.c.o
/Library/Developer/CommandLineTools/usr/bin/gcc -DDYNAMIC_suffix=\".dylib\" -DREPLACE_XT -DSUMA_COMPILED -DSUMA_EXPORTS -I../src/SUMA/PLY -I../src/SUMA -I../src/SUMA/GLw_local -I../src/ptaylor -I../src/3DEdge/src -I../src/niml -I_deps/nifti_clib-build/nifti2 -I_deps/nifti_clib-src/nifti2 -I_deps/nifti_clib-build/znzlib -I_deps/nifti_clib-src/znzlib -I_deps/nifti_clib-build/nifticdf -I_deps/nifti_clib-src/nifticdf -I_deps/nifti_clib-build/niftilib -I_deps/nifti_clib-src/niftilib -I../src/f2c -Isrc -I../src -I../src/rickr -I../src/coxplot -I../src/avovk -isystem /usr/local/Cellar/gsl/2.7/include -isystem /usr/X11R6/include -isystem /usr/local/include -DUSE_TRACING -DHAVE_ZLIB -DREAD_WRITE_64 -DLINUX -DDARWIN -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -mmacosx-version-min=11.2 -fPIC -MD -MT src/SUMA/CMakeFiles/SUMA.dir/SUMA_display.c.o -MF src/SUMA/CMakeFiles/SUMA.dir/SUMA_display.c.o.d -o src/SUMA/CMakeFiles/SUMA.dir/SUMA_display.c.o -c ../src/SUMA/SUMA_display.c
../src/SUMA/SUMA_display.c:2238:10: error: implicit declaration of function 'glCheckFramebufferStatus' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
   fbs = glCheckFramebufferStatus(GL_FRAMEBUFFER);
         ^
../src/SUMA/SUMA_display.c:2238:10: note: did you mean 'DUMMY_glCheckFramebufferStatus'?
../src/SUMA/SUMA_display.c:1894:8: note: 'DUMMY_glCheckFramebufferStatus' declared here
GLenum DUMMY_glCheckFramebufferStatus(GLenum dumdum) {
       ^
../src/SUMA/SUMA_display.c:14445:8: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
   if (!DrawnROI->DrawStatus == SUMA_ROI_Finished) {
       ^                     ~~
../src/SUMA/SUMA_display.c:14445:8: note: add parentheses after the '!' to evaluate the comparison first
   if (!DrawnROI->DrawStatus == SUMA_ROI_Finished) {
       ^
        (                                        )
../src/SUMA/SUMA_display.c:14445:8: note: add parentheses around left hand side expression to silence this warning
   if (!DrawnROI->DrawStatus == SUMA_ROI_Finished) {
       ^
       (                    )
1 warning and 1 error generated.
ninja: build stopped: cannot make progress due to previous errors.
All cmake variables (`cmake -LA`) ?

BUILD_SHARED_LIBS:BOOL=ON
BUILD_TESTING:BOOL=ON
CMAKE_ADDR2LINE:FILEPATH=CMAKE_ADDR2LINE-NOTFOUND
CMAKE_AR:FILEPATH=/Library/Developer/CommandLineTools/usr/bin/ar
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_CXX_COMPILER:FILEPATH=/Library/Developer/CommandLineTools/usr/bin/g++
CMAKE_CXX_FLAGS:STRING=
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
CMAKE_C_COMPILER:FILEPATH=/Library/Developer/CommandLineTools/usr/bin/gcc
CMAKE_C_FLAGS:STRING=
CMAKE_C_FLAGS_DEBUG:STRING=-g
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND
CMAKE_EXE_LINKER_FLAGS:STRING=
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=
CMAKE_INSTALL_BINDIR:PATH=bin
CMAKE_INSTALL_DATADIR:PATH=
CMAKE_INSTALL_DATAROOTDIR:PATH=share
CMAKE_INSTALL_DOCDIR:PATH=
CMAKE_INSTALL_INCLUDEDIR:PATH=include
CMAKE_INSTALL_INFODIR:PATH=
CMAKE_INSTALL_LIBDIR:PATH=lib
CMAKE_INSTALL_LIBEXECDIR:PATH=libexec
CMAKE_INSTALL_LOCALEDIR:PATH=
CMAKE_INSTALL_LOCALSTATEDIR:PATH=var
CMAKE_INSTALL_MANDIR:PATH=
CMAKE_INSTALL_NAME_TOOL:FILEPATH=/usr/bin/install_name_tool
CMAKE_INSTALL_OLDINCLUDEDIR:PATH=/usr/include
CMAKE_INSTALL_PREFIX:PATH=/usr/local
CMAKE_INSTALL_RUNSTATEDIR:PATH=
CMAKE_INSTALL_SBINDIR:PATH=sbin
CMAKE_INSTALL_SHAREDSTATEDIR:PATH=com
CMAKE_INSTALL_SYSCONFDIR:PATH=etc
CMAKE_LINKER:FILEPATH=/Library/Developer/CommandLineTools/usr/bin/ld
CMAKE_MAKE_PROGRAM:FILEPATH=/Users/leej3/miniconda3/envs/afni_dev/bin/ninja
CMAKE_MODULE_LINKER_FLAGS:STRING=
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_NM:FILEPATH=/Library/Developer/CommandLineTools/usr/bin/nm
CMAKE_OBJCOPY:FILEPATH=CMAKE_OBJCOPY-NOTFOUND
CMAKE_OBJDUMP:FILEPATH=/Library/Developer/CommandLineTools/usr/bin/objdump
CMAKE_OSX_ARCHITECTURES:STRING=
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=11.2
CMAKE_OSX_SYSROOT:PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk
CMAKE_RANLIB:FILEPATH=/Library/Developer/CommandLineTools/usr/bin/ranlib
CMAKE_READELF:FILEPATH=CMAKE_READELF-NOTFOUND
CMAKE_SHARED_LINKER_FLAGS:STRING=
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
CMAKE_SKIP_RPATH:BOOL=NO
CMAKE_STATIC_LINKER_FLAGS:STRING=
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_STRIP:FILEPATH=/Library/Developer/CommandLineTools/usr/bin/strip
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
CMAKE_VER_AT_LEAST_3_13:BOOL=1
COMP_ALL_PLUGINS:BOOL=ON
COMP_ATLASES:BOOL=OFF
COMP_COREBINARIES:BOOL=ON
COMP_CORELIBS_ONLY:BOOL=OFF
COMP_DOCS:BOOL=ON
COMP_FUNSTUFF:BOOL=ON
COMP_GUI:BOOL=ON
COMP_MINI_MRI:BOOL=OFF
COMP_PLUGINS:BOOL=ON
COMP_PYTHON:BOOL=ON
COMP_RSTATS:BOOL=OFF
COMP_SUMA:BOOL=ON
COMP_TCSH:BOOL=ON
COVERAGE_COMMAND:FILEPATH=/usr/bin/gcov
COVERAGE_EXTRA_FLAGS:STRING=-l
CTEST_SUBMIT_RETRY_COUNT:STRING=3
CTEST_SUBMIT_RETRY_DELAY:STRING=5
DART_TESTING_TIMEOUT:STRING=1500
ENABLE_TESTS:BOOL=OFF
EXPAT_INCLUDE_DIR:PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include
EXPAT_LIBRARY:FILEPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libexpat.tbd
FETCHCONTENT_BASE_DIR:PATH=/Users/leej3/john_code/afni/build/_deps
FETCHCONTENT_FULLY_DISCONNECTED:BOOL=OFF
FETCHCONTENT_QUIET:BOOL=ON
FETCHCONTENT_SOURCE_DIR_GIFTI_CLIB:PATH=
FETCHCONTENT_SOURCE_DIR_GTS:PATH=
FETCHCONTENT_SOURCE_DIR_NIFTI_CLIB:PATH=
FETCHCONTENT_UPDATES_DISCONNECTED:BOOL=OFF
FETCHCONTENT_UPDATES_DISCONNECTED_GIFTI_CLIB:BOOL=OFF
FETCHCONTENT_UPDATES_DISCONNECTED_GTS:BOOL=OFF
FETCHCONTENT_UPDATES_DISCONNECTED_NIFTI_CLIB:BOOL=OFF
FREETYPE_INCLUDE_DIR_freetype2:PATH=/usr/local/include/freetype2
FREETYPE_INCLUDE_DIR_ft2build:PATH=/usr/local/include/freetype2
FREETYPE_LIBRARY_DEBUG:FILEPATH=FREETYPE_LIBRARY_DEBUG-NOTFOUND
FREETYPE_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libfreetype.dylib
Fontconfig_INCLUDE_DIR:PATH=/usr/local/Cellar/fontconfig/2.13.1/include
Fontconfig_LIBRARY:FILEPATH=/usr/local/lib/libfontconfig.dylib
GENERATE_PACKAGING_COMPONENTS:BOOL=OFF
GIFTI_USE_PACKAGING:BOOL=OFF
GITCOMMAND:FILEPATH=/Users/leej3/miniconda3/envs/afni_dev/bin/git
GIT_EXECUTABLE:FILEPATH=/Users/leej3/miniconda3/envs/afni_dev/bin/git
GLIB2_GLIBCONFIG_INCLUDE_DIR:PATH=/usr/local/lib/glib-2.0/include
GLIB2_GLIB_INCLUDE_DIR:PATH=/usr/local/include/glib-2.0
GLIB2_GLIB_LIBRARY:FILEPATH=/usr/local/lib/libglib-2.0.dylib
GSL_CBLAS_LIBRARY:FILEPATH=/usr/local/Cellar/gsl/2.7/lib/libgslcblas.dylib
GSL_CBLAS_LIBRARY_DEBUG:FILEPATH=/usr/local/Cellar/gsl/2.7/lib/libgslcblas.dylib
GSL_INCLUDE_DIR:PATH=/usr/local/Cellar/gsl/2.7/include
GSL_LIBRARY:FILEPATH=/usr/local/Cellar/gsl/2.7/lib/libgsl.dylib
GSL_LIBRARY_DEBUG:FILEPATH=/usr/local/Cellar/gsl/2.7/lib/libgsl.dylib
GSL_ROOT_DIR:STRING=/usr/local/Cellar/gsl/2.7
JPEG_INCLUDE_DIR:PATH=/usr/local/include
JPEG_LIBRARY_DEBUG:FILEPATH=JPEG_LIBRARY_DEBUG-NOTFOUND
JPEG_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libjpeg.dylib
MAKECOMMAND:STRING=/Users/leej3/miniconda3/envs/afni_dev/bin/cmake --build . --config "${CTEST_CONFIGURATION_TYPE}"
MEMORYCHECK_COMMAND:FILEPATH=MEMORYCHECK_COMMAND-NOTFOUND
MEMORYCHECK_SUPPRESSIONS_FILE:FILEPATH=
MOTIF_INCLUDE_DIR:PATH=/usr/local/include
MOTIF_LIBRARIES:FILEPATH=/usr/local/lib/libXm.dylib
NIFTI_BUILD_APPLICATIONS:BOOL=ON
NIFTI_PACKAGE_PREFIX:STRING=
NIFTI_SYSTEM_MATH_LIB:FILEPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libm.tbd
NIFTI_USE_PACKAGING:BOOL=OFF
OpenMP_CXX_FLAGS:STRING=-Xclang -fopenmp
OpenMP_CXX_INCLUDE_DIR:PATH=/usr/local/include
OpenMP_CXX_LIB_NAMES:STRING=libomp
OpenMP_C_FLAGS:STRING=-Xclang -fopenmp
OpenMP_C_INCLUDE_DIR:PATH=/usr/local/include
OpenMP_C_LIB_NAMES:STRING=libomp
OpenMP_libomp_LIBRARY:FILEPATH=/usr/local/lib/libomp.dylib
PKG_CONFIG_EXECUTABLE:FILEPATH=/usr/local/bin/pkg-config
REMOVE_BUILD_PARITY_CHECKS:BOOL=OFF
RUN_PLUGIN_CHECK:BOOL=OFF
SITE:STRING=Emilys-MacBook-Air-3.local
TEST_INSTALL:BOOL=ON
USE_CIFTI_CODE:BOOL=OFF
USE_CPACK:BOOL=OFF
USE_FSL_CODE:BOOL=OFF
USE_JASPER:BOOL=OFF
USE_JPEGLS:BOOL=OFF
USE_NIFTI2_CODE:BOOL=ON
USE_NIFTICDF_CODE:BOOL=ON
USE_OMP:BOOL=OFF
USE_OPENJPEG:BOOL=OFF
USE_STATIC_RUNTIME:BOOL=ON
USE_TURBOJPEG:BOOL=OFF
X11_ICE_INCLUDE_PATH:PATH=/usr/local/include
X11_ICE_LIB:FILEPATH=/usr/local/lib/libICE.dylib
X11_SM_INCLUDE_PATH:PATH=/usr/local/include
X11_SM_LIB:FILEPATH=/usr/local/lib/libSM.dylib
X11_X11_INCLUDE_PATH:PATH=/usr/local/include
X11_X11_LIB:FILEPATH=/usr/local/lib/libX11.dylib
X11_X11_xcb_INCLUDE_PATH:PATH=/usr/local/include
X11_X11_xcb_LIB:FILEPATH=/usr/local/lib/libX11-xcb.dylib
X11_XRes_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_XRes_LIB:FILEPATH=/usr/X11R6/lib/libXRes.dylib
X11_XShm_INCLUDE_PATH:PATH=/usr/local/include
X11_XSync_INCLUDE_PATH:PATH=/usr/local/include
X11_Xaccessrules_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xaccessstr_INCLUDE_PATH:PATH=/usr/local/include
X11_Xau_INCLUDE_PATH:PATH=/usr/local/include
X11_Xau_LIB:FILEPATH=/usr/local/lib/libXau.dylib
X11_Xaw_INCLUDE_PATH:PATH=X11_Xaw_INCLUDE_PATH-NOTFOUND
X11_Xaw_LIB:FILEPATH=/usr/X11R6/lib/libXaw.dylib
X11_Xcomposite_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xcomposite_LIB:FILEPATH=/usr/X11R6/lib/libXcomposite.dylib
X11_Xcursor_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xcursor_LIB:FILEPATH=/usr/X11R6/lib/libXcursor.dylib
X11_Xdamage_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xdamage_LIB:FILEPATH=/usr/X11R6/lib/libXdamage.dylib
X11_Xdmcp_INCLUDE_PATH:PATH=/usr/local/include
X11_Xdmcp_LIB:FILEPATH=/usr/local/lib/libXdmcp.dylib
X11_Xext_INCLUDE_PATH:PATH=/usr/local/include
X11_Xext_LIB:FILEPATH=/usr/local/lib/libXext.dylib
X11_Xfixes_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xfixes_LIB:FILEPATH=/usr/X11R6/lib/libXfixes.dylib
X11_Xft_INCLUDE_PATH:PATH=/usr/local/include
X11_Xft_LIB:FILEPATH=/usr/local/lib/libXft.dylib
X11_Xi_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xi_LIB:FILEPATH=/usr/X11R6/lib/libXi.dylib
X11_Xinerama_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xinerama_LIB:FILEPATH=/usr/X11R6/lib/libXinerama.dylib
X11_Xkb_INCLUDE_PATH:PATH=/usr/local/include
X11_Xkblib_INCLUDE_PATH:PATH=/usr/local/include
X11_Xlib_INCLUDE_PATH:PATH=/usr/local/include
X11_Xmu_INCLUDE_PATH:PATH=/usr/local/include
X11_Xmu_LIB:FILEPATH=/usr/local/lib/libXmu.dylib
X11_Xpm_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xpm_LIB:FILEPATH=/usr/X11R6/lib/libXpm.dylib
X11_Xrandr_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xrandr_LIB:FILEPATH=/usr/X11R6/lib/libXrandr.dylib
X11_Xrender_INCLUDE_PATH:PATH=/usr/local/include
X11_Xrender_LIB:FILEPATH=/usr/local/lib/libXrender.dylib
X11_Xshape_INCLUDE_PATH:PATH=/usr/local/include
X11_Xss_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xss_LIB:FILEPATH=/usr/X11R6/lib/libXss.dylib
X11_Xt_INCLUDE_PATH:PATH=/usr/local/include
X11_Xt_LIB:FILEPATH=/usr/local/lib/libXt.dylib
X11_Xtst_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xtst_LIB:FILEPATH=/usr/X11R6/lib/libXtst.dylib
X11_Xutil_INCLUDE_PATH:PATH=/usr/local/include
X11_Xv_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xv_LIB:FILEPATH=/usr/X11R6/lib/libXv.dylib
X11_Xxf86misc_INCLUDE_PATH:PATH=X11_Xxf86misc_INCLUDE_PATH-NOTFOUND
X11_Xxf86misc_LIB:FILEPATH=X11_Xxf86misc_LIB-NOTFOUND
X11_Xxf86vm_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_Xxf86vm_LIB:FILEPATH=/usr/X11R6/lib/libXxf86vm.dylib
X11_dpms_INCLUDE_PATH:PATH=/usr/local/include
X11_xcb_INCLUDE_PATH:PATH=/usr/local/include
X11_xcb_LIB:FILEPATH=/usr/local/lib/libxcb.dylib
X11_xcb_icccm_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_xcb_icccm_LIB:FILEPATH=/usr/X11R6/lib/libxcb-icccm.dylib
X11_xcb_util_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_xcb_util_LIB:FILEPATH=/usr/X11R6/lib/libxcb-util.dylib
X11_xcb_xfixes_INCLUDE_PATH:PATH=/usr/local/include
X11_xcb_xfixes_LIB:FILEPATH=/usr/local/lib/libxcb-xfixes.dylib
X11_xcb_xkb_LIB:FILEPATH=/usr/local/lib/libxcb-xkb.dylib
X11_xkbcommon_INCLUDE_PATH:PATH=X11_xkbcommon_INCLUDE_PATH-NOTFOUND
X11_xkbcommon_LIB:FILEPATH=X11_xkbcommon_LIB-NOTFOUND
X11_xkbcommon_X11_INCLUDE_PATH:PATH=X11_xkbcommon_X11_INCLUDE_PATH-NOTFOUND
X11_xkbcommon_X11_LIB:FILEPATH=X11_xkbcommon_X11_LIB-NOTFOUND
X11_xkbfile_INCLUDE_PATH:PATH=/usr/X11R6/include
X11_xkbfile_LIB:FILEPATH=/usr/X11R6/lib/libxkbfile.dylib
XQuartzGL_INCLUDE_DIR:PATH=/usr/X11R6/include
XQuartzGL_gl_LIBRARY:FILEPATH=/usr/X11R6/lib/libGL.dylib
XQuartzGL_glu_LIBRARY:FILEPATH=/usr/X11R6/lib/libGLU.dylib
XQuartzGL_glut_LIBRARY:FILEPATH=/usr/X11R6/lib/libglut.dylib
ZLIB_IMPLEMENTATION:STRING=Miniz
ZLIB_INCLUDE_DIR:PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include
ZLIB_LIBRARY_DEBUG:FILEPATH=ZLIB_LIBRARY_DEBUG-NOTFOUND
ZLIB_LIBRARY_RELEASE:FILEPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libz.tbd
pkgcfg_lib_GSL_gsl:FILEPATH=/usr/local/Cellar/gsl/2.7/lib/libgsl.dylib
pkgcfg_lib_GSL_gslcblas:FILEPATH=/usr/local/Cellar/gsl/2.7/lib/libgslcblas.dylib
pkgcfg_lib_GSL_m:FILEPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libm.tbd
pkgcfg_lib_PC_EXPAT_expat:FILEPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libexpat.tbd
pkgcfg_lib_PKG_FONTCONFIG_fontconfig:FILEPATH=/usr/local/Cellar/fontconfig/2.13.1/lib/libfontconfig.dylib
pkgcfg_lib_PKG_FONTCONFIG_freetype:FILEPATH=/usr/local/opt/freetype/lib/libfreetype.dylib

@mrneont
Copy link
Contributor

mrneont commented Jun 26, 2021

Thanks for the error message output; it didn't show up compiling on my Ubuntu or Mac, making it hard to investigate.

Re. thd_incorrelate.c: indeed, I think that is the issue, and @afni-rwcox is looking at it.

I briefly looked at the enable_mcw_malloc(). I suspect there is something not matching with environment variables, as there are a lot of "ifdef"s and "defined(...)"s around.

I guess in general the Cmake as "USE_OMP" set to 0? Maybe that is why I don't see many of these things (USE_OMP is also in an if-condition around enable_mcw_malloc()). Also, is there a list of environment variables that Cmake uses (like, its ~/.afnirc)? I probably missed it, but looked in the afni/cmake tree and didn't see something that had that.

@leej3
Copy link
Collaborator Author

leej3 commented Jun 26, 2021

I briefly looked at the enable_mcw_malloc(). I suspect there is something not matching with environment variables, as there are a lot of "ifdef"s and "defined(...)"s around.

I don't think environment variables are involved here.

There's cmake variables:

  • many of these are defined in this file
  • these can be view by running cmake with -LA (or -LH to not be quite so verbose)
  • You can also view how these are set during cmake configure time by using ccmake a ncurses interface to cmake. I believe there is a cmake GUI out there too if that would be of any use
  • You can overwrite defaults of these variables by passing -D<VARIABLE_NAME>=ON to cmake e.g. cmake -DCOMP_SUMA=ON

There's targets:

  • These are largely created by the cmake configuration with cmake functions like add_executable, add_library. I have wrapped these with add_afni_executable etc for the purposes of consolidating build behavior across all binaries
  • Some targets are imported from 3rd party software. These are populated by "find modules" (see here in the docs). These find modules are either provided by the upstream software (or should be), are baked into cmake itself (these sometimes change over time and can result in irritating breakages across a range of cmake/dependency versions), or are specified by us... sometime to avoid aforementioned risk of breakage or that it simply isn't implemented anywhere else (see files starting with "Find" in the cmake modules directory)
  • Linking against targets populated by such modules allows the cmake build system to inherit all details about the targets from the 3rd party packages... versions, supported functionality, appropriate link options/compile definitions for downstream software
  • OMP has such a find module that is used here and populates the target OpenMP::OpenMP_C (and among other things defines a value for the cmake variable OpenMP_FOUND

There's compile definitions:

  • As described here, this work with the preprocessor to determine what code is actually compiled into the binary. I know you know this... just adding this here for completeness
  • CMake handles compile definitions by associating them with targets (or at least this is how it should be done). So for example, many of the binaries need REPLACE_XT defined to compile as we want them to (see implementation of this in cmake)

So given all that... in cmake what should be happening is the following:

  • Targets should link against openmp unless openmp was not found or the user has explicitly set the cmake variable USE_OMP to off.
  • If openmp is found, targets should set the compile definition USE_OMP (as implemented here)
  • Ideally all source files should compile appropriately regardless of whether USE_OMP is set as a compile definition

I will open a PR that makes the cmake system more strictly align to the above ideal.

leej3 added a commit that referenced this issue Jun 26, 2021
addresses issues raised in #278

Now if USE_OMP is set by the user to OFF, an attempt at finding openmp is not done. In general
if OpenMP::OpenMP_C is not a defined target then afni targets do not link against omp or
define USE_OMP as a compile definition. Any deviation is a problem with the targets and should
be fixed. An example of a succesful implementation is:
https://github.com/afni/afni/blob/7bc375964a0a54323447842d6564a536e045476e/src/CMakeLists_binaries.txt#L250-L263
leej3 added a commit that referenced this issue Jun 26, 2021
addresses issues raised in #278

Now if USE_OMP is set by the user to OFF, an attempt at finding openmp is not done. In general
if OpenMP::OpenMP_C is not a defined target then afni targets do not link against omp or
define USE_OMP as a compile definition. Any deviation is a problem with the targets and should
be fixed. An example of a succesful implementation is:
https://github.com/afni/afni/blob/7bc375964a0a54323447842d6564a536e045476e/src/CMakeLists_binaries.txt#L250-L263
@mrneont
Copy link
Contributor

mrneont commented Dec 23, 2021

This issue has been addressed.

This file thd_incorrelate.c should not be compiled on its own as a standalone.

Compiling with or without openMP works now.

Bob's fix for this:
ea65404
Rick's fix for this:
428167f

My fix for this:
[emailing other people!]

@mrneont mrneont closed this as completed Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants