SacBase / basic-demos

Simple sac programs
0 stars 2 forks source link

sac-from-c and quicksort will not compile, for several reasons #1

Open bernecky opened 3 years ago

bernecky commented 3 years ago

I just did a git clone(git submodule init; update...); cmake; make on this, and ran into several faults with sac-from-c and quicksort during the make, shown here:

[  8%] Building quicksort-seq sac program from /home/sac/sac/BASE/basic-demos/simple/quicksort.sac
make[2]: Leaving directory '/home/sac/sac/BASE/basic-demos/build'
[  8%] Built target prog-quicksort-seq-seq
make[2]: Entering directory '/home/sac/sac/BASE/basic-demos/build'
make[2]: Leaving directory '/home/sac/sac/BASE/basic-demos/build'
make[2]: Entering directory '/home/sac/sac/BASE/basic-demos/build'
[  9%] Building IntStack.sac module for target `seq'
In file included from /usr/local/include/sac2c/1.3.3-MijasCosta-572-g9eca/release/sac.h:50,
                 from /tmp/SAC_F0O3kS/header.h:278,
                 from /tmp/SAC_F0O3kS/fun1.c:1:
/tmp/SAC_F0O3kS/fun1.c: In function ‘SACf_IntStack_CL_INIT__init_Stack__SACt_IntStack__IntStack’:
/usr/local/include/sac2c/1.3.3-MijasCosta-572-g9eca/release/runtime/essentials_h/std.h:2084:11: warning: ‘SACp_emal_7327__OI_object__SSA0_1’ is used uninitialized in this function [-Wuninitialized]
 2084 |           = SAC_ND_GETVAR (from_NT, SAC_ND_A_FIELD (from_NT));                           \
      |           ^
In file included from /usr/local/include/sac2c/1.3.3-MijasCosta-572-g9eca/release/sac.h:39,
                 from /tmp/SAC_F0O3kS/header.h:278,
                 from /tmp/SAC_F0O3kS/fun1.c:1:
/tmp/SAC_F0O3kS/fun1.c:4089:25: note: ‘SACp_emal_7327__OI_object__SSA0_1’ was declared here
 4089 |     SAC_ND_DECL__DATA( (SACp_emal_7327__OI_object__SSA0_1, (AKS, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), int, )
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sac2c/1.3.3-MijasCosta-572-g9eca/release/runtime/essentials_h/icm.h:68:21: note: in definition of macro ‘Item0’
   68 | #define Item0(a, b) a
      |                     ^
/usr/local/include/sac2c/1.3.3-MijasCosta-572-g9eca/release/runtime/essentials_h/std.h:718:41: note: in expansion of macro ‘NT_NAME’
  718 | #define SAC_ND_A_FIELD__DEFAULT(var_NT) NT_NAME (var_NT)
      |                                         ^~~~~~~
/usr/local/include/sac2c/1.3.3-MijasCosta-572-g9eca/release/runtime/essentials_h/std_gen.h:618:30: note: in expansion of macro ‘SAC_ND_A_FIELD__DEFAULT’
  618 | #define SAC_ND_A_FIELD_(...) SAC_ND_A_FIELD__DEFAULT(__VA_ARGS__)
      |                              ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sac2c/1.3.3-MijasCosta-572-g9eca/release/runtime/essentials_h/std_gen.h:617:29: note: in expansion of macro ‘SAC_ND_A_FIELD_’
  617 | #define SAC_ND_A_FIELD(...) SAC_ND_A_FIELD_(__VA_ARGS__)
      |                             ^~~~~~~~~~~~~~~
/usr/local/include/sac2c/1.3.3-MijasCosta-572-g9eca/release/runtime/essentials_h/std.h:1175:47: note: in expansion of macro ‘SAC_ND_A_FIELD’
 1175 |     decoration SAC_ND_TYPE (var_NT, basetype) SAC_ND_A_FIELD (var_NT); /*                \
      |                                               ^~~~~~~~~~~~~~
/usr/local/include/sac2c/1.3.3-MijasCosta-572-g9eca/release/runtime/essentials_h/std.h:1169:5: note: in expansion of macro ‘SAC_ND_DECL__DATA_’
 1169 |     SAC_ND_DECL__DATA_##decoration (var_NT, basetype, decoration)
      |     ^~~~~~~~~~~~~~~~~~
/tmp/SAC_F0O3kS/fun1.c:4089:5: note: in expansion of macro ‘SAC_ND_DECL__DATA’
 4089 |     SAC_ND_DECL__DATA( (SACp_emal_7327__OI_object__SSA0_1, (AKS, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), int, )
      |     ^~~~~~~~~~~~~~~~~
/tmp/SAC_F0O3kS/fun1.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-gnu-zero-variadic-macro-arguments’ may have been intended to silence earlier diagnostics
make[2]: Leaving directory '/home/sac/sac/BASE/basic-demos/build'
[  9%] Built target module-IntStack-seq
make[2]: Entering directory '/home/sac/sac/BASE/basic-demos/build'
make[2]: Leaving directory '/home/sac/sac/BASE/basic-demos/build'
make[2]: Entering directory '/home/sac/sac/BASE/basic-demos/build'
[ 10%] Building use_IntStack-seq sac program from /home/sac/sac/BASE/basic-demos/states/use_IntStack.sac
make[2]: Leaving directory '/home/sac/sac/BASE/basic-demos/build'
[ 11%] Built target prog-use_IntStack-seq-seq
make[2]: Entering directory '/home/sac/sac/BASE/basic-demos/build'
make[2]: Leaving directory '/home/sac/sac/BASE/basic-demos/build'
make[2]: Entering directory '/home/sac/sac/BASE/basic-demos/build'
[ 13%] Building Sum.sac module for target `seq'
[ 14%] Building cwrapper for Sum.sac target `seq'
[ 15%] Building /home/sac/sac/BASE/basic-demos/sac_from_c/summarizer.c program for target `seq'
/usr/bin/ld: /tmp/ccM2eb8I.o: in function `main':
summarizer.c:(.text+0xa2): undefined reference to `SACARGconvertFromIntPointer'
/usr/bin/ld: summarizer.c:(.text+0xb9): undefined reference to `Sum__sum1'
/usr/bin/ld: summarizer.c:(.text+0xc5): undefined reference to `SACARGconvertToIntArray'
collect2: error: ld returned 1 exit status
make[2]: *** [sac_from_c-seq/CMakeFiles/prog-summarizer-seq.dir/build.make:64: sac_from_c-seq/summarizer] Error 1
make[2]: Leaving directory '/home/sac/sac/BASE/basic-demos/build'
make[1]: *** [CMakeFiles/Makefile2:572: sac_from_c-seq/CMakeFiles/prog-summarizer-seq.dir/all] Error 2
make[1]: Leaving directory '/home/sac/sac/BASE/basic-demos/build'
make: *** [Makefile:84: all] Error 2
bernecky commented 3 years ago

I have a fix for the sac_from_c linker problem. The fault has to do with different ways that various ld (*nix linker) tools treat -L and -l libraries, as briefly discussed here: https://stackoverflow.com/questions/7826448/linking-libraries-with-gcc-order-of-arguments I'll commit this fix shortly.

bernecky commented 3 years ago

Committed sac_from_c fix earlier today. The IntStack stuff is pointing to line 983 of:

/usr/local/include/sac2c/1.3.3-MijasCosta-581-g8d98d/debug/runtime/essentials_h/std.h

If the comments are to be believed:

This mirrors __DEFAULT for now (step-by-step introduction of bitarrays)

I'll leave that for the author of that code to repair.