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 with Superbuild #146

Closed
iMichka opened this issue Apr 5, 2017 · 21 comments
Closed

Error with Superbuild #146

iMichka opened this issue Apr 5, 2017 · 21 comments

Comments

@iMichka
Copy link

iMichka commented Apr 5, 2017

Hi. I just wanted to test last simpleITK, because the new release is coming soon. Had no time to look into this earlier, so sorry if I am a little bit late.

When building master with homebrew, I get the following error

-- Configuring done
CMake Error in Code/Explicit/src/CMakeLists.txt:
Target "SimpleITKExplicit" INTERFACE_INCLUDE_DIRECTORIES property contains
path:
"/tmp/simpleitk-20170405-63774-kll36r/sitk-build/ITK-prefix/include/ITK-4.11"
which is prefixed in the source directory.
-- Generating done

This seems to be OK outside of homebrew. Maybe the error will give a hint of the problem.

@blowekamp
Copy link
Member

blowekamp commented Apr 5, 2017

Thank you for reporting this issue. What version of CMake are you using?

There is a CMake option to disable the explicit library. That can be used as a work around until the condition to produce this error are established and then a resolution found.

@iMichka
Copy link
Author

iMichka commented Apr 6, 2017

I'm using 3.7.2. I will try to debug this today.

@blowekamp blowekamp modified the milestones: v1.1, v1.0-release Apr 6, 2017
@blowekamp
Copy link
Member

blowekamp commented Apr 6, 2017

Looking at this closer this morning I am confused by the error message.

"/tmp/simpleitk-20170405-63774-kll36r/sitk-build/ITK-prefix/include/ITK-4.11"
which is prefixed in the source directory.

The "site-build/ITK-prefix" is the ITK Superbuild install directory not a source directory.

I could see this error message occurring if the ITK_DIR was set to the ITK build directory, and not the install directory.

Can you share your configuration file you used?

@iMichka
Copy link
Author

iMichka commented Apr 6, 2017

I'm annoyed now because I can't reproduce this anymore. I played a little bit around, and it went away when I built from a tag instead of master. I may have had a stale build dir somewhere.

This may explain it; the error happened during the build with homebrew, but not when I was building manually outside of the homebrew context. It is still not really clear what happened but it seems to be building.

As soon as the new release is on sourceforge, I'll update the homebrew formula.
Sorry for the wrong error report.

@blowekamp
Copy link
Member

Thank you for trying out SimpleITK, and maintaining Homebrew recipes, and showing me a CMake error I have never seen before too.

@iMichka
Copy link
Author

iMichka commented Apr 6, 2017

Spoke too fast ... the error pops up when simpleitk is being built. I thought it happened earlier in the process, so I did not see it at first.

Here is a full build log: https://gist.github.com/iMichka/4ba263d73e0c03c99f98e0f43623bd8e

And two CMakeCache files:
CMakeCache-Main.txt
CMakeCache-SimpleITK.txt

@iMichka iMichka reopened this Apr 6, 2017
@blowekamp
Copy link
Member

From my quick look at this I am suspicious of this option: 'CMAKE_INSTALL_PREFIX'. I'll investigate tomorrow.

@blowekamp blowekamp removed the Invalid label Apr 7, 2017
@blowekamp blowekamp self-assigned this Apr 7, 2017
@blowekamp
Copy link
Member

If you set the option: SimpleITK_EXPLICIT_INSTANTIATION:BOOL=OFF does it build successfully.

This is just a work around for 1.0.0, you're build should still work.

@iMichka
Copy link
Author

iMichka commented Apr 10, 2017

SimpleITK_EXPLICIT_INSTANTIATION:BOOL=OFF works.

I also rebuilt 0.10.0, which works. I was thinking of some other bug, but that seems not to be the case. I will try a bisect, there are "only" 8 steps ...

@blowekamp
Copy link
Member

blowekamp commented Apr 14, 2017

I have not been able to reproduce this error. On a Linux RH7 system I updated cmake to 3.7.2 and did the following configuration: cmake -DBUILD_EXAMPLES:BOOL=OFF -G Ninja -DCMAKE_INSTALL_PREFIX=/tmp/sitk -DWRAP_DEFAULT=OFF ~/src/SimpleITK/SuperBuild/

I did find an issue with the SimpleITKExamples super build, but not this issue.

@blowekamp
Copy link
Member

I have also installed CMake 3.7.2 on OS X with Xcode 8.2.1 to try to reproduce the problem. Using the same configuration line: cmake -DBUILD_EXAMPLES:BOOL=OFF -G Ninja -DCMAKE_INSTALL_PREFIX=/tmp/sitk -DWRAP_DEFAULT=OFF ~/src/SimpleITK/SuperBuild/ I am still not able to reproduce the problem.

@blowekamp
Copy link
Member

I just received this error message with an anaconda build. The build directory was a sub-directory of the source tree.

For the home-brew configuration is the "build" directory inside the "source" dir?

