Stream: brlcad

Topic: Mac compilation woes


view this post on Zulip Sean (Sep 02 2021 at 02:46):

@starseeker Could use some help... still facing Mac compile problems. I think bundled is working better now, but default build is now caught up on an error I can't seem to find a good workaround for.

view this post on Zulip Sean (Sep 02 2021 at 02:49):

When it builds itk3, it ends up finding tk.h inside the MacOSX11.3 sdk, which is of course version-incompatible:

(base) morrison@agua ITK_BLD-build % make VERBOSE=1
/Users/morrison/Applications/bin/cmake -S/Users/morrison/brlcad.main/src/other/ext/itk3 -B/Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build --check-build-system CMakeFiles/Makefile.cmake 0
/Users/morrison/Applications/bin/cmake -E cmake_progress_start /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build/CMakeFiles /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/itkstub.dir/build.make CMakeFiles/itkstub.dir/depend
cd /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build && /Users/morrison/Applications/bin/cmake -E cmake_depends "Unix Makefiles" /Users/morrison/brlcad.main/src/other/ext/itk3 /Users/morrison/brlcad.main/src/other/ext/itk3 /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build/CMakeFiles/itkstub.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/itkstub.dir/build.make CMakeFiles/itkstub.dir/build
make[2]: Nothing to be done for `CMakeFiles/itkstub.dir/build'.
[ 22%] Built target itkstub
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/itk3.4.dir/build.make CMakeFiles/itk3.4.dir/depend
cd /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build && /Users/morrison/Applications/bin/cmake -E cmake_depends "Unix Makefiles" /Users/morrison/brlcad.main/src/other/ext/itk3 /Users/morrison/brlcad.main/src/other/ext/itk3 /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build/CMakeFiles/itk3.4.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/itk3.4.dir/build.make CMakeFiles/itk3.4.dir/build
[ 33%] Building C object CMakeFiles/itk3.4.dir/generic/itkStubInit.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DBUILD_itk -DHAVE_DLFCN_H=1 -DHAVE_ERRNO_H=1 -DHAVE_FLOAT_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STDINT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRINGS_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DTCL_THREADS=1 -DUSE_ITCL_STUBS -DUSE_TCL_STUBS -DUSE_TK_STUBS -Ditk3_4_EXPORTS -I/Users/morrison/brlcad.main/.build/include -I/Users/morrison/brlcad.main/src/other/ext/itk3/generic -I/Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build/include -I/usr/local/include -I/usr/X11R6/include -I/Users/morrison/brlcad.main/src/other/ext/itk3/../tcl/generic -I/Users/morrison/brlcad.main/src/other/ext/itk3/../tcl/unix -I/Users/morrison/brlcad.main/src/other/ext/itk3/../itcl3/generic  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -fPIC   -o CMakeFiles/itk3.4.dir/generic/itkStubInit.c.o   -c /Users/morrison/brlcad.main/src/other/ext/itk3/generic/itkStubInit.c
In file included from /Users/morrison/brlcad.main/src/other/ext/itk3/generic/itkStubInit.c:12:
In file included from /Users/morrison/brlcad.main/src/other/ext/itk3/generic/itk.h:78:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/tk.h:31:3: error: Tk 8.5 must be compiled with tcl.h from Tcl 8.5
#       error Tk 8.5 must be compiled with tcl.h from Tcl 8.5
        ^

view this post on Zulip Sean (Sep 02 2021 at 02:51):

since it's using the Xcode toolchain's cc, it needs a MacOSX sdk or it cannot even find things like stdio.h

view this post on Zulip starseeker (Sep 02 2021 at 02:54):

Can you cd into the build directory for itk and get a VERBOSE=1 build output? (nevermind, I see it now...)

view this post on Zulip starseeker (Sep 02 2021 at 02:56):

If you're not doing a bundled build, it's going to try the system Tcl/Tk (which I wouldn't expect to work...) I'm surprise that header is failing if it's using both system tcl and tk though.

view this post on Zulip starseeker (Sep 02 2021 at 02:57):

OK, it's including the bundled Tcl directories, and it shouldn't be. Let's see...

view this post on Zulip starseeker (Sep 02 2021 at 02:59):

Can you post the CMakeCache.txt file for the itk subbuild?

view this post on Zulip starseeker (Sep 02 2021 at 03:00):

OH!

view this post on Zulip starseeker (Sep 02 2021 at 03:01):

I'll bet it's the itk/CMakeLists.txt logic around line 179

view this post on Zulip starseeker (Sep 02 2021 at 03:02):

We're deliberately pointing at our local dirs because Itk has historically been bad about sticking to just the public Tcl APIs. It didn't matter when our bundled and system versions matched, but we've got Tcl/Tk 8.6 in the tree now and your system version must be 8.5?

view this post on Zulip starseeker (Sep 02 2021 at 03:04):

So first thing to try is just eliminating the whole tcl-private block and see if it Just Works. If the Itk3 sources still won't build without the private headers, if we want to try and work with the bundled OSX version we'll have to detect the system version and include the correct version specific dir with the private headers needed for that version.

view this post on Zulip Sean (Sep 02 2021 at 04:02):

Checking ...

view this post on Zulip Sean (Sep 02 2021 at 04:19):

Oof, I do not understand why this is so consistently inconsistent. Just to make sure I'm starting fresh before editing that itk/CmakeLists.txt file, I blew away build/CMake* build/src build/include, re-ran cmake (all good), ran make, and now I get a completely different error about not finding common.h

view this post on Zulip Sean (Sep 02 2021 at 04:38):

(in itk3 still on the stub lib)

(base) morrison@agua ITK_BLD-build % make VERBOSE=1
/Users/morrison/Applications/bin/cmake -S/Users/morrison/brlcad.main/src/other/ext/itk3 -B/Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build --check-build-system CMakeFiles/Makefile.cmake 0
/Users/morrison/Applications/bin/cmake -E cmake_progress_start /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build/CMakeFiles /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/itkstub.dir/build.make CMakeFiles/itkstub.dir/depend
cd /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build && /Users/morrison/Applications/bin/cmake -E cmake_depends "Unix Makefiles" /Users/morrison/brlcad.main/src/other/ext/itk3 /Users/morrison/brlcad.main/src/other/ext/itk3 /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build /Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build/CMakeFiles/itkstub.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/itkstub.dir/build.make CMakeFiles/itkstub.dir/build
[ 11%] Building C object CMakeFiles/itkstub.dir/generic/itkStubLib.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DBUILD_itk -DHAVE_DLFCN_H=1 -DHAVE_ERRNO_H=1 -DHAVE_FLOAT_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STDINT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRINGS_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DTCL_THREADS=1 -DUSE_ITCL_STUBS -DUSE_TCL_STUBS -DUSE_TK_STUBS -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Tcl.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Tk.framework/Headers -I/Users/morrison/Applications/include -I/Users/morrison/brlcad.main/src/other/ext/itk3/generic -I/Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build/include -I/usr/local/include -I/usr/X11R6/include -I/Users/morrison/brlcad.main/src/other/ext/itk3/../tcl/generic -I/Users/morrison/brlcad.main/src/other/ext/itk3/../tcl/unix -I/Users/morrison/brlcad.main/src/other/ext/itk3/../itcl3/generic  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk   -o CMakeFiles/itkstub.dir/generic/itkStubLib.c.o   -c /Users/morrison/brlcad.main/src/other/ext/itk3/generic/itkStubLib.c
In file included from /Users/morrison/brlcad.main/src/other/ext/itk3/generic/itkStubLib.c:31:
In file included from /Users/morrison/brlcad.main/src/other/ext/itk3/generic/itk.h:79:
/Users/morrison/Applications/include/itclInt.h:58:10: fatal error: 'common.h' file not found
#include "common.h"
         ^~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/itkstub.dir/generic/itkStubLib.c.o] Error 1
make[1]: *** [CMakeFiles/itkstub.dir/all] Error 2
make: *** [all] Error 2

view this post on Zulip Sean (Sep 02 2021 at 04:45):

If I manually add src/include to the compile line, it seems to choke on our bundled tclInt.h:

(base) morrison@agua ITK_BLD-build % /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DBUILD_itk -DHAVE_DLFCN_H=1 -DHAVE_ERRNO_H=1 -DHAVE_FLOAT_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STDINT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRINGS_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DTCL_THREADS=1 -DUSE_ITCL_STUBS -DUSE_TCL_STUBS -DUSE_TK_STUBS -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Tcl.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Tk.framework/Headers -I/Users/morrison/Applications/include -I/Users/morrison/brlcad.main/src/other/ext/itk3/generic -I/Users/morrison/brlcad.main/.build/src/other/ext/ITK_BLD-prefix/src/ITK_BLD-build/include -I/usr/local/include -I/usr/X11R6/include -I/Users/morrison/brlcad.main/src/other/ext/itk3/../tcl/generic -I/Users/morrison/brlcad.main/src/other/ext/itk3/../tcl/unix -I/Users/morrison/brlcad.main/src/other/ext/itk3/../itcl3/generic  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -I/Users/morrison/brlcad.main/include  -o CMakeFiles/itkstub.dir/generic/itkStubLib.c.o   -c /Users/morrison/brlcad.main/src/other/ext/itk3/generic/itkStubLib.c
...
In file included from /Users/morrison/brlcad.main/src/other/ext/itk3/generic/itkStubLib.c:31:
In file included from /Users/morrison/brlcad.main/src/other/ext/itk3/generic/itk.h:79:
In file included from /Users/morrison/Applications/include/itclInt.h:60:
/Users/morrison/brlcad.main/src/other/ext/itk3/../tcl/generic/tclInt.h:2765:14: error: unknown type name 'Tcl_NRPostProc'; did you mean 'Tcl_CloseProc'?
MODULE_SCOPE Tcl_NRPostProc TclNRForIterCallback;
             ^~~~~~~~~~~~~~
             Tcl_CloseProc
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Tcl.framework/Headers/tcl.h:652:15: note: 'Tcl_CloseProc' declared here
typedef void (Tcl_CloseProc) _ANSI_ARGS_((ClientData data));
              ^

view this post on Zulip Sean (Sep 02 2021 at 04:47):

that of course appears to be directly related to the line 179 section

view this post on Zulip Sean (Sep 02 2021 at 06:00):

Tried deleting the section and it still gives an error not finding common.h

If I add the include dir in src/other/ext/itk/CMakeLists.txt, it gets past the common.h error but then fails to find tclInt.h

Looks like we thus need system tcl to be 8.6+... how is that best enforced?

view this post on Zulip Sean (Sep 02 2021 at 06:14):

looks like common.h failure is coming from a previous installation as it's in the same folder as cmake, so that's just a distraction/red herring. not sure why it was looking in there, but I removed the old headers so now it's just back to the tclInt.h incompatibility.

view this post on Zulip Sean (Sep 02 2021 at 06:36):

might be able to trick it with a few typedefs as there's only a few things in tclInt.h causing a problem

view this post on Zulip Sean (Sep 02 2021 at 06:40):

wow, that worked...

view this post on Zulip Sean (Sep 02 2021 at 06:41):

will see if this compile succeeds later today, but it compiled itk using two simple additions to tclInt.h that let it work against the 8.5 system headers

view this post on Zulip Sean (Sep 02 2021 at 13:35):

OMG this is a mess... SO good news is I got a system Tcl/Tk build to compile! But funny story, Apple deprecated Tk in 10.15, so it spews warnings that have to be suppressed.

view this post on Zulip Sean (Sep 02 2021 at 13:38):

Tcl isn't deprecated, so looks like they came to a similar conclusion about Tk. Tcl/Tk is maintained and up-to-date in brew so that would probably be the only remaining thing to check for system/auto builds. I think we just need to add a cmake test that detects the deprecation and turns off system Tk, so it doesn't go down the rabbit hole I just crawled out of.


Last updated: Oct 09 2024 at 00:44 UTC