OpenUSD icon indicating copy to clipboard operation
OpenUSD copied to clipboard

Compile python modules with hidden default visibility

Open sopvop opened this issue 7 years ago • 4 comments

This change should improve python module import times and make binaries smaller.

Stats for largest modules before and after:

           symbol count              size (stripped)
_gf.so    16561   724           9.6M (6.5M)     6.1M (3.0M)
_sdf.so   19906   1193          15M  (9.5M)     9.4M (4.2M)
_vt.so    25098   531           18M  (13M)      12M  (6.5M)

sopvop avatar Oct 30 '18 09:10 sopvop

Filed as internal issue #USD-4880.

jtran56 avatar Oct 30 '18 17:10 jtran56

Hi @sopvop, thanks for filing this! This change seems to work great on Linux and Windows, but I run into a large number of odd test failures on MacOS. My test machine is using Xcode 9 on MacOS 10.12.6.

Some example test output is pasted below. Any thoughts?

106: Test timeout computed to be: 9.99988e+06
106: E
106: ======================================================================
106: ERROR: test_CameraEqualOperator (__main__.TestGfCamera)
106: ----------------------------------------------------------------------
106: Traceback (most recent call last):
106:   File "/Users/usdonmac/Projects/usd/sunya/dev-cmake/build_standard/inst/tests/testGfCamera", line 131, in test_CameraEqualOperator
106:     self.AssertCamSelfEvaluating(cam1)
106:   File "/Users/usdonmac/Projects/usd/sunya/dev-cmake/build_standard/inst/tests/testGfCamera", line 56, in AssertCamSelfEvaluating
106:     self.AssertEqualCams(cam, eval(repr(cam)))
106:   File "<string>", line 5, in <module>
106: NameError: name 'Tf' is not defined
106:
106: ----------------------------------------------------------------------
106: Ran 1 test in 0.001s
106:
106: FAILED (errors=1)
...
156: Test timeout computed to be: 9.99988e+06
156: E
156: ======================================================================
156: ERROR: test_Basic (__main__.TestSdfAttributeBlocking)
156: ----------------------------------------------------------------------
156: Traceback (most recent call last):
156:   File "/Users/usdonmac/Projects/usd/sunya/dev-cmake/build_standard/inst/tests/testSdfAttributeBlocking", line 32, in test_Basic
156:     prim = Sdf.PrimSpec(layer, "Sphere", Sdf.SpecifierDef)
156: AttributeError: 'module' object has no attribute 'SpecifierDef'
156:
156: ----------------------------------------------------------------------
156: Ran 1 test in 0.002s
156:
156: FAILED (errors=1)

sunyab avatar Oct 30 '18 18:10 sunyab

It should have zero effect on windows build with msvc.

I don't have access to mac, so I can't debug it. Does it compile with clang and link to libc++? AFAIK libc++ is more sensitive to linking typeinfo and more serious about ODR.

Maybe turn this on only on Linux?

sopvop avatar Oct 30 '18 18:10 sopvop

Hi, really hope Mac support is going to be more stable, there are still Python issues when building the Maya plugin having to use Maya's own Python.

I was able to build USD on MacOS as well as the much simplified USD Houdini plugin packaged by SideFX but the Maya plugin crashes on start due to Python failure.

See also the google group discussion here.

amotarzi avatar Oct 31 '18 08:10 amotarzi