@iMichka
Copy link
Author

iMichka commented Apr 18, 2017

Yes it is. Did not think about that point. I'll have to retest this week, I was away for a few days.
A workaround would then to build somewhere else; but not sure homebrew allows this, there may be some sandbox keeping the build in a single folder + subfolders.

@blowekamp
Copy link
Member

I have posted a pull request which may address the issue, but there is a logical problem with your build configuration.

SimpleITK depends on ITK libraries ( and ITK CMake configuration files ). Your build is specifying "-DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/simpleitk/HEAD-2eac932" for the installation path. The SimpleITK Superbuild's "install" only installs SimpleITK and does not install ITK ( or compiled build tools such as lua and SWIG ).

So your CMake configuration indicates that you will install SimpleITK with its required dependency being in the temporary "build" directory. The resulting installation will not work.

What are you trying to do by installing SimpleITK libraries?

The other question is what should SimpleITK do with it's ITK dependency in the Superbuild? Should the SimpleITK Explicit library include interface be made public, or kept private in the build?

@iMichka
Copy link
Author

iMichka commented Apr 20, 2017

Hi. Thanks for the pull request. I can confirm that the patch fixes the problem for the homebrew build.

The install path is in fact CMAKE_INSTALL_PREFIX=/usr/local/Cellar/simpleitk/1.0.0, I gave you the output for a HEAD build, but in principle this just a small difference in the naming of the folder.

The ITK build (and the whole build folder) is removed at the end of the build. We deliver ITK as a standalone installation in a different formula, so unrelated to simpleitk.
Here is the full list of files that will be installed: https://gist.github.com/iMichka/036355540ebe5897b784d5149e340953

After that installation step, we use: SimpleITK-build/Wrapping/Python/Packaging/setupegg.py install --prefix=/usr/local/Cellar/simpleitk/1.0.0 to install the files for Python.

But maybe this is overkill. I guess that for Python, almost only SimpleITK.so is interesting. The installation is around 800Mb big right now. I am not sure we need to deliver all these files.
I am also wondering if I should keep SimpleITK_EXPLICIT_INSTANTIATION:BOOL=OFF, I am not sure what this does and if this is needed for the delivery.

FYI you can find the homebrew formula here: https://github.com/Homebrew/homebrew-science/blob/master/simpleitk.rb
The interesting part is at the end, where cmake, make and setupegg.py get called.

@blowekamp
Copy link
Member

The installed C++ SimpleITK libraries are not usable with out installed ITK libraries. That is really what this error message is saying.

Your immediate options are:

  • Only install SimpleITK Python, remove the CMAKE_INSTALL_PREFIX option
  • Use a system installed ITK ( most likely this will be a shared library, so there are some size and symbol issue that may need to be addressed ).

Related to this is extending the SimpleITK to support other languages with shared SimpleITK libraries. I know we tried creating a separate SimpleITK-core/libSimpleITK package this with SimpleITK 0.10.0 and ran into some trouble. Things may be in a better state now?

@blowekamp
Copy link
Member

As this error only occurs when the build of SimpleITK is configured such that the install will not be functional. I am going to abandon the pull request. There have been a number of suggestions to configure SimpleITK to avoid this error message and produce a valid installation.

@iMichka
Copy link
Author

iMichka commented Apr 29, 2017

Thanks for having looked into this. I was able to successfully build simpleitk with SimpleITK_EXPLICIT_INSTANTIATION:BOOL=ON and CMAKE_INSTALL_PREFIX="".

I am still annoyed by the fact that the .a and .h files get installed: Performing install step for 'SimpleITK' is called, even if I only call "make". Is this maybe because this is an external project? Is there a make target that only builds without installing all the simpleitk files?

Also, for the question about splitting the core - wrapping packages, I was able to get this to run with 0.10.0, but finally stopped my effort here. Homebrew does not use that kind of concept: there is in general only one formula for each library, which has a bunch of options. So splitting this in multiple formulas is not in the philosophy of Homebrew (in contrast to debian for example where you would have more easily that kind of sub-packages).

@blowekamp
Copy link
Member

With the current source code when the Superbuild is used the SimpleITK subproject is always installed because of the way the ExternalProject is configured. By default ( when CMAKE_INSTALL_PREFIX is not set ), it will be installed into the Suberbuild build tree. With CMAKE_INSTALL_PREFIX="", it should be installed in the Superbuild tree, and not in the system, correct? There should not be any problem with the installation into the Superbuild tree.

Thank you for working on this recipe.

@iMichka
Copy link
Author

iMichka commented May 9, 2017

Okay it worked, I looked carefully; when CMAKE_INSTALL_PREFIX="", then the files get installed in the build tree, and not copied to the final homebrew location. Really nice, our bottles just got smaller for simpleitk. Thanks for all.

@blowekamp
Copy link
Member

Glad that that you go it working!

This is actually the default behavior when CMAKE_INSTALL_PREFIX is not set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants