On Sat, Dec 26, 2020 at 06:47:10AM +0100, Sebastien Marie wrote:
> On Sat, Dec 26, 2020 at 03:50:37AM +0000, Dimitri Karamazov wrote:
> > Ping
> > 
> > On Sat, Dec 19, 2020 at 01:45:25PM +0000, Dimitri Karamazov wrote:
> > > While building http://www.openusd.org/ I get the following error.
> > > This is specifically triggered when PXR_BUILD_MONOLITH option is set.
> > > I couldn't find anything about this in the mailing-list so is this
> > > something I can deal with? This is a problem for both base/ports clang.
> > > 
> > > [1/91] : && /usr/ports/pobj/usd-20.11/bin/c++ -fPIC -Wall -pthread 
> > > -Wno-deprecated -Wno-deprecated-declarations -Wno-unused-local-typedefs 
> > > -Wno-unused-command-line-argument -O2 -pipe -DNDEBUG   -shared 
> > > -Wl,-soname,libusd_ms.so -o libusd_ms.so 
> > > CMakeFiles/usd_ms.dir/usd_ms.cpp.o 
> > > -L/usr/ports/pobj/usd-20.11/build-amd64/pxr   -L/usr/lib   
> > > -L/usr/local/lib -Wl,-z,origin,-rpath,:::::::::::  -Wl,-force_load  
> > > -lusd_m  -lm  -ltbb  -ltbb  -ltbb  -ltbb  -ltbb  -ltbb  -ltbb  -ltbb  
> > > -ltbb  -Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :
> > > FAILED: libusd_ms.so 
> > > : && /usr/ports/pobj/usd-20.11/bin/c++ -fPIC -Wall -pthread 
> > > -Wno-deprecated -Wno-deprecated-declarations -Wno-unused-local-typedefs 
> > > -Wno-unused-command-line-argument -O2 -pipe -DNDEBUG   -shared 
> > > -Wl,-soname,libusd_ms.so -o libusd_ms.so 
> > > CMakeFiles/usd_ms.dir/usd_ms.cpp.o 
> > > -L/usr/ports/pobj/usd-20.11/build-amd64/pxr   -L/usr/lib   
> > > -L/usr/local/lib -Wl,-z,origin,-rpath,:::::::::::  -Wl,-force_load  
> > > -lusd_m  -lm  -ltbb  -ltbb  -ltbb  -ltbb  -ltbb  -ltbb  -ltbb  -ltbb  
> > > -ltbb  -Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :
> > > ld: error: unknown argument '-force_load'
> 
> from llvm/clang code source, -force_load option seems to be available in 
> Darwin toolchain:
> 
> grepping "force_load" in whole src/, excluding m4 and configure files:
>         src/gnu/llvm/clang/include/clang/Driver/Options.td
>         src/gnu/llvm/clang/lib/Driver/ToolChains/Darwin.cpp
>         src/gnu/llvm/clang/tools/clang-shlib/CMakeLists.txt
>         src/gnu/llvm/lld/lib/Driver/DarwinLdDriver.cpp
>         src/gnu/llvm/lld/lib/Driver/DarwinLdOptions.td
> 
> does usd has already been ported to OpenBSD ? it seems that this build
> assumes a Darwin option to be present (which is not and so fail).
> 
> you might want to found from where the option "-Wl,-force_load" comes
> from.
> 
I'm porting it. The build goes fine when I allow for separate shared libs
but that is not in accordance with how blender wants it. It expects a 
single monolith library which is enabled with PXR_BUILD_MONOLITH.

If required can this option be enabled in the ports llvm? I'll see if I can
do without it.

I'm attaching the port below, if any one wants to take a look. The part
which contains that option is:

cmake/macros/Public.cmake
function(pxr_toplevel_epilogue)
    # If we're building a shared monolithic library then link it against
    # usd_m.
    if(TARGET usd_ms AND NOT PXR_MONOLITHIC_IMPORT)
        # We need to use whole-archive to get all the symbols.  Also note
        # that we carefully avoid adding the usd_m target itself by using
        # TARGET_FILE.  Linking the usd_m target would link usd_m and
        # everything it links to.
        if(MSVC)
            target_link_libraries(usd_ms
                PRIVATE
                    -WHOLEARCHIVE:$<TARGET_FILE:usd_m>
            )
        elseif(CMAKE_COMPILER_IS_GNUCXX)
            target_link_libraries(usd_ms
                PRIVATE
                    -Wl,--whole-archive $<TARGET_FILE:usd_m> 
-Wl,--no-whole-archive
            )
        elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
            target_link_libraries(usd_ms
                PRIVATE
                    -Wl,-force_load $<TARGET_FILE:usd_m>
            )
        endif()

        # Since we didn't add a dependency to usd_ms on usd_m above, we
        # manually add it here along with compile definitions, include
        # directories, etc
        add_dependencies(usd_ms usd_m)

        # Add the stuff we didn't get because we didn't link against the
        # usd_m target.
        target_compile_definitions(usd_ms
            PUBLIC
                $<TARGET_PROPERTY:usd_m,INTERFACE_COMPILE_DEFINITIONS>
        )
        target_include_directories(usd_ms
            PUBLIC
                $<TARGET_PROPERTY:usd_m,INTERFACE_INCLUDE_DIRECTORIES>
        )
        target_include_directories(usd_ms
            SYSTEM
            PUBLIC
                $<TARGET_PROPERTY:usd_m,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
        )
        foreach(lib ${PXR_OBJECT_LIBS})
            get_property(libs TARGET ${lib} PROPERTY INTERFACE_LINK_LIBRARIES)
            target_link_libraries(usd_ms
                PUBLIC
                    ${libs}
            )
        endforeach()
        target_link_libraries(usd_ms
            PUBLIC
                ${PXR_MALLOC_LIBRARY}
                ${PXR_THREAD_LIBS}
        )

        _pxr_init_rpath(rpath "${libInstallPrefix}")
        _pxr_add_rpath(rpath 
"${CMAKE_INSTALL_PREFIX}/${PXR_INSTALL_SUBDIR}/lib")
        _pxr_add_rpath(rpath "${CMAKE_INSTALL_PREFIX}/lib")
        _pxr_install_rpath(rpath usd_ms)
    endif()

    # Setup the plugins in the top epilogue to ensure that everybody has had a
    # chance to update PXR_EXTRA_PLUGINS with their plugin paths.
    pxr_setup_plugins()
endfunction() # pxr_toplevel_epilogue

regards,
  Dimitri

Attachment: usd.tar.gz
Description: Binary data

Reply via email to