Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

undefined reference to `pxrInternal_v0_24_11__pxrReserved__::UsdStage::Open #3472

Closed
silicode17 opened this issue Dec 19, 2024 · 7 comments
Closed

Comments

@silicode17
Copy link

Description of Issue

I am getting a link error when linking a small C++ project to USD.

Steps to Reproduce

  1. Clone the repo
  2. Run python OpenUSD/build_scripts/build_usd.py --no-python --build-variant release /home/vic/Projects/USD_INSTALL
  3. The build is successful

My main.cpp:

#include <iostream>

#include <pxr/usd/usd/prim.h>
#include <pxr/usd/usd/stage.h>
#include <pxr/usd/usdGeom/cube.h>
#include <pxr/usd/usdGeom/mesh.h>
#include <pxr/usd/usd/primRange.h>
#include <pxr/usd/usdGeom/pointBased.h>

int main()
{
    std::string filePath = "../../scene.usda";
    PXR_NS::UsdStageRefPtr stage = PXR_NS::UsdStage::Open(filePath);
    return 0;
}

I am linking against all the .so files that are under USD_INSTALL/lib

This is the full link error:

undefined reference to `pxrInternal_v0_24_11__pxrReserved__::UsdStage::Open(std::string const&, pxrInternal_v0_24_11__pxrReserved__::UsdStage::InitialLoadSet)'

I have tried to build USD in Debug and Release. Same problem.

System Information (OS, Hardware)

Debian 12

Package Versions

Build Flags

@jesschimein
Copy link
Collaborator

Filed as internal issue #USD-10526

(This is an automated message. See here for more information.)

@meshula
Copy link
Member

meshula commented Dec 21, 2024

Can you check if the usd library itself has the symbol you want? Perhaps there's a version mismatch or somesuch. That symbol is in the usd library itself.

ie, try nm libusd_usd.so | grep Open

@silicode17
Copy link
Author

silicode17 commented Dec 21, 2024

Can you check if the usd library itself has the symbol you want? Perhaps there's a version mismatch or somesuch. That symbol is in the usd library itself.

ie, try nm libusd_usd.so | grep Open

The version and the function signature seem to match. The linker should have picked the 2nd one from the bottom:

00000000004e4880 T pxrInternal_v0_24_11__pxrReserved__::UsdStage::Open(pxrInternal_v0_24_11__pxrReserved__::TfWeakPtr<pxrInternal_v0_24_11__pxrReserved__::SdfLayer> const&, pxrInternal_v0_24_11__pxrReserved__::UsdStage::InitialLoadSet)
00000000004e5570 T pxrInternal_v0_24_11__pxrReserved__::UsdStage::Open(pxrInternal_v0_24_11__pxrReserved__::TfWeakPtr<pxrInternal_v0_24_11__pxrReserved__::SdfLayer> const&, pxrInternal_v0_24_11__pxrReserved__::ArResolverContext const&, pxrInternal_v0_24_11__pxrReserved__::UsdStage::InitialLoadSet)
00000000004e4da0 T pxrInternal_v0_24_11__pxrReserved__::UsdStage::Open(pxrInternal_v0_24_11__pxrReserved__::TfWeakPtr<pxrInternal_v0_24_11__pxrReserved__::SdfLayer> const&, pxrInternal_v0_24_11__pxrReserved__::TfWeakPtr<pxrInternal_v0_24_11__pxrReserved__::SdfLayer> const&, pxrInternal_v0_24_11__pxrReserved__::UsdStage::InitialLoadSet)
00000000004e5d00 T pxrInternal_v0_24_11__pxrReserved__::UsdStage::Open(pxrInternal_v0_24_11__pxrReserved__::TfWeakPtr<pxrInternal_v0_24_11__pxrReserved__::SdfLayer> const&, pxrInternal_v0_24_11__pxrReserved__::TfWeakPtr<pxrInternal_v0_24_11__pxrReserved__::SdfLayer> const&, pxrInternal_v0_24_11__pxrReserved__::ArResolverContext const&, pxrInternal_v0_24_11__pxrReserved__::UsdStage::InitialLoadSet)
00000000004e4b50 T pxrInternal_v0_24_11__pxrReserved__::UsdStage::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, pxrInternal_v0_24_11__pxrReserved__::UsdStage::InitialLoadSet)
00000000004e5ad0 T pxrInternal_v0_24_11__pxrReserved__::UsdStage::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, pxrInternal_v0_24_11__pxrReserved__::ArResolverContext const&, pxrInternal_v0_24_11__pxrReserved__::UsdStage::InitialLoadSet)

@meshula
Copy link
Member

meshula commented Dec 22, 2024

Thanks for checking. It looks correct to me. I don't have a follow on idea, maybe someone else has thoughts?

@dgovil
Copy link
Collaborator

dgovil commented Dec 22, 2024

Could you share your build setup for your code sample? It might shed some light on the linker failure

@silicode17
Copy link
Author

Found the problem.
I had _GLIBCXX_USE_CXX11_ABI set to 0 in my CMake.

@meshula
Copy link
Member

meshula commented Dec 23, 2024

Glad you found it! It's a shame the linker doesn't tell you about an ABI mismatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants