PixarAnimationStudios / OpenUSD

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

TBB crashes when libwork was linked statically and PXR_WORK_THREAD_LIMIT != 0 #300

Open carlospzlz opened 7 years ago

carlospzlz commented 7 years ago

Description of Issue

Building a minimal program that statically links against libwork and its dependencies and statically links against TBB and setting PXR_WORK_THREAD_LIMIT to value different than 0 produces SIGSEGV.

Steps to Reproduce

  1. Build USD static libraries and TBB static libraries
  2. Make simple program
    int main()
    {
    return 0;
    }
  3. Compile and link it
    $ g++ \
    -Wl,--whole-archive,libwork.a,--no-whole-archive \
    -Wl,--whole-archive,libtf.a,--no-whole-archive \
    -Wl,--whole-archive,libtracelite.a,--no-whole-archive \
    -Wl,--whole-archive,libarch.a,--no-whole-archive \
    main.cpp \
    libtbb_static.a \
    libtbbmalloc_static.a \
    libboost_python.a \
    -lpython2.7 \
    -lpthread \
    -ldl
  4. set environment variable for number of work threads
    export PXR_WORK_THREAD_LIMIT=1
  5. Run the program
    $ ./a.out

System Information (OS, Hardware)

$ uname -a
Linux FWZ6400007 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Package Versions

USD 0.8.0

Build Flags

This is the build line for one of the object files in the libwork archive.

/usr/bin/c++
-DBOOST_ALL_NO_LIB
-DBOOST_PYTHON_NO_PY_SIGNATURES
-DBOOST_PYTHON_STATIC_LIB
-DBUILD_COMPONENT_SRC_PREFIX=\"\"
-DBUILD_OPTLEVEL_DEV
-DGLX_GLXEXT_PROTOTYPES
-DGL_GLEXT_PROTOTYPES
-DIex=IEX_NAMESPACE
-DIlmThread=ILM_THREAD_NAMESPACE
-DImath=IMATH_NAMESPACE
-DImf=OPENEXR_IMF_NAMESPACE
-DLINUX
-DMFB_ALT_PACKAGE_NAME=work
-DMFB_PACKAGE_MODULE=Work
-DMFB_PACKAGE_NAME=work
-DOIIO_STATIC_BUILD
-DPTEX_STATIC
-DPXR_BUILD_LOCATION=../share/usd/plugins
-DPXR_INSTALL_LOCATION=/workspace/carlos.perezlopez/dev/static_usd_perforce/Thirdparty/USD/0.8.0/bin/linux-64-x86-debug-480-cxx11/usd/share/usd/plugins
-DPXR_PLUGIN_BUILD_LOCATION=../plugin/usd
-DPXR_PTEX_SUPPORT_ENABLED
-DPXR_PYTHON_ENABLED=1
-DPXR_PYTHON_SUPPORT_ENABLED
-DPXR_STATIC=1
-DTBB_USE_DEBUG=1
-DTF_NO_GNU_EXT
-DWORK_EXPORTS=1
-D__TBBMALLOC_NO_IMPLICIT_LINKAGE=1
-D__TBB_NO_IMPLICIT_LINKAGE=1
-Ipxr/base/lib/work
-Isrc/pxr/base/lib/work
-isystem
/workspace/carlos.perezlopez/dev/static_usd_perforce/Thirdparty/Python/2.7.13/bin/linux-64-x86-release-480-cxx11/include/python2.7
-Iinclude
-I/workspace/carlos.perezlopez/dev/static_usd_perforce/Thirdparty/TBB/4.4.6/bin/linux-64-x86-debug-410-gcc/include
-I/workspace/carlos.perezlopez/dev/static_usd_perforce/Thirdparty/Boost/1.61.0/bin/linux-64-x86-release-480/include
-std=c++11
-Wall
-pthread
-Wno-deprecated
-Wno-deprecated-declarations
-Wno-unused-local-typedefs
-fPIC
-fvisibility=hidden
-fvisibility-inlines-hidden
-std=gnu++11
-DBOOST_DEBUG_PYTHON
-g
-fPIC
-MD
-MT
pxr/base/lib/work/CMakeFiles/work.dir/threadLimits.cpp.o
-MF
pxr/base/lib/work/CMakeFiles/work.dir/threadLimits.cpp.o.d
-o
pxr/base/lib/work/CMakeFiles/work.dir/threadLimits.cpp.o
-c
src/pxr/base/lib/work/threadLimits.cpp

Thank you very much for your help, Carlos

jtran56 commented 6 years ago

Filed as internal issue #152107.