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

2.1.4 Failure build for ppc64le error: ‘__builtin_thread_pointer’ is not supported on this target #883

Closed
Vascom opened this issue Apr 24, 2024 · 12 comments

Comments

@Vascom
Copy link

Vascom commented Apr 24, 2024

Can't build mimalloc 2.1.4 for Fedora GNU Linux ppc64le arch.
GCC 14.0.1

error: ‘__builtin_thread_pointer’ is not supported on this target

How to fix it?

In file included from /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:9:
In function ‘_mi_prim_thread_id’,
    inlined from ‘_mi_thread_id’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:145:10,
    inlined from ‘mi_heap_main_init.part.0’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:184:31:
/builddir/build/BUILD/mimalloc-2.1.4/include/mimalloc/prim.h:240:21: error: ‘__builtin_thread_pointer’ is not supported on this target
  240 |   return (uintptr_t)__builtin_thread_pointer();
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘_mi_prim_thread_id’,
    inlined from ‘_mi_thread_id’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:145:10:
/builddir/build/BUILD/mimalloc-2.1.4/include/mimalloc/prim.h:240:21: error: ‘__builtin_thread_pointer’ is not supported on this target
  240 |   return (uintptr_t)__builtin_thread_pointer();
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘_mi_prim_thread_id’,
    inlined from ‘_mi_thread_id’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:145:10,
    inlined from ‘_mi_is_main_thread’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:405:68:
/builddir/build/BUILD/mimalloc-2.1.4/include/mimalloc/prim.h:240:21: error: ‘__builtin_thread_pointer’ is not supported on this target
  240 |   return (uintptr_t)__builtin_thread_pointer();
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /builddir/build/BUILD/mimalloc-2.1.4/src/alloc.c:14:
In function ‘_mi_prim_thread_id’,
    inlined from ‘mi_free’ at /builddir/build/BUILD/mimalloc-2.1.4/src/free.c:143:26:
/builddir/build/BUILD/mimalloc-2.1.4/include/mimalloc/prim.h:240:21: error: ‘__builtin_thread_pointer’ is not supported on this target
  240 |   return (uintptr_t)__builtin_thread_pointer();
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘_mi_prim_thread_id’,
    inlined from ‘_mi_thread_id’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:145:10,
    inlined from ‘_mi_thread_done’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:452:26:
/builddir/build/BUILD/mimalloc-2.1.4/include/mimalloc/prim.h:240:21: error: ‘__builtin_thread_pointer’ is not supported on this target
  240 |   return (uintptr_t)__builtin_thread_pointer();
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘_mi_prim_thread_id’,
    inlined from ‘_mi_thread_id’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:145:10,
    inlined from ‘mi_process_init’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:578:3,
    inlined from ‘mi_process_init’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:570:6:
/builddir/build/BUILD/mimalloc-2.1.4/include/mimalloc/prim.h:240:21: error: ‘__builtin_thread_pointer’ is not supported on this target
  240 |   return (uintptr_t)__builtin_thread_pointer();
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘_mi_prim_thread_id’,
    inlined from ‘_mi_thread_id’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:145:10,
    inlined from ‘_mi_is_main_thread’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:405:68,
    inlined from ‘_mi_heap_init’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:293:7,
    inlined from ‘mi_thread_init’ at /builddir/build/BUILD/mimalloc-2.1.4/src/init.c:423:7:
/builddir/build/BUILD/mimalloc-2.1.4/include/mimalloc/prim.h:240:21: error: ‘__builtin_thread_pointer’ is not supported on this target
  240 |   return (uintptr_t)__builtin_thread_pointer();
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~

Full build log https://kojipkgs.fedoraproject.org//work/tasks/4072/116804072/build.log

@cfvescovo
Copy link

Same issue on x86_64 GNU/Linux (GCC). See purpleprotocol/mimalloc_rust#111

@Vascom
Copy link
Author

Vascom commented Apr 24, 2024

Same issue on x86_64 GNU/Linux (GCC). See purpleprotocol/mimalloc_rust#111

In my case other arches built successfully https://koji.fedoraproject.org/koji/taskinfo?taskID=116804025

@cfvescovo
Copy link

My build logs

> [build 6/7] RUN cargo build --locked --release:
12.70   cargo:warning=  240 |   return (uintptr_t)__builtin_thread_pointer();
12.70   cargo:warning=      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
12.70 
12.70   --- stderr
12.70 
12.70 
12.70   error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "c_src/mimalloc/include" "-I" "c_src/mimalloc/src" "-Wall" "-Wextra" "-ftls-model=initial-exec" "-DMI_DEBUG=0" "-o" "/app/target/release/build/libmimalloc-sys-9bc557761968b710/out/98cfcaec7182b1d8-static.o" "-c" "c_src/mimalloc/src/static.c" with args cc did not execute successfully (status code exit status: 1).

@cfvescovo
Copy link

Will give more verbose output ASAP

@cfvescovo
Copy link

cfvescovo commented Apr 24, 2024

I got it to work by changing the distro I am using for my containers. I switched from debian bullseye to ubuntu latest (LTS). However, I did not investigate further.

@daanx
Copy link
Collaborator

daanx commented Apr 25, 2024

ah, that is a shame. I wonder what goes wrong since the check:

// Do we have __builtin_thread_pointer? (do not make this a compound test as it fails on older gcc's, see issue #851)
#if defined(__has_builtin)
#if __has_builtin(__builtin_thread_pointer)
#define MI_HAS_BUILTIN_THREAD_POINTER  1
#endif
#elif defined(__GNUC__) && (__GNUC__ >= 7) && defined(__aarch64__)  // special case aarch64 for older gcc versions (issue #851)
#define MI_HAS_BUILTIN_THREAD_POINTER  1
#endif

seems to correctly test if __builtin_thread_pointer exists?

I think I will switch the default to prefer the TLS slot assembly after all and fall back to __builtin_thread_pointer otherwise.

daanx added a commit that referenced this issue Apr 25, 2024
…y fixes build errors on various platforms (see issue #883)
@daanx
Copy link
Collaborator

daanx commented Apr 25, 2024

I just pushed a potential fix to dev and dev-slice. If this fixes the build issues I will update the release soon. Please test if you can.

@Vascom
Copy link
Author

Vascom commented Apr 25, 2024

This patch not fixed ppc64le build. Error is the same.
I mean 146f9d2

@daanx
Copy link
Collaborator

daanx commented Apr 27, 2024

This patch not fixed ppc64le build. Error is the same. I mean 146f9d2

Darn -- it looks like we cannot check for __builtin_thread_pointer reliably. Maybe we should only enable it for platforms that we explicitly tested for :-(

@daanx
Copy link
Collaborator

daanx commented Apr 27, 2024

@Vascom, I hope the latest commits fix the build issues now. fingers crossed.
(At some point I would like to figure out though why the is_builtin tests are positive even though the builtin is not actually supported? )

@hpreusse
Copy link

hpreusse commented May 16, 2024

Same here for ppc64el, hppa, ia64, m68k, powerpc, ppc64, sparc64. See build server of Debian. I'll try your commit ASAP.

hpreusse added a commit to debian-tex/luametatex that referenced this issue May 16, 2024
@hpreusse
Copy link

I can confirm that adding the two commits cc3c14f and 146f9d2 solved the build issue for me.

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