stephenrkell / libcrunch

A dynamically safe implementation of C, using your existing C compiler. Tolerates idiomatic C code pretty well. Not perfect... yet.
100 stars 4 forks source link

Build failure of libcrunch #8

Open HiragiChi opened 1 year ago

HiragiChi commented 1 year ago

Hi, I am trying to build libcrunch from a pre-built liballocs. The environment is a docker image built from /liballocs/buildtest/ubuntu-18.04/DockerFile

When I try to build libcrunch, the following problem emerges:

/usr/bin/ld.gold: error: /usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/lib/librunt.a(librunt.o): requires dynamic R_X86_64_PC32 reloc against 'orig_dlopen' which may overflow at runtime; recompile with -fPIC

But when I inspect the MakeFile of librunt.o in /src/Makefile of the librunt repo, I found that -fPIC is actually enabled when compiling librunt.o. (I also double check in the build log of librunt, -fPIC is truly enabled).

Here is what I have tried: 1) Follow the instruction in /libcrunch/buildtest/ubuntu-18.04/Dockerfile and revert all the repo version before Feb 2021 to apply diff file. Some build problem still exists

2)build the whole liballocs from scratch in Docker and tried again, same problem occurs.

The whole build log of libcrunch can be found here

` make -C src
make[1]: Entering directory '/usr/local/src/libcrunch/src'
LIBALLOCS is /usr/local/src/liballocs
cc  -fPIC -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/include -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/  -c -o libcrunch.o libcrunch.c
In file included from libcrunch_private.h:10:0,
                 from libcrunch.c:28:
/usr/local/src/liballocs/include/generic_malloc_index.h: In function '__generic_malloc_get_info':
/usr/local/src/liballocs/include/generic_malloc_index.h:664:35: warning: implicit declaration of function '__liballocs_extract_and_output_alloc_site_and_type'; did you mean 'extract_and_output_alloc_site_and_type'? [-Wimplicit-function-declaration]
  if (out_type || out_site) return __liballocs_extract_and_output_alloc_site_and_type(
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   extract_and_output_alloc_site_and_type
/usr/local/src/liballocs/include/generic_malloc_index.h:664:35: warning: return makes pointer from integer without a cast [-Wint-conversion]
  if (out_type || out_site) return __liballocs_extract_and_output_alloc_site_and_type(
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   heap_info, out_type, (void**) out_site);
libcrunch.c: In function '__is_a_internal':
libcrunch.c:1149:24: warning: implicit declaration of function '__liballocs_get_insert'; did you mean '__liballocs_get_info'? [-Wimplicit-function-declaration]
   struct insert *ins = __liballocs_get_insert(NULL, obj);
                        ^~~~~~~~~~~~~~~~~~~~~~
                        __liballocs_get_info
libcrunch.c:1149:24: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
libcrunch.c: In function 'reinstate_looseness_if_necessary':
libcrunch.c:1707:24: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
   struct insert *ins = __liballocs_get_insert(NULL, alloc_start);
                        ^~~~~~~~~~~~~~~~~~~~~~
libcrunch.c: In function '__fetch_bounds_internal':
libcrunch.c:2449:0: warning: "MIN" redefined
 #define MIN(x, y) (((x) < (y)) ? (x) : (y))

In file included from libcrunch_private.h:11:0,
                 from libcrunch.c:28:
/usr/local/src/liballocs/src/liballocs_private.h:216:0: note: this is the location of the previous definition
 #define MIN(a, b) ((a)<(b)?(a):(b))

libcrunch.c:2450:0: warning: "MAX" redefined
 #define MAX(x, y) (((x) < (y)) ? (y) : (x))

In file included from libcrunch_private.h:11:0,
                 from libcrunch.c:28:
/usr/local/src/liballocs/src/liballocs_private.h:219:0: note: this is the location of the previous definition
 #define MAX(a, b) ((a)>(b)?(a):(b))

In file included from ../include/libcrunch.h:48:0,
                 from libcrunch.c:27:
libcrunch.c: At top level:
../include/libcrunch_cil_inlines.h:1437:4: warning: 'warnx_pure' is static but used in inline function '__fetch_bounds_from_shadow_space' which is not static
    warnx_pure("Fetched invalid bounds for %p (loaded from %p)", ptr, loaded_from);
    ^~~~~~~~~~
../include/libcrunch_cil_inlines.h:1138:4: warning: 'warnx_pure' is static but used in inline function '__secondary_check_derive_ptr' which is not static
    warnx_pure("Went back in bounds at %p: %p (base %p, size %lu)",
    ^~~~~~~~~~
cc  -fPIC -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -DHAVE_MORECORE=0 -DUSE_DL_PREFIX -fPIC -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/include -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/  -c -o dlmalloc.o /usr/local/src/liballocs/contrib/libsystrap/contrib/dlmalloc.c
ar r "dlmalloc.a" dlmalloc.o
cc  -fPIC -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -shared -o "libcrunch_preload.so" libcrunch.o /usr/local/src/liballocs/lib/liballocs_systrap.o /usr/local/src/liballocs/contrib/libsystrap/lib/libsystrap.a \
-L/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/.libs -Wl,-rpath,/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/.libs -L/usr/local/src/liballocs/lib -L/usr/local/src/liballocs/libsystrap -fno-lto -Wl,-fuse-ld=gold -Wl,--defsym,__libcrunch_bounds_abi_md5sum=0x1ac99f221bc4fc9c -O4 -fno-lto -Bsymbolic -Wl,-O2 -Wl,--wrap,malloc_usable_size -Wl,--wrap,__notify_copy -Wl,--wrap,dlmalloc -Wl,--wrap,dlcalloc -Wl,--wrap,dlfree -Wl,--wrap,dlrealloc -Wl,--wrap,dlmemalign -Wl,--wrap,dlposix_memalign -Wl,--whole-archive dlmalloc.a  -Wl,--no-whole-archive -Wl,--defsym,__private_malloc=__wrap_dlmalloc -Wl,--defsym,__private_calloc=__wrap_dlcalloc -Wl,--defsym,__private_free=__wrap_dlfree -Wl,--defsym,__private_realloc=__wrap_dlrealloc -Wl,--defsym,__private_memalign=__wrap_dlmemalign -Wl,--defsym,__private_posix_memalign=__wrap_dlposix_memalign -Wl,--exclude-libs=dlmalloc.a -Bsymbolic  -Wl,--wrap,__runt_files_notify_load -Wl,--wrap,__runt_files_notify_unload -Wl,--wrap,__runt_files_metadata_by_addr -Wl,--wrap,__runt_segments_notify_define_segment -Wl,--wrap,__runt_segments_notify_destroy_segment -Wl,--wrap,__runt_sections_notify_define_section  -Wl,-O0 -L/usr/local/src/liballocs/contrib/libdlbind/lib /usr/local/src/liballocs/lib/liballocs_preload.a \
-Wl,--no-whole-archive -Wl,-Bdynamic \
-L/usr/local/src/liballocs/contrib/libsystrap/lib -lsystrap -lz -Wl,--no-as-needed -ldl -Wl,--whole-archive /usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/lib/librunt_preload.a -Wl,--no-whole-archive -lunwind -lunwind-x86_64 -ldlbind -ldl
ar r "libcrunch_preload.a" libcrunch.o /usr/local/src/liballocs/lib/liballocs_preload.a
cc  -fPIC -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -fPIC  -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/include -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/  -c -o stubs.o stubs.c
In file included from libcrunch_private.h:10:0,
                 from stubs.c:5:
/usr/local/src/liballocs/include/generic_malloc_index.h: In function '__generic_malloc_get_info':
/usr/local/src/liballocs/include/generic_malloc_index.h:664:35: warning: implicit declaration of function '__liballocs_extract_and_output_alloc_site_and_type'; did you mean 'extract_and_output_alloc_site_and_type'? [-Wimplicit-function-declaration]
  if (out_type || out_site) return __liballocs_extract_and_output_alloc_site_and_type(
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   extract_and_output_alloc_site_and_type
/usr/local/src/liballocs/include/generic_malloc_index.h:664:35: warning: return makes pointer from integer without a cast [-Wint-conversion]
  if (out_type || out_site) return __liballocs_extract_and_output_alloc_site_and_type(
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   heap_info, out_type, (void**) out_site);
In file included from ../include/libcrunch.h:48:0,
                 from libcrunch_private.h:15,
                 from stubs.c:5:
stubs.c: At top level:
../include/libcrunch_cil_inlines.h:1437:4: warning: 'warnx_pure' is static but used in inline function '__fetch_bounds_from_shadow_space' which is not static
    warnx_pure("Fetched invalid bounds for %p (loaded from %p)", ptr, loaded_from);
    ^~~~~~~~~~
../include/libcrunch_cil_inlines.h:1138:4: warning: 'warnx_pure' is static but used in inline function '__secondary_check_derive_ptr' which is not static
    warnx_pure("Went back in bounds at %p: %p (base %p, size %lu)",
    ^~~~~~~~~~
cc  -fPIC -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/include -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/  -c -o shadow.o shadow.c
In file included from libcrunch_private.h:10:0,
                 from shadow.c:22:
/usr/local/src/liballocs/include/generic_malloc_index.h: In function '__generic_malloc_get_info':
/usr/local/src/liballocs/include/generic_malloc_index.h:664:35: warning: implicit declaration of function '__liballocs_extract_and_output_alloc_site_and_type'; did you mean 'extract_and_output_alloc_site_and_type'? [-Wimplicit-function-declaration]
  if (out_type || out_site) return __liballocs_extract_and_output_alloc_site_and_type(
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   extract_and_output_alloc_site_and_type
/usr/local/src/liballocs/include/generic_malloc_index.h:664:35: warning: return makes pointer from integer without a cast [-Wint-conversion]
  if (out_type || out_site) return __liballocs_extract_and_output_alloc_site_and_type(
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   heap_info, out_type, (void**) out_site);
shadow.c: In function 'check_maps_cb':
shadow.c:74:9: warning: implicit declaration of function 'raw_write'; did you mean 'fwrite'? [-Wimplicit-function-declaration]
  else { raw_write(2, "bad mapping address\n", sizeof "bad mapping address\n" - 1); abort(); }
         ^~~~~~~~~
         fwrite
shadow.c: In function 'init_shadow_entries':
shadow.c:333:41: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  *BASE_STORED((void**) __ctype_b_loc()) = *__ctype_b_loc();
                                         ^
shadow.c:335:47: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  *BASE_STORED((void**) __ctype_toupper_loc()) = *__ctype_toupper_loc();
                                               ^
shadow.c:337:47: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  *BASE_STORED((void**) __ctype_tolower_loc()) = *__ctype_tolower_loc();
                                               ^
In file included from ../include/libcrunch.h:48:0,
                 from shadow.c:21:
shadow.c: At top level:
../include/libcrunch_cil_inlines.h:1437:4: warning: 'warnx_pure' is static but used in inline function '__fetch_bounds_from_shadow_space' which is not static
    warnx_pure("Fetched invalid bounds for %p (loaded from %p)", ptr, loaded_from);
    ^~~~~~~~~~
../include/libcrunch_cil_inlines.h:1138:4: warning: 'warnx_pure' is static but used in inline function '__secondary_check_derive_ptr' which is not static
    warnx_pure("Went back in bounds at %p: %p (base %p, size %lu)",
    ^~~~~~~~~~
In file included from shadow.c:17:0:
/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include/maps.h: In function 'process_one_maps_entry':
/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include/maps.h:266:3: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
   write(2, linebuf, strlen(linebuf)+1);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc  -fPIC -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -Wl,-Map,libcrunch_stubs.so.map -shared -o "libcrunch_stubs.so" stubs.o shadow.o /usr/local/src/liballocs/lib/liballocs_dummyweaks.o /usr/local/src/liballocs/lib/liballocs_systrap.o /usr/local/src/liballocs/contrib/libsystrap/lib/libsystrap.a /usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/lib/librunt.a -L/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/.libs -Wl,-rpath,/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/.libs -L/usr/local/src/liballocs/lib -L/usr/local/src/liballocs/libsystrap -fno-lto -Wl,-fuse-ld=gold -Wl,--whole-archive dlmalloc.a  -Wl,--no-whole-archive -Wl,--defsym,__private_malloc=dlmalloc -Wl,--defsym,__private_calloc=dlcalloc -Wl,--defsym,__private_free=dlfree -Wl,--defsym,__private_realloc=dlrealloc -Wl,--defsym,__private_memalign=dlmemalign -Wl,--defsym,__private_posix_memalign=dlposix_memalign -Wl,--exclude-libs=dlmalloc.a -Bsymbolic  -Wl,--defsym,__wrap___runt_files_notify_load=__runt_files_notify_load -Wl,--defsym,__wrap___runt_files_notify_unload=__runt_files_notify_unload -Wl,--defsym,__wrap___runt_files_metadata_by_addr=__runt_files_metadata_by_addr -Wl,--defsym,__wrap___runt_segments_notify_define_segment=__runt_segments_notify_define_segment -Wl,--defsym,__wrap___runt_segments_notify_destroy_segment=__runt_segments_notify_destroy_segment -Wl,--defsym,__wrap___runt_sections_notify_define_section=__runt_sections_notify_define_section  -L/usr/local/src/liballocs/contrib/libdlbind/lib /usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/lib/librunt.a -lunwind -lunwind-x86_64 -ldlbind -ldl -lz -Wl,--wrap,__liballocs_nudge_mmap -ldlbind
/usr/bin/ld.gold: error: /usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/lib/librunt.a(librunt.o): requires dynamic R_X86_64_PC32 reloc against 'orig_dlopen' which may overflow at runtime; recompile with -fPIC
/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/src/..//src/librunt.c:296: error: undefined reference to 'orig_dlopen'
/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/src/..//src/librunt.c:298: error: undefined reference to 'orig_dlopen'
collect2: error: ld returned 1 exit status
Makefile:182: recipe for target 'libcrunch_stubs.so' failed
make[1]: *** [libcrunch_stubs.so] Error 1
make[1]: Leaving directory '/usr/local/src/libcrunch/src'
Makefile:5: recipe for target 'src' failed
make: *** [src] Error 2 `
stephenrkell commented 1 year ago

Hi Hiragi. Thank you for your interest. The rough answer is that there is now some version skew between liballocs and libcrunch since I haven't forward-ported the latter to reflect API changes etc. It looks like this is what you're running in to. It's on my to-do list to create a proper submodule set-up so that this no longer happens. However, it is not currently done.

You have the right idea in reverting to an older revision. Did you try an older revision of liballocs? If you pick the revision dated immediately prior to libcrunch head, it should work.

I'll get some time to look at this more closely soon. Sorry for the unsatisfactory situation right now.

HiragiChi commented 1 year ago

Thanks for the reply! I will give it a try tomorrow~

On Wed, Aug 23, 2023, 11:14 Stephen Kell @.***> wrote:

Hi Hiragi. Thank you for your interest. The rough answer is that there is now some version skew between liballocs and libcrunch since I haven't forward-ported the latter to reflect API changes etc. It looks like this is what you're running in to. It's on my to-do list to create a proper submodule set-up so that this no longer happens. However, it is not currently done.

You have the right idea in reverting to an older revision. Did you try an older revision of liballocs? If you pick the revision dated immediately prior to libcrunch head, it should work.

I'll get some time to look at this more closely soon. Sorry for the unsatisfactory situation right now.

— Reply to this email directly, view it on GitHub https://github.com/stephenrkell/libcrunch/issues/8#issuecomment-1690249143, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO2H75FP64GLHUTFDXMVAFDXWYT63ANCNFSM6AAAAAA3Y7USQI . You are receiving this because you authored the thread.Message ID: @.***>

HiragiChi commented 1 year ago

Hi Kell, I have tried to compile libcrunch with Feb 25th version of liballocs but I still met some problems. Roughly I did the following things: 1) Install the liballocs docker image, clone the Feb 25th version of liballocs (aecda0ba85e469045eae36a2ce09f86cfc53654c) and make it from scratch.

2)Try making libcrunch, I found that CFLAGS and LDFLAGS in src/Makefile are not complete and add -I$(LIBALLOCS)/build/opt to CFLAGS to complete the compilation.

However the problem still exists when making the src repo:
`ocamlfind ocamlopt -o "trumptr/trumptr.cmx"  -package findlib -I /usr/local/src/liballocs/contrib/cil/lib/lib/cil -I .//lib -I /usr/local/src/liballocs/tools/lang/c/cilallocs  -g -c "trumptr/trumptr.ml"
File "trumptr/trumptr.ml", line 41, characters 5-8:
Error: Unbound module Cil`

I don't know why this happens, as I have moved to the previous branch of liballocs while that should work.

The whole build log is attached as follows:

make -C src
make[1]: Entering directory '/usr/local/src/libcrunch/src'
LIBALLOCS is /usr/local/src/liballocs
cc -MM  -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -I/usr/local/src/liballocs/build/opt -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND "shadow.c"  > ".shadow.d" || (rm -f ".shadow.d"; false)
cc -MM  -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -I/usr/local/src/liballocs/build/opt -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND "libcrunch.c"  > ".libcrunch.d" || (rm -f ".libcrunch.d"; false)
cc -MM  -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -I/usr/local/src/liballocs/build/opt -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND "stubs.c"  > ".stubs.d" || (rm -f ".stubs.d"; false)
cc -MM  -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -I/usr/local/src/liballocs/build/opt -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND "softbound-libc-wrappers.c"  > ".softbound-libc-wrappers.d" || (rm -f ".softbound-libc-wrappers.d"; false)
LIBALLOCS is /usr/local/src/liballocs
cc  -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -I/usr/local/src/liballocs/build/opt -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/include -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/  -c -o libcrunch.o libcrunch.c
libcrunch.c: In function '__is_a_internal':
libcrunch.c:1149:24: warning: implicit declaration of function '__liballocs_get_insert'; did you mean '__liballocs_index_insert'? [-Wimplicit-function-declaration]
   struct insert *ins = __liballocs_get_insert(NULL, obj);
                        ^~~~~~~~~~~~~~~~~~~~~~
                        __liballocs_index_insert
libcrunch.c:1149:24: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
libcrunch.c: In function 'reinstate_looseness_if_necessary':
libcrunch.c:1707:24: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
   struct insert *ins = __liballocs_get_insert(NULL, alloc_start);
                        ^~~~~~~~~~~~~~~~~~~~~~
In file included from ../include/libcrunch.h:48:0,
                 from libcrunch.c:27:
libcrunch.c: At top level:
../include/libcrunch_cil_inlines.h:1437:4: warning: 'warnx_pure' is static but used in inline function '__fetch_bounds_from_shadow_space' which is not static
    warnx_pure("Fetched invalid bounds for %p (loaded from %p)", ptr, loaded_from);
    ^~~~~~~~~~
../include/libcrunch_cil_inlines.h:1138:4: warning: 'warnx_pure' is static but used in inline function '__secondary_check_derive_ptr' which is not static
    warnx_pure("Went back in bounds at %p: %p (base %p, size %lu)",
    ^~~~~~~~~~
cc  -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -I/usr/local/src/liballocs/build/opt -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -DHAVE_MORECORE=0 -DUSE_DL_PREFIX -fPIC -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/include -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/  -c -o dlmalloc.o /usr/local/src/liballocs/contrib/libsystrap/contrib/dlmalloc.c
ar r "dlmalloc.a" dlmalloc.o
ar: creating dlmalloc.a
cc  -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -I/usr/local/src/liballocs/build/opt -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -shared -o "libcrunch_preload.so" libcrunch.o /usr/local/src/liballocs/lib/liballocs_systrap.o /usr/local/src/liballocs/contrib/libsystrap/lib/libsystrap.a \
-L/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/.libs -Wl,-rpath,/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/.libs -L/usr/local/src/liballocs/lib -L/usr/local/src/liballocs/libsystrap -fno-lto -L/usr/local/src/liballocs/build/opt -Wl,-fuse-ld=gold -Wl,--defsym,__libcrunch_bounds_abi_md5sum=0x1ac99f221bc4fc9c -O4 -fno-lto -Bsymbolic -Wl,-O2 -Wl,--wrap,malloc_usable_size -Wl,--wrap,__notify_copy -Wl,--wrap,dlmalloc -Wl,--wrap,dlcalloc -Wl,--wrap,dlfree -Wl,--wrap,dlrealloc -Wl,--wrap,dlmemalign -Wl,--wrap,dlposix_memalign -Wl,--whole-archive dlmalloc.a  -Wl,--no-whole-archive -Wl,--defsym,__private_malloc=__wrap_dlmalloc -Wl,--defsym,__private_calloc=__wrap_dlcalloc -Wl,--defsym,__private_free=__wrap_dlfree -Wl,--defsym,__private_realloc=__wrap_dlrealloc -Wl,--defsym,__private_memalign=__wrap_dlmemalign -Wl,--defsym,__private_posix_memalign=__wrap_dlposix_memalign -Wl,--exclude-libs=dlmalloc.a -Bsymbolic  -Wl,--wrap,__runt_files_notify_load -Wl,--wrap,__runt_files_notify_unload -Wl,--wrap,__runt_files_metadata_by_addr -Wl,--wrap,__runt_segments_notify_define_segment -Wl,--wrap,__runt_segments_notify_destroy_segment -Wl,--wrap,__runt_sections_notify_define_section  -Wl,-O0 -L/usr/local/src/liballocs/contrib/libdlbind/lib /usr/local/src/liballocs/lib/liballocs_preload.a \
-Wl,--no-whole-archive -Wl,-Bdynamic \
-L/usr/local/src/liballocs/contrib/libsystrap/lib -lsystrap -lz -Wl,--no-as-needed -ldl -Wl,--whole-archive /usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/lib/librunt_preload.a -Wl,--no-whole-archive -lunwind -lunwind-x86_64 -ldlbind -ldl
ar r "libcrunch_preload.a" libcrunch.o /usr/local/src/liballocs/lib/liballocs_preload.a
ar: creating libcrunch_preload.a
cc  -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -I/usr/local/src/liballocs/build/opt -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -fPIC  -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/include -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/  -c -o stubs.o stubs.c
In file included from ../include/libcrunch.h:48:0,
                 from libcrunch_private.h:15,
                 from stubs.c:5:
../include/libcrunch_cil_inlines.h:1437:4: warning: 'warnx_pure' is static but used in inline function '__fetch_bounds_from_shadow_space' which is not static
    warnx_pure("Fetched invalid bounds for %p (loaded from %p)", ptr, loaded_from);
    ^~~~~~~~~~
../include/libcrunch_cil_inlines.h:1138:4: warning: 'warnx_pure' is static but used in inline function '__secondary_check_derive_ptr' which is not static
    warnx_pure("Went back in bounds at %p: %p (base %p, size %lu)",
    ^~~~~~~~~~
cc  -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -I/usr/local/src/liballocs/build/opt -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/include -I/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/  -c -o shadow.o shadow.c
shadow.c: In function 'check_maps_cb':
shadow.c:74:9: warning: implicit declaration of function 'raw_write'; did you mean 'fwrite'? [-Wimplicit-function-declaration]
  else { raw_write(2, "bad mapping address\n", sizeof "bad mapping address\n" - 1); abort(); }
         ^~~~~~~~~
         fwrite
shadow.c: In function 'init_shadow_entries':
shadow.c:333:41: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  *BASE_STORED((void**) __ctype_b_loc()) = *__ctype_b_loc();
                                         ^
shadow.c:335:47: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  *BASE_STORED((void**) __ctype_toupper_loc()) = *__ctype_toupper_loc();
                                               ^
shadow.c:337:47: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  *BASE_STORED((void**) __ctype_tolower_loc()) = *__ctype_tolower_loc();
                                               ^
In file included from ../include/libcrunch.h:48:0,
                 from shadow.c:21:
shadow.c: At top level:
../include/libcrunch_cil_inlines.h:1437:4: warning: 'warnx_pure' is static but used in inline function '__fetch_bounds_from_shadow_space' which is not static
    warnx_pure("Fetched invalid bounds for %p (loaded from %p)", ptr, loaded_from);
    ^~~~~~~~~~
../include/libcrunch_cil_inlines.h:1138:4: warning: 'warnx_pure' is static but used in inline function '__secondary_check_derive_ptr' which is not static
    warnx_pure("Went back in bounds at %p: %p (base %p, size %lu)",
    ^~~~~~~~~~
In file included from shadow.c:17:0:
/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include/maps.h: In function 'process_one_maps_entry':
/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include/maps.h:266:3: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
   write(2, linebuf, strlen(linebuf)+1);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc  -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -I/usr/local/src/liballocs/build/opt -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -Wl,-Map,libcrunch_stubs.so.map -shared -o "libcrunch_stubs.so" stubs.o shadow.o /usr/local/src/liballocs/lib/liballocs_dummyweaks.o /usr/local/src/liballocs/lib/liballocs_systrap.o /usr/local/src/liballocs/contrib/libsystrap/lib/libsystrap.a /usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/lib/librunt.a -L/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/.libs -Wl,-rpath,/usr/local/src/liballocs/contrib/liballocstool/contrib/dwarfidl/contrib/libantlr3c/.libs -L/usr/local/src/liballocs/lib -L/usr/local/src/liballocs/libsystrap -fno-lto -L/usr/local/src/liballocs/build/opt -Wl,-fuse-ld=gold -Wl,--whole-archive dlmalloc.a  -Wl,--no-whole-archive -Wl,--defsym,__private_malloc=dlmalloc -Wl,--defsym,__private_calloc=dlcalloc -Wl,--defsym,__private_free=dlfree -Wl,--defsym,__private_realloc=dlrealloc -Wl,--defsym,__private_memalign=dlmemalign -Wl,--defsym,__private_posix_memalign=dlposix_memalign -Wl,--exclude-libs=dlmalloc.a -Bsymbolic  -Wl,--defsym,__wrap___runt_files_notify_load=__runt_files_notify_load -Wl,--defsym,__wrap___runt_files_notify_unload=__runt_files_notify_unload -Wl,--defsym,__wrap___runt_files_metadata_by_addr=__runt_files_metadata_by_addr -Wl,--defsym,__wrap___runt_segments_notify_define_segment=__runt_segments_notify_define_segment -Wl,--defsym,__wrap___runt_segments_notify_destroy_segment=__runt_segments_notify_destroy_segment -Wl,--defsym,__wrap___runt_sections_notify_define_section=__runt_sections_notify_define_section  -L/usr/local/src/liballocs/contrib/libdlbind/lib /usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/lib/librunt.a -lunwind -lunwind-x86_64 -ldlbind -ldl -lz -Wl,--wrap,__liballocs_nudge_mmap -ldlbind
ld -r -o "libcrunch_stubs.o" stubs.o shadow.o /usr/local/src/liballocs/lib/liballocs_dummyweaks.o /usr/local/src/liballocs/lib/liballocs_systrap.o /usr/local/src/liballocs/contrib/libsystrap/lib/libsystrap.a --wrap __liballocs_nudge_mmap
cc  -o "libcrunch_wrappers.o"  -DLIBCRUNCH_LONG_SIZE -DLIBCRUNCH_NO_DENORM_BOUNDS  -I/usr/local/src/liballocs/include -I/usr/local/src/liballocs/src -I/usr/local/src/liballocs/contrib/libsystrap/include -I/usr/local/src/liballocs/contrib/libsystrap/contrib/librunt/include -I/usr/local/src/liballocs/contrib/libdlbind/include -I/usr/local/src/liballocs/contrib/liballocstool/include -I/usr/local/src/liballocs/build/opt -std=gnu99 -g -fPIC -I../include -O3 -fno-lto -ffat-lto-objects -DNDEBUG -DUSE_REAL_LIBUNWIND -c "softbound-libc-wrappers.c"
In file included from ../include/libcrunch.h:48:0,
                 from libcrunch_private.h:15,
                 from softbound-libc-wrappers.c:9:
../include/libcrunch_cil_inlines.h:1437:4: warning: 'warnx_pure' is static but used in inline function '__fetch_bounds_from_shadow_space' which is not static
    warnx_pure("Fetched invalid bounds for %p (loaded from %p)", ptr, loaded_from);
    ^~~~~~~~~~
../include/libcrunch_cil_inlines.h:1138:4: warning: 'warnx_pure' is static but used in inline function '__secondary_check_derive_ptr' which is not static
    warnx_pure("Went back in bounds at %p: %p (base %p, size %lu)",
    ^~~~~~~~~~
make[1]: Leaving directory '/usr/local/src/libcrunch/src'
make -C lib
make[1]: Entering directory '/usr/local/src/libcrunch/lib'
ln -sf ../src/libcrunch.so ../src/libcrunch_stubs.so ../src/libcrunch_preload.so ../src/libcrunch_preload.a . 
ln -sf ../src/libcrunch_stubs.o libcrunch_stubs.o
ln -sf ../src/libcrunch_wrappers.o libcrunch_wrappers.o
nm --format=posix libcrunch_wrappers.o | grep __wrap_ | \
        sed -r 's/__wrap_([^[:blank:]]*).*/--wrap \1/' > "wrap.ldopts" \
        || (rm -f "wrap.ldopts"; false)
make[1]: Leaving directory '/usr/local/src/libcrunch/lib'
make -C frontend
make[1]: Entering directory '/usr/local/src/libcrunch/frontend'
make -C c
make[2]: Entering directory '/usr/local/src/libcrunch/frontend/c'
LIBALLOCS is /usr/local/src/liballocs
make -C src
make[3]: Entering directory '/usr/local/src/libcrunch/frontend/c/src'
make[3]: Nothing to be done for 'default'.
make[3]: Leaving directory '/usr/local/src/libcrunch/frontend/c/src'
ocamlfind ocamlopt -o "trumptr/trumptr.cmx"  -package findlib -I /usr/local/src/liballocs/contrib/cil/lib/lib/cil -I .//lib -I /usr/local/src/liballocs/tools/lang/c/cilallocs  -g -c "trumptr/trumptr.ml"
File "trumptr/trumptr.ml", line 41, characters 5-8:
Error: Unbound module Cil
Makefile:40: recipe for target 'trumptr/trumptr.cmx' failed
make[2]: *** [trumptr/trumptr.cmx] Error 2
make[2]: Leaving directory '/usr/local/src/libcrunch/frontend/c'
Makefile:5: recipe for target 'c' failed
make[1]: *** [c] Error 2
make[1]: Leaving directory '/usr/local/src/libcrunch/frontend'
Makefile:9: recipe for target 'frontend' failed
make: *** [frontend] Error 2

Could you help me look into why that happens? Many thanks!

stephenrkell commented 1 year ago

Hi again. It looks like the revision you chose dates from February 2022. I think you should try one from February 2021. Let me know how you get on!

HiragiChi commented 1 year ago

Ahhhh my mistake! I will see If it works. Many thanks!