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

Build for mac using cmake to Xcode fails to compile #455

Closed
kdt3rd opened this issue Jul 18, 2019 · 4 comments
Closed

Build for mac using cmake to Xcode fails to compile #455

kdt3rd opened this issue Jul 18, 2019 · 4 comments
Assignees
Labels
Build A problem with building or installing the library.

Comments

@kdt3rd
Copy link
Contributor

kdt3rd commented Jul 18, 2019

Mac builds work fine if you run with makefiles or ninja generator, but if you generate for Xcode, the builds fail. However, it seems to be an issue with dependencies between the build stages generated by cmake (i.e. generating the headers, the libraries, etc.), and if you go through the dependency chain manually, each successive step can build. Based on the bug reports on cmake.org / kitware, it appears to be an issue with the object library mechanism, and some build-artifact thing that Xcode does. There does not seem to be anything code-wise to be done until cmake fixes the issue, however we should probably document this known failure case.

OpenSubdiv has explicitly warned against building using Xcode due to the same issues:
https://graphics.pixar.com/opensubdiv/docs/cmake_build.html

@kdt3rd kdt3rd added CMake Build A problem with building or installing the library. labels Jul 18, 2019
@kdt3rd kdt3rd self-assigned this Jul 18, 2019
@meshula
Copy link
Contributor

meshula commented Jul 18, 2019

Could you link a report on the kitware site? The OpenSubdiv site mentions a problem, but not the particulars.

@kdt3rd
Copy link
Contributor Author

kdt3rd commented Jul 21, 2019

There are a few, but these two are good representative issues:
https://gitlab.kitware.com/cmake/cmake/issues/17500
https://gitlab.kitware.com/cmake/cmake/issues/18088

If I remove the ability for both types of libraries at once using the object library mechanism, it seems to work ok, maybe I'll just do that when the xcode generator is running...

kdt3rd added a commit to kdt3rd/openexr that referenced this issue Jul 21, 2019
… apple

Per the docs, add_library calls with only object library dependencies
are not yet handled properly by Xcode and similar. Disable the use of
object libraries as a compilation speedup mechanism as a result.
Similarly, disable under win32 when building both types of libs to avoid
exported symbols in the static libs. Finally, use same mechanism to
avoid extra layer of libs in generated exports when only building one
config on all platforms

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
@kdt3rd
Copy link
Contributor Author

kdt3rd commented Jul 21, 2019

Found the single sentence in the add_library docs in the official docs saying what I was doing isn't going to work for xcode for now, so just changed the mechanism, so if you are building both static and shared libraries under xcode, you'll have to incur a double compile for the time being

@meshula
Copy link
Contributor

meshula commented Jul 21, 2019

Thanks for the links; I understand the problem now. Trying to make it work would involve shenanigans to little gain, that's for sure.

@kdt3rd kdt3rd closed this as completed in 0451df8 Jul 21, 2019
DominicJacksonBFX pushed a commit to boris-fx/mocha-openexr that referenced this issue Jun 22, 2022
… apple

Per the docs, add_library calls with only object library dependencies
are not yet handled properly by Xcode and similar. Disable the use of
object libraries as a compilation speedup mechanism as a result.
Similarly, disable under win32 when building both types of libs to avoid
exported symbols in the static libs. Finally, use same mechanism to
avoid extra layer of libs in generated exports when only building one
config on all platforms

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build A problem with building or installing the library.
Projects
None yet
Development

No branches or pull requests

2 participants