Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Can't link against custom static boost build #407

Closed
ix-dcourtois opened this issue Feb 8, 2018 · 4 comments
Closed

Can't link against custom static boost build #407

ix-dcourtois opened this issue Feb 8, 2018 · 4 comments

Comments

@ix-dcourtois
Copy link
Contributor

Description of Issue

When building USD against pre-built libraries using CMake, Boost_USE_STATIC_LIBS option is ignored, resulting in linking errors if the prebuilt boost libs were built as static libs.

The fix is fairly simple, and I have a fix (and pull request) ready to allow users to use the Boost_USE_STATIC_LIBS. I'm posting this issue as per the "Contributing to USD" guide :)

Steps to Reproduce

  1. Build Boost as static libraries only.
  2. Build USD using the following options during configuration: -DBOOST_ROOT=<path_to_boost> -DBoost_USE_STATIC_LIBS=On
  3. Results in LINK : fatal error LNK1104: cannot open file 'boost_regex-vc140-mt-1_61.lib'

System Information (OS, Hardware)

Windows 10 (but probably on any platform)

Package Versions

0.8.x and dev branch

Build Flags

@jtran56
Copy link

jtran56 commented Feb 9, 2018

Filed as internal issue #156962.

@sunyab
Copy link
Contributor

sunyab commented Mar 23, 2018

@ix-dcourtois thanks for posting this! One concern I have about this change is that linking boost::python statically leads to all sorts of problems with the Python bindings. That's one of the reasons we forced the use of the dynamic libraries originally.

I get the desire to be able to use the static boost libs, though. I wonder if there's some way we can partition things so that we allow the static versions of the boost libs except boost::python?

@ix-dcourtois
Copy link
Contributor Author

@sunyab Hi, thanks for taking the time to check this PR.

There seems to be a way to do that, but it could be a bit tricky. In the FindBoost.cmake module, there an example which goes like this:

   set(Boost_USE_STATIC_LIBS        ON)
   # ... some other stuff
   find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...)
   if(Boost_FOUND)
     include_directories(${Boost_INCLUDE_DIRS})
     add_executable(foo foo.cc)
     target_link_libraries(foo ${Boost_LIBRARIES})
   endif()

So maybe this kind of thing could be used to first get the static version of boost::python, and then invoked again with set(Boost_USE_STATIC_LIBS OFF) for the other ones.

The problem I see with this, is that:

  1. it's awfully messy.
  2. my guess is that there will be lot's of problems coming from linking some libs dynamically and some other statically
  3. users usually kind of expect the standard options such as Boost_USE_STATIC_LIBS to do what the doc says (e.g. apply to all libs) and would probably be a bit surprised if it applied on all libs except python :)

To put this pull request in context, here's our use case: we are already using and linking boost internally (as well as openimageio and various other libs used by USD), but we're using static versions of the libs. So in order to use USD in our software, we need to build against our prebuilt versions. Since we don't need the python bindings for now, we don't have the problem you mentioned. This PR fixes only this case.
And as I said, it doesn't change the default behavior (e.g. if users do not use Boost_USE_STATIC_LIBS, USD will continue linking against dynamic boost libs)

I'll try to check what the problem is with the Python bindings, but I'm not sure it can be fixed easily :p

pixar-oss added a commit that referenced this issue Jun 6, 2018
add support for Boost_USE_STATIC_LIBS on Windows. Fixes #407
pixar-oss pushed a commit that referenced this issue Jun 6, 2018
Fixes syntax issue in earlier change 1863058 that
caused BOOST_ALL_DYN_LINK to not be defined in the
typical case where a user didn't specify
Boost_USE_STATIC_LIBS when running CMake.

Fixes #407

(Internal change: 1863247)
@sunyab
Copy link
Contributor

sunyab commented Jun 7, 2018

We discussed this a bit and we think it's good to give users the ability to opt in to this behavior at their own risk rather than completely disallow it. I've merged in your pull request, but also note the follow-up commit f9c5d50. Thanks!

AdamFelt pushed a commit to autodesk-forks/USD that referenced this issue Apr 16, 2024
…AnimationStudios#407)

### Description of Change(s)
Premultied the color for basisCurves with style, as the styled line should be rendered in translucent pass, and the translucent pass uses (ONE, ONE-srcAlpha) blend factor.
Simply premultiply color will make the rendering of patterned lines better, but sketched line worse. This is because the patterned lines uses a material whose metadata is translucent. But sketched lines doesn't have material, so it is still rendered in opaque pass, which is incorrect. So in this pr, I moved most of the fragment shader of styled line from the basisCurves.glslfx to plugin folder. The fragment shader is divided into sketch surface shader and pattern surface shader. Both are with translucent metadata. Now the sketch lines should also use material, and the material must use the sketch surface shader.
### Fixes Issue(s)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants