Opened 13 months ago

Last modified 10 months ago

#67220 assigned defect

mimalloc broken on 10.6: error: stdatomic.h: No such file or directory, etc.

Reported by: barracuda156 Owned by: mohd-akram (Mohamed Akram)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: snowleopard, leopard, powerpc, rosetta Cc:
Port: mimalloc

Description

:info:build [ 14%] Building C object CMakeFiles/mimalloc-static.dir/src/alloc-aligned.c.o
:info:build /usr/bin/gcc-4.2 -DMI_MALLOC_OVERRIDE -DMI_OSX_INTERPOSE=1 -DMI_OSX_ZONE=1 -DMI_SHARED_LIB -DMI_SHARED_LIB_EXPORT -Dmimalloc_EXPORTS -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include -pipe -Os -DNDEBUG -I/opt/local/include -std=gnu99 -arch ppc -mmacosx-version-min=10.6 -fPIC -Wall -Wextra -Wno-unknown-pragmas -fvisibility=hidden -Wstrict-prototypes -ftls-model=initial-exec -fno-builtin-malloc -MD -MT CMakeFiles/mimalloc.dir/src/alloc.c.o -MF CMakeFiles/mimalloc.dir/src/alloc.c.o.d -o CMakeFiles/mimalloc.dir/src/alloc.c.o -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/src/alloc.c
:info:build /usr/bin/gcc-4.2 -DMI_MALLOC_OVERRIDE -DMI_OSX_INTERPOSE=1 -DMI_OSX_ZONE=1 -DMI_STATIC_LIB -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include -pipe -Os -DNDEBUG -I/opt/local/include -std=gnu99 -arch ppc -mmacosx-version-min=10.6 -fPIC -Wall -Wextra -Wno-unknown-pragmas -fvisibility=hidden -Wstrict-prototypes -ftls-model=initial-exec -fno-builtin-malloc -MD -MT CMakeFiles/mimalloc-static.dir/src/alloc-aligned.c.o -MF CMakeFiles/mimalloc-static.dir/src/alloc-aligned.c.o.d -o CMakeFiles/mimalloc-static.dir/src/alloc-aligned.c.o -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/src/alloc-aligned.c
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/types.h:24,
:info:build                  from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/internal.h:17,
:info:build                  from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/src/alloc.c:12:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:39:23: error: stdatomic.h: No such file or directory
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/types.h:24,
:info:build                  from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/internal.h:17In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/types.h:24,
:info:build                  from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/internal.h:17,
:info:build                  from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/src/alloc.c:12:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:76: error: expected ‘)’ before ‘(’ token
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:77: error: expected ‘)’ before ‘(’ token
:info:build ,
:info:build                  from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/src/alloc-posix.c:13:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:39:23: error: stdatomic.h: No such file or directory
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/types.h:24,
:info:build                  from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/internal.h:17,
:info:build                  from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/src/alloc-posix.c:13:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:76: error: expected ‘)’ before ‘(’ token
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:77: error: expected ‘)’ before ‘(’ token
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h: In function ‘mi_atomic_addi64_relaxed’:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:108: warning: implicit declaration of function ‘atomic_fetch_add_explicit’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:108: warning: implicit declaration of function ‘_Atomic’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:108: error: expected expression before ‘int64_t’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h: In function ‘mi_atomic_addi64_relaxed’:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:108: warning: implicit declaration of function ‘atomic_fetch_add_explicit’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:108: error: expected expression before ‘)’ token
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:107: warning: unused parameter ‘p’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:107: warning: unused parameter ‘add’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h: In function ‘mi_atomic_maxi64_relaxed’:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:111: warning: implicit declaration of function ‘atomic_load_explicit’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:111: error: expected expression before ‘int64_t’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:111: error: expected expression before ‘)’ token
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:112: warning: implicit declaration of function ‘atomic_compare_exchange_weak_explicit’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:112: error: expected expression before ‘int64_t’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:112: error: expected expression before ‘)’ token
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:110: warning: unused parameter ‘p’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:108: warning: implicit declaration of function ‘_Atomic’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_mimalloc/mimalloc/work/mimalloc-2.1.1/include/mimalloc/atomic.h:108: error: expected expression before ‘int64_t’

Attachments (1)

mimalloc_log.txt (1.7 MB) - added by barracuda156 13 months ago.

Download all attachments as: .zip

Change History (8)

Changed 13 months ago by barracuda156

Attachment: mimalloc_log.txt added

comment:1 Changed 13 months ago by ryandesign (Ryan Carsten Schmidt)

I see it's building with gcc-4.2 whereas stdatomic.h is a C11 thing which gcc-4.2 won't understand. Xcode clang 700 and later support stdatomic.h. Not sure what version of gcc introduced support for it. At least the following should be added to the Portfile:

PortGroup legacysupport 1.1
compiler.c_standard 2011
# stdatomic.h
compiler.blacklist-append {clang < 700}

comment:2 in reply to:  1 Changed 13 months ago by barracuda156

Replying to ryandesign:

I see it's building with gcc-4.2 whereas stdatomic.h is a C11 thing which gcc-4.2 won't understand. Xcode clang 700 and later support stdatomic.h. Not sure what version of gcc introduced support for it. At least the following should be added to the Portfile:

PortGroup legacysupport 1.1
compiler.c_standard 2011
# stdatomic.h
compiler.blacklist-append {clang < 700}

Thank you, I will try that!

comment:3 Changed 13 months ago by barracuda156

That got us further, but there is some wrong assembler code, it seems:

{standard input}:509:Parameter syntax error (parameter 1)
{standard input}:559:Parameter syntax error (parameter 1)
{standard input}:845:Parameter syntax error (parameter 1)
make[2]: *** [CMakeFiles/mimalloc-static.dir/src/page.c.o] Error 1

Here we go:

#elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__)
static inline void mi_atomic_yield(void) {
  __asm__ __volatile__ ("or 27,27,27" ::: "memory");
}
Last edited 13 months ago by barracuda156 (previous) (diff)

comment:4 Changed 13 months ago by barracuda156

After a couple of extra fixes I ended up here:

Undefined symbols:
  "___atomic_compare_exchange_8", referenced from:
      _mi_stat_update.part.0 in stats.c.o
  "__Znam", referenced from:
      __mi_cxx_interposes in alloc.c.o
  "__ZnwmRKSt9nothrow_t", referenced from:
      __mi_cxx_interposes in alloc.c.o
  "___atomic_fetch_add_8", referenced from:
      _mi_atomic_addi64_relaxed in stats.c.o
  "_mi_prim_tls_slot", referenced from:
      _mi_prim_get_default_heap in alloc.c.o
      _mi_prim_get_default_heap in alloc-aligned.c.o
      _mi_prim_get_default_heap in heap.c.o
      __mi_thread_done in init.c.o
      _mi_thread_init in init.c.o
  "___atomic_load_8", referenced from:
      _mi_segment_cache_purge.constprop.0 in segment-cache.c.o
      _mi_segment_cache_purge.constprop.0 in segment-cache.c.o
      _mi_stat_update.part.0 in stats.c.o
      _mi_process_info in stats.c.o
      _mi_process_info in stats.c.o
  "__Znwm", referenced from:
      __mi_cxx_interposes in alloc.c.o
  "__ZnamRKSt9nothrow_t", referenced from:
      __mi_cxx_interposes in alloc.c.o
  "_mi_prim_tls_slot_set", referenced from:
      __mi_heap_set_default_direct in init.c.o
  "___atomic_store_8", referenced from:
      _mi_segment_cache_pop_ex in segment-cache.c.o
      _mi_segment_cache_purge.constprop.0 in segment-cache.c.o
      __mi_segment_cache_push in segment-cache.c.o
      __mi_segment_cache_push in segment-cache.c.o

Of these, atomics is known how to fix, other not yet sure.

Last edited 13 months ago by barracuda156 (previous) (diff)

comment:5 in reply to:  1 Changed 13 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign:

PortGroup legacysupport 1.1

legacysupport isn't necessary to fix the stdatomic issue. What I meant to say was:

PortGroup compiler_blacklist_versions 1.0

comment:6 Changed 10 months ago by barracuda156

There are no logs left, but apparently it is broken Mavericks down: https://ports.macports.org/port/mimalloc/details

comment:7 in reply to:  4 Changed 10 months ago by barracuda156

Replying to barracuda156:

After a couple of extra fixes I ended up here:

Undefined symbols:
  "___atomic_compare_exchange_8", referenced from:
      _mi_stat_update.part.0 in stats.c.o
  "__Znam", referenced from:
      __mi_cxx_interposes in alloc.c.o
  "__ZnwmRKSt9nothrow_t", referenced from:
      __mi_cxx_interposes in alloc.c.o
  "___atomic_fetch_add_8", referenced from:
      _mi_atomic_addi64_relaxed in stats.c.o
  "_mi_prim_tls_slot", referenced from:
      _mi_prim_get_default_heap in alloc.c.o
      _mi_prim_get_default_heap in alloc-aligned.c.o
      _mi_prim_get_default_heap in heap.c.o
      __mi_thread_done in init.c.o
      _mi_thread_init in init.c.o
  "___atomic_load_8", referenced from:
      _mi_segment_cache_purge.constprop.0 in segment-cache.c.o
      _mi_segment_cache_purge.constprop.0 in segment-cache.c.o
      _mi_stat_update.part.0 in stats.c.o
      _mi_process_info in stats.c.o
      _mi_process_info in stats.c.o
  "__Znwm", referenced from:
      __mi_cxx_interposes in alloc.c.o
  "__ZnamRKSt9nothrow_t", referenced from:
      __mi_cxx_interposes in alloc.c.o
  "_mi_prim_tls_slot_set", referenced from:
      __mi_heap_set_default_direct in init.c.o
  "___atomic_store_8", referenced from:
      _mi_segment_cache_pop_ex in segment-cache.c.o
      _mi_segment_cache_purge.constprop.0 in segment-cache.c.o
      __mi_segment_cache_push in segment-cache.c.o
      __mi_segment_cache_push in segment-cache.c.o

Of these, atomics is known how to fix, other not yet sure.

All non-atomic problematic stuff comes from this commit: https://github.com/microsoft/mimalloc/commit/c47de7eb9090cf8c0a5f307a74437cf927a361be#diff-09d94a49fa7395392e824b1a84c3c76e360ed043aef99205441dc0a199a8a1b8R92 For atomics there is a setting: https://github.com/microsoft/mimalloc/commit/4d89176eb4584c16a2b3141a97c1970cc1664014

Note: See TracTickets for help on using tickets.