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

Build fails with LLVM clang #102

Open
rouson opened this issue Apr 1, 2024 · 4 comments
Open

Build fails with LLVM clang #102

rouson opened this issue Apr 1, 2024 · 4 comments

Comments

@rouson
Copy link
Collaborator

rouson commented Apr 1, 2024

I'm running ./install.sh with the following compiler:

% clang --version
clang version 19.0.0git (git@github.com:llvm/llvm-project 325f51237252e6dab8e4e1ea1fa7acbb4faee1cd)
Target: arm64-apple-darwin23.3.0
Thread model: posix
InstalledDir: /Users/rouson/Repositories/llvm-project/build/bin

and with the flang-new and clang++ in the same path. The build fails with the error messages below:

** % ./install.sh 
PREFIX=/Users/rouson/.local/bin
PKG_CONFIG_PATH=/Users/rouson/.local/bin/lib/pkgconfig
Initialized empty Git repository in /Users/rouson/Repositories/caffeine/build/dependencies/veggies/.git/
warning: redirecting to https://gitlab.com/everythingfunctional/veggies.git/
remote: Enumerating objects: 120, done.
remote: Counting objects: 100% (120/120), done.
remote: Compressing objects: 100% (101/101), done.
remote: Total 120 (delta 55), reused 36 (delta 15), pack-reused 0
Receiving objects: 100% (120/120), 104.81 KiB | 20.96 MiB/s, done.
Resolving deltas: 100% (55/55), done.
From https://gitlab.com/everythingfunctional/veggies
 * tag               v1.0.5     -> FETCH_HEAD
Initialized empty Git repository in /Users/rouson/Repositories/caffeine/build/dependencies/iso_varying_string/.git/
remote: Enumerating objects: 77, done.
remote: Counting objects: 100% (77/77), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 77 (delta 33), reused 50 (delta 24), pack-reused 0
Unpacking objects: 100% (77/77), 35.68 KiB | 410.00 KiB/s, done.
From https://gitlab.com/everythingfunctional/iso_varying_string
 * tag               v3.0.4     -> FETCH_HEAD
Initialized empty Git repository in /Users/rouson/Repositories/caffeine/build/dependencies/strff/.git/
remote: Enumerating objects: 31, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 31 (delta 6), reused 22 (delta 2), pack-reused 0
Unpacking objects: 100% (31/31), 19.44 KiB | 485.00 KiB/s, done.
From https://gitlab.com/everythingfunctional/strff
 * tag               v3.1.1     -> FETCH_HEAD
prif.f90                               done.
program_termination.c                  done.
caffeine_h_m.f90                       done.
utilities_m.f90                        done.
caffeine.c                             failed.
[ 12%] Compiling...
././src/caffeine/caffeine.c:73:7: error: call to undeclared function 'caf_this_image'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   73 |   if (caf_this_image(myworldteam) == 1) {
      |       ^
././src/caffeine/caffeine.c:74:47: error: incompatible integer to pointer conversion passing 'intptr_t' (aka 'long') to parameter of type 'void *' [-Wint-conversion]
   74 |     *symmetric_heap = create_mspace_with_base(*symmetric_heap_start, symmetric_heap_size, 0);
      |                                               ^~~~~~~~~~~~~~~~~~~~~
././src/caffeine/../dlmalloc/dl_malloc.h:564:38: note: passing argument to parameter 'base' here
  564 | mspace create_mspace_with_base(void* base, size_t capacity, int locked);
      |                                      ^
././src/caffeine/caffeine.c:77:49: error: incompatible integer to pointer conversion passing 'intptr_t' (aka 'long') to parameter of type 'void *' [-Wint-conversion]
   77 |   *non_symmetric_heap = create_mspace_with_base(non_symmetric_heap_start, non_symmetric_heap_size, 0);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~
././src/caffeine/../dlmalloc/dl_malloc.h:564:38: note: passing argument to parameter 'base' here
  564 | mspace create_mspace_with_base(void* base, size_t capacity, int locked);
      |                                      ^
././src/caffeine/caffeine.c:142:103: warning: incompatible pointer types passing 'gex_Coll_ReduceFn_t *' (aka 'void (**)(const void *, void *, unsigned long, const void *)') to parameter of type 'gex_Coll_ReduceFn_t' (aka 'void (*)(const void *, void *, unsigned long, const void *)'); dereference with * [-Wincompatible-pointer-types]
  142 |       team, result_image-1, a_address, a_address, GEX_DT_USER, c_sizeof_a, num_elements, GEX_OP_USER, user_op, &c_sizeof_a, 0
      |                                                                                                       ^~~~~~~
      |                                                                                                       *
/Users/rouson/.local/bin/include/gasnet_coll.h:400:60: note: expanded from macro 'gex_Coll_ReduceToOneNB'
  400 |         gasnete_tm_reduce_nb(tm,root,dst,src,dt,dts,dtc,op,fn,cdata,flags,0 GASNETI_THREAD_GET)
      |                                                            ^~
/Users/rouson/.local/bin/include/gasnet_coll.h:396:58: note: passing argument to parameter '_user_op' here
  396 |                        gex_OP_t _op, gex_Coll_ReduceFn_t _user_op, void * _user_cdata,
      |                                                          ^
././src/caffeine/caffeine.c:146:103: warning: incompatible pointer types passing 'gex_Coll_ReduceFn_t *' (aka 'void (**)(const void *, void *, unsigned long, const void *)') to parameter of type 'gex_Coll_ReduceFn_t' (aka 'void (*)(const void *, void *, unsigned long, const void *)'); dereference with * [-Wincompatible-pointer-types]
  146 |       team,                 a_address, a_address, GEX_DT_USER, c_sizeof_a, num_elements, GEX_OP_USER, user_op, &c_sizeof_a, 0
      |                                                                                                       ^~~~~~~
      |                                                                                                       *
/Users/rouson/.local/bin/include/gasnet_coll.h:413:59: note: expanded from macro 'gex_Coll_ReduceToAllNB'
  413 |         gasnete_tm_reduce_all_nb(tm,dst,src,dt,dts,dtc,op,fn,cdata,flags,0 GASNETI_THREAD_GET)
      |                                                           ^~
/Users/rouson/.local/bin/include/gasnet_coll.h:409:59: note: passing argument to parameter '_user_op' here
  409 |                         gex_OP_t _op, gex_Coll_ReduceFn_t _user_op, void * _user_cdata,
      |                                                           ^
././src/caffeine/caffeine.c:178:14: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
  178 |       errmsg = return_message;
      |              ^ ~~~~~~~~~~~~~~
././src/caffeine/caffeine.c:259:10: warning: overflow converting case value to switch condition type (4100 to 4) [-Wswitch]
  259 |     case double_Complex_workaround: a_type = GEX_DT_DBL; num_elements *= 2; c_sizeof_a /= 2; break;
      |          ^
././src/caffeine/caffeine.c:258:10: warning: overflow converting case value to switch condition type (2052 to 4) [-Wswitch]
  258 |     case float_Complex_workaround:  a_type = GEX_DT_FLT; num_elements *= 2; c_sizeof_a /= 2; break;
      |          ^
././src/caffeine/caffeine.c:298:10: warning: overflow converting case value to switch condition type (4100 to 4) [-Wswitch]
  298 |     case double_Complex_workaround: return true;
      |          ^
././src/caffeine/caffeine.c:297:10: warning: overflow converting case value to switch condition type (2052 to 4) [-Wswitch]
  297 |     case float_Complex_workaround:  return true;
      |          ^
7 warnings and 3 errors generated.
<ERROR> Compilation failed for object " src_caffeine_caffeine.c.o "
<ERROR> stopping due to failed compilation
STOP 1
**
@bonachea
Copy link
Member

bonachea commented Apr 1, 2024

This looks like an example of a defect predicted by issue #70

Specifically gcc defaults to more permissive behavior than clang, resulting in warnings and errors when compiling with the latter.

@rouson
Copy link
Collaborator Author

rouson commented Apr 1, 2024

@bonachea so possibly my initial comment in this issue should be moved to #70 and this one closed or maybe we keep this one open as a LLVM clang-specific issue. The other issue could be our catch-all issue tied to the specific ones by hash-tag links.

@bonachea
Copy link
Member

bonachea commented Apr 1, 2024

I'm not saying you should close this issue, which indicates a real defect in our clang support.

This just adds motivation for resolving issue #70 by adding some CI that exercises LLVM (which will fail until we fix the current issue).

@ktras
Copy link
Collaborator

ktras commented Apr 3, 2024

Also related to issue #74.

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

No branches or pull requests

3 participants