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

Add extra step to Makefile config target to force CMake rescan installed packages #4305

Conversation

kaarrot
Copy link
Contributor

@kaarrot kaarrot commented Jun 21, 2024

Something for consideration as I'm not sure what would be the best way to handle this.

Building with -DOpenImageIO_BUILD_MISSING_DEPS=all fails on Linux with the following error:

In file included from /home/kuba/SRC/OpenImageIO/__build2/include/OpenImageIO/Imath.h:11,
                 from /home/kuba/SRC/OpenImageIO/src/libutil/strutil_test.cpp:8:
/home/kuba/SRC/OpenImageIO/__build2/include/OpenImageIO/half.h:8:10: fatal error: Imath/half.h: No such file or directory
    8 | #include <Imath/half.h>

Steps to reproduce:

make config MY_CMAKE_FLAGS="-DOpenImageIO_BUILD_MISSING_DEPS=all"
make build

Initially I thought this is related with OpenImageIO/Imath.h expecting system includes: include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES})
As it turns out this was redherring and the problem could be with CMake "state?" (Maybe a specific CMake version 3.27.7 to blame).
A potential fix - after the initial configuration completes - is to reconfigure the project one more time: cmake .. which resolves the error.
The second reconfiguration command is also protected by ${build_dir}/${BUILDSENTINEL} hence runs only once - during the initial configuration. If anyone is able to reproduce this or have any thoughts what the root problem may be - please chime in.

… once building with BUILD_MISSING_DEPS=1 completes.

This is necessary as CMake does not detect Imath include directory and errors during build.

Signed-off-by: kuba <kuba456@gmail.com>
@kaarrot kaarrot changed the title Add extra step to Makefile config target to forces CMake rescan installed packages Add extra step to Makefile config target to force CMake rescan installed packages Jun 21, 2024
@@ -207,7 +207,7 @@ ifneq (${CLANG_FORMAT_EXCLUDES},)
endif

ifneq (${BUILD_MISSING_DEPS},)
MY_CMAKE_FLAGS += -DBUILD_MISSING_DEPS:BOOL=${BUILD_MISSING_DEPS}
MY_CMAKE_FLAGS += -DOpenImageIO_BUILD_MISSING_DEPS:STRING=all
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks.

Also note that since these use my new set_cache() macro, you can also set this via environment variable... and therefore, via make argument. That is,

make OpenImageIO_BUILD_MISSING_DEPS=all

works and doesn't need any special logic in the Makefile.

Maybe we should eliminate BUILD_MISSING_DEPS entirely and just use the new name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should eliminate BUILD_MISSING_DEPS entirely and just use the new name?
I agree - also nice we can reuse same argument names in both places.
I'll address that.

Comment on lines +248 to +250
if [ "${BUILD_MISSING_DEPS}" = "1" ] ; then \
${CMAKE} ${working_dir} ; \
fi ; \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this change, at worst it's harmless, but I'm not sure I understand why a second invocation is needed. Can you ELI5?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may actually got to the bottom of the problem which makes the above change redundant.
The libutil target - (setup_oiio_util_library function) does not account for the include path to the "missing required" dependencies just built. At the build time, they are located under ./deps/dist/include). The only include path currently set there is the final install prefix location.
So adding $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/deps/dist/include> seems to address it.

@kaarrot
Copy link
Contributor Author

kaarrot commented Jun 22, 2024

I'm going to close this one and continue in #4306

@kaarrot kaarrot closed this Jun 22, 2024
lgritz pushed a commit that referenced this pull request Jun 22, 2024
This is the continuation of [4305
](#4305
extra step to Makefile config target to force CMake to rescan).
The error occurs when configuring with `make
OpenImageIO_BUILD_MISSING_DEPS=all` option which fails the build as
`libuitil` does not have `./dep/dist/include` on the path.
The original solution was to rerun cmake and let it rescan paths. This
step was only required to run once - after the initial CMake
configuration step. This kind off worked but I'm still unsure why. So
instead of that we can just add the missing location to CMakeLists.

Signed-off-by: kuba <kuba456@gmail.com>
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

Successfully merging this pull request may close these issues.

2 participants