PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.11k stars 1.21k forks source link

Windows build fails when boost has been built with "--layout=system" on 21 and 22 but not 20 #1943

Closed anderslanglands closed 1 year ago

anderslanglands commented 2 years ago

Description of Issue

If you try to link against a boost that has been built with "--layout=system" on Windows in 21.08 or 22.05 (20.08 builds just fine) then the build fails with something like:

LINK : fatal error LNK1104: cannot open file 'boost_python39-vc142-mt-x64-1_70.lib' [C:\Users\anders\AppData\Local\Temp\rez-cook\usd\22.05\_install\build\22.05\pxr\base\tf\tf.vcxproj

when the library in question is actually called boost_python39.lib

What's weird about this is that the right name is being passed to the linker, and if you grep in the project and build directories, that incorrect string (boost_python39-vc142-mt-x64-1_70.lib) only turns up in the binary objects, not in any of the cmake files. So I don't really know how to debug this.

Fortunately it does repro with build_usd.py at HEAD. I've tested with my own build setup with boost-1.70, 1.73, 1.76 and 1.79, and python-3.7 and 3.9.

Steps to Reproduce

  1. Add '--layout=system', to the list of b2 args around line 747 in build_usd.py and build.
  2. Go make a cup of coffee

System Information (OS, Hardware)

Windows 11

Package Versions

jinja2-3.1.2
markupsafe-2.1.1 pyopengl-3.1.6
pyside2-5.15.2.1 python-3.9.12 (and 3.7.9) vs-2019 (and 2017) boost-1.70, 1.73, 1.76, 1.79

Build Flags

Tried multiple configurations with the same result. My flags for the build_usd.py repro were just the install path, -j12 and -vv

meshula commented 2 years ago

This seems like a classic symptom of the "convenience", or some might say "not fully worked through (by the boost authors) consequence", of boost incorporating library names via #pragma lib statements.

Does it help to add BOOST_ALL_NO_LIB as a processor flag to the projects that consume boost python?

anderslanglands commented 2 years ago

Looks like that works! Thanks Nick! Interestingly it's only USD (and only 21+) that suffers from this issue. Everything else in the dep tree (e.g. OIIO, OCIO) works fine.

On Mon, 11 Jul 2022 at 06:10, Nick Porcino @.***> wrote:

This seems like a classic symptom of the "convenience", or some might say "not fully worked through (by the boost authors) consequence", of boost incorporating library names via #pragma lib statements.

Does it help to add BOOST_ALL_NO_LIB as a processor flag to the projects that consume boost python?

— Reply to this email directly, view it on GitHub https://github.com/PixarAnimationStudios/USD/issues/1943#issuecomment-1179773809, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOYQXIGPJQLLKGTQASIGITVTMGX7ANCNFSM53EZZSSA . You are receiving this because you authored the thread.Message ID: @.***>

meshula commented 2 years ago

@anderslanglands It's probably worth reviewing the boost documentation for clues:

https://en.wikipedia.org/wiki/Necronomicon

I wonder if OIIO & OCIO impose BOOST_ALL_NO_LIB manually?

Bingo! https://github.com/OpenImageIO/oiio/commit/051f16933c5a2956b3648179ddfbd574a0c93ffa

Perhaps a PR adding this flag to the USD build is in order ;)

That said, I do wonder what changed between 20 and 21.

anderslanglands commented 2 years ago

I can't see that anything really changed in the cmake between 20 and 21, at least with a quick grep. I don't hate myself enough to really dig into the boost code and try and figure out what's going on though.

I'll try and make a PR for BOOST_ALL_NO_LIB after work tonight.

On Mon, 11 Jul 2022 at 13:35, Nick Porcino @.***> wrote:

@anderslanglands https://github.com/anderslanglands It's probably worth reviewing the boost documentation for clues:

https://en.wikipedia.org/wiki/Necronomicon

I wonder if OIIO & OCIO impose BOOST_ALL_NO_LIB manually?

Bingo! @.*** https://github.com/OpenImageIO/oiio/commit/051f16933c5a2956b3648179ddfbd574a0c93ffa

Perhaps a PR adding this flag to the USD build is in order ;)

That said, I do wonder what changed between 20 and 21.

— Reply to this email directly, view it on GitHub https://github.com/PixarAnimationStudios/USD/issues/1943#issuecomment-1179864003, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOYQXPKFQKG5E5IL5E7NGDVTN24VANCNFSM53EZZSSA . You are receiving this because you were mentioned.Message ID: @.***>

sunyab commented 2 years ago

Filed as internal issue #USD-7482

sunyab commented 1 year ago

Closing this out, the change to add BOOST_ALL_NO_LIB was included in 0eaf2f26 in the 23.02 release.