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

USD uses deprecated malloc hooks removed in glibc 2.34 #1592

Closed
musicinmybrain opened this issue Aug 10, 2021 · 4 comments
Closed

USD uses deprecated malloc hooks removed in glibc 2.34 #1592

musicinmybrain opened this issue Aug 10, 2021 · 4 comments

Comments

@musicinmybrain
Copy link
Contributor

musicinmybrain commented Aug 10, 2021

Description of Issue

Steps to Reproduce

  1. Build on a platform with glibc 2.34 (such as Fedora Rawhide, the development version of Fedora Linux)

System Information (OS, Hardware)

Fedora Rawhide

Package Versions

21.08

Build Flags

Discovered in distribution build. Should not be affected by build flags (except PXR_MALLOC_LIBRARY).

Worked around for now by enabling jemalloc with PXR_MALLOC_LIBRARY.


/usr/bin/ld: ../../../../libusd_ms.so.0: undefined reference to `__memalign_hook'
/usr/bin/ld: ../../../../libusd_ms.so.0: undefined reference to `__malloc_hook'
/usr/bin/ld: ../../../../libusd_ms.so.0: undefined reference to `__free_hook'
/usr/bin/ld: ../../../../libusd_ms.so.0: undefined reference to `__realloc_hook'

From https://sourceware.org/pipermail/libc-alpha/2021-August/129718.html:

* The deprecated memory allocation hooks __malloc_hook, __realloc_hook,
  __memalign_hook and __free_hook are now removed from the API.  Compatibility
  symbols are present to support legacy programs but new applications can no
  longer link to these symbols.  These hooks no longer have any effect on glibc
  functionality.  The malloc debugging DSO libc_malloc_debug.so currently
  supports hooks and can be preloaded to get this functionality back for older
  programs.  However this is a transitional measure and may be removed in a
  future release of the GNU C Library.  Users may port away from these hooks by
  writing and preloading their own malloc interposition library.
@jilliene
Copy link

Filed as internal issue #USD-6832

@hradec
Copy link

hradec commented Jan 3, 2022

I was able to build USD 20.08 on fedora 35 (with the newer glibc), by patching pxr/base/arch/mallocHook.cpp with this little sed line:

sed -i.bak  -e 's/.if !defined.ARCH_OS_WINDOWS./#if 0/' -e 's/.if defined.ARCH_COMPILER_GCC.*/#if 0/' -e 's/defined.ARCH_COMPILER_CLANG.//' -e 's/.if defined.ARCH_OS_LINUX./#if 0/' -e 's/.if !defined.ARCH_OS_LINUX./#if 1/' pxr/base/arch/mallocHook.cpp

It essentially disables glibc mallocHook in the same fashion it does for OSX and Windows.

With this, it was able to build successfully, although I didn't had time to test the binaries yet.

I'll update this issue once I do!

my 2 cents...
-H

@luyatshimbalanga
Copy link

I was able to build USD 20.08 on fedora 35 (with the newer glibc), by patching pxr/base/arch/mallocHook.cpp with this little sed line:

sed -i.bak  -e 's/.if !defined.ARCH_OS_WINDOWS./#if 0/' -e 's/.if defined.ARCH_COMPILER_GCC.*/#if 0/' -e 's/defined.ARCH_COMPILER_CLANG.//' -e 's/.if defined.ARCH_OS_LINUX./#if 0/' -e 's/.if !defined.ARCH_OS_LINUX./#if 1/' pxr/base/arch/mallocHook.cpp

It essentially disables glibc mallocHook in the same fashion it does for OSX and Windows.

Thanks. The above patch resolves the build issue on USD 22.03 soon to land on Fedora 36 and Rawhide.

@sunyab
Copy link
Contributor

sunyab commented Aug 13, 2022

This was addressed by 8b19842 which is part of the recent 22.08 release. Closing this out.

@sunyab sunyab closed this as completed Aug 13, 2022
buddly27 added a commit to wdas/unf that referenced this issue Jan 13, 2023
USD 20.11 does not build on ubuntu 22.04 due to the following issues:
- PixarAnimationStudios/OpenUSD#1546
- PixarAnimationStudios/OpenUSD#1592

Lock the platform version to Ubuntu 20.04 to test it.

USD 22.05 is also affected by the second issue, so we just bump up to
the latest version, which is 22.11, so we can keep the "ubuntu-latest"
platform.
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

5 participants