Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 936947 - dev-ml/ocaml-ctypes-0.21.1-r2 will fail to build if dev-lang/ocaml is built with -flto under clang-18
Summary: dev-ml/ocaml-ctypes-0.21.1-r2 will fail to build if dev-lang/ocaml is built w...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Team for the ML programming language family
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-30 14:38 UTC by ppw0
Modified: 2024-07-30 16:31 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (dev-ml:ocaml-ctypes-0.21.1-r2:20240730-143240.log,37.54 KB, text/x-log)
2024-07-30 14:38 UTC, ppw0
Details
emerge --info (emerge_info.log,9.27 KB, text/x-log)
2024-07-30 14:39 UTC, ppw0
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ppw0 2024-07-30 14:38:54 UTC
Created attachment 898649 [details]
build log

In an llvm-18 environment, dev-ml/ocaml-ctypes-0.21.1-r2 will fail to build if dev-lang/ocaml is built with -flto, with the following errors:
```
   ocamlopt src/ctypes-foreign/config/gen_libffi_abi.exe
File "src/ctypes/dune", line 1, characters 0-89:
1 | (rule
2 |  (with-stdout-to
3 |   ctypes_primitives.ml
4 |   (run ../configure/gen_c_primitives.exe)))
gen_c_primitives src/ctypes/ctypes_primitives.ml (exit 1)
compiling c program:
 | #include <stdio.h>
 | 
 | #if defined(__MINGW32__) || defined(__MINGW64__)
 | #define __USE_MINGW_ANSI_STDIO 1
 | #include <stdio.h> /* see: https://sourceforge.net/p/mingw-w64/bugs/627/ */
 | #endif
 | 
 | #include <stdint.h>
 | #include <stdbool.h>
 | #include <inttypes.h>
 | #include <caml/mlvalues.h>
 | 
 | #define alignof(T) (offsetof(struct { char c; T t; }, t))
 | #define STRINGIFY1(x) #x
 | #define STRINGIFY(x) STRINGIFY1(x)
 | 
 | #if __USE_MINGW_ANSI_STDIO && defined(__MINGW64__)
 | #define REAL_ARCH_INTNAT_PRINTF_FORMAT "ll"
 | #else
 | #define REAL_ARCH_INTNAT_PRINTF_FORMAT ARCH_INTNAT_PRINTF_FORMAT
 | #endif
 | 
 | 
 | #define DUNE_ABS(x) ((x >= 0)? x: -(x))
 | #define DUNE_D0(x) ('0'+(DUNE_ABS(x)/1         )%10)
 | #define DUNE_D1(x) ('0'+(DUNE_ABS(x)/10        )%10), DUNE_D0(x)
 | #define DUNE_D2(x) ('0'+(DUNE_ABS(x)/100       )%10), DUNE_D1(x)
 | #define DUNE_D3(x) ('0'+(DUNE_ABS(x)/1000      )%10), DUNE_D2(x)
 | #define DUNE_D4(x) ('0'+(DUNE_ABS(x)/10000     )%10), DUNE_D3(x)
 | #define DUNE_D5(x) ('0'+(DUNE_ABS(x)/100000    )%10), DUNE_D4(x)
 | #define DUNE_D6(x) ('0'+(DUNE_ABS(x)/1000000   )%10), DUNE_D5(x)
 | #define DUNE_D7(x) ('0'+(DUNE_ABS(x)/10000000  )%10), DUNE_D6(x)
 | #define DUNE_D8(x) ('0'+(DUNE_ABS(x)/100000000 )%10), DUNE_D7(x)
 | #define DUNE_D9(x) ('0'+(DUNE_ABS(x)/1000000000)%10), DUNE_D8(x)
 | #define DUNE_SIGN(x) ((x >= 0)? '0': '-')
 | 
 | 
 | const char s0[] = {
 |   'B', 'E', 'G', 'I', 'N', '-', '0', '-',
 |   DUNE_SIGN((sizeof(char))),
 |   DUNE_D9((sizeof(char))),
 |   '-', 'E', 'N', 'D'
 | };
 | 
run: clang -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -O2 -march=native -pipe -flto -I /usr/lib64/ocaml -o /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator7c3d00/c-test-0/test.o -c /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator7c3d00/c-test-0/test.c -lm
-> process exited with code 0
-> stdout:
-> stderr:
 | clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
Error: Unable to get value for sizeof(char)
    ocamlopt src/ctypes-foreign/config/discover.exe
    discover src/ctypes-foreign/backend.sexp,src/ctypes-foreign/c_flags,src/ctypes-foreign/c_flags.sexp,src/ctypes-foreign/c_library_flags.sexp
    ocamldep src/ctypes-foreign/.ctypes_foreign.objs/dl.impl.d
       clang src/ctypes-foreign/ffi_type_stubs.o 
       clang src/ctypes-foreign/foreign_threaded_stubs.o
       clang src/ctypes-foreign/dl_stubs.o       
       clang src/ctypes-foreign/ffi_call_stubs.o 
  ocamlmklib src/ctypes-foreign/dllctypes_foreign_stubs.so,src/ctypes-foreign/libctypes_foreign_stubs.a
File "src/ctypes-foreign/dune", line 7, characters 0-108:
 7 | (rule
 8 |  (with-stdout-to
 9 |   libffi_abi.ml
10 |   (run ./config/gen_libffi_abi.exe -cflags "%{read-lines:c_flags}")))
gen_libffi_abi src/ctypes-foreign/libffi_abi.ml (exit 1)
compiling c program:
 | #include <ffi.h>
 | int main(int argc, char **argv) {
 |    int s = FFI_AIX;
 |    return 0;
 | }
run: clang -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -O2 -march=native -pipe -flto -I/usr/lib64/libffi/include -I /usr/lib64/ocaml -o /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-0/test.exe /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-0/test.c -lm
-> process exited with code 1
-> stdout:
-> stderr:
 | /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-0/test.c:3:12: error: use of undeclared identifier 'FFI_AIX'; did you mean 'FFI_OK'?
 |     3 |    int s = FFI_AIX;
 |       |            ^~~~~~~
 |       |            FFI_OK
 | /usr/lib64/libffi/include/ffi.h:244:3: note: 'FFI_OK' declared here
 |   244 |   FFI_OK = 0,
 |       |   ^
 | 1 error generated.
compiling c program:
 | #include <ffi.h>
 | int main(int argc, char **argv) {
 |    int s = FFI_DARWIN;
 |    return 0;
 | }

.
.
.

run: clang -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -O2 -march=native -pipe -flto -I/usr/lib64/libffi/include -I /usr/lib64/ocaml -o /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-48/test.exe /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-48/test.c -lm
-> process exited with code 1
-> stdout:
-> stderr:
 | /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-48/test.c:3:12: error: use of undeclared identifier 'FFI_V9'; did you mean 'FFI_OK'?
 |     3 |    int s = FFI_V9;
 |       |            ^~~~~~
 |       |            FFI_OK
 | /usr/lib64/libffi/include/ffi.h:244:3: note: 'FFI_OK' declared here
 |   244 |   FFI_OK = 0,
 |       |   ^
 | 1 error generated.
compiling c program:
 | #include <ffi.h>
 | int main(int argc, char **argv) {
 |    int s = FFI_VFP;
 |    return 0;
 | }
run: clang -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -O2 -march=native -pipe -flto -I/usr/lib64/libffi/include -I /usr/lib64/ocaml -o /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-50/test.exe /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-50/test.c -lm
-> process exited with code 1
-> stdout:
-> stderr:
 | /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-50/test.c:3:12: error: use of undeclared identifier 'FFI_VFP'; did you mean 'FFI_OK'?
 |     3 |    int s = FFI_VFP;
 |       |            ^~~~~~~
 |       |            FFI_OK
 | /usr/lib64/libffi/include/ffi.h:244:3: note: 'FFI_OK' declared here
 |   244 |   FFI_OK = 0,
 |       |   ^
 | 1 error generated.
compiling c program:
 | #include <ffi.h>
 | int main(int argc, char **argv) {
 |    int s = FFI_DEFAULT_ABI;
 |    return 0;
 | }
run: clang -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -O2 -march=native -pipe -flto -I/usr/lib64/libffi/include -I /usr/lib64/ocaml -o /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-52/test.exe /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-52/test.c -lm
-> process exited with code 0
-> stdout:
-> stderr:
compiling c program:
 | #include <stdio.h>
 | #include <ffi.h>
 | 
 | 
 | #define DUNE_ABS(x) ((x >= 0)? x: -(x))
 | #define DUNE_D0(x) ('0'+(DUNE_ABS(x)/1         )%10)
 | #define DUNE_D1(x) ('0'+(DUNE_ABS(x)/10        )%10), DUNE_D0(x)
 | #define DUNE_D2(x) ('0'+(DUNE_ABS(x)/100       )%10), DUNE_D1(x)
 | #define DUNE_D3(x) ('0'+(DUNE_ABS(x)/1000      )%10), DUNE_D2(x)
 | #define DUNE_D4(x) ('0'+(DUNE_ABS(x)/10000     )%10), DUNE_D3(x)
 | #define DUNE_D5(x) ('0'+(DUNE_ABS(x)/100000    )%10), DUNE_D4(x)
 | #define DUNE_D6(x) ('0'+(DUNE_ABS(x)/1000000   )%10), DUNE_D5(x)
 | #define DUNE_D7(x) ('0'+(DUNE_ABS(x)/10000000  )%10), DUNE_D6(x)
 | #define DUNE_D8(x) ('0'+(DUNE_ABS(x)/100000000 )%10), DUNE_D7(x)
 | #define DUNE_D9(x) ('0'+(DUNE_ABS(x)/1000000000)%10), DUNE_D8(x)
 | #define DUNE_SIGN(x) ((x >= 0)? '0': '-')
 | 
 | 
 | const char s0[] = {
 |   'B', 'E', 'G', 'I', 'N', '-', '0', '-',
 |   DUNE_SIGN((FFI_UNIX64)),
 |   DUNE_D9((FFI_UNIX64)),
 |   '-', 'E', 'N', 'D'
 | };
 | 
run: clang -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -O2 -march=native -pipe -flto -I/usr/lib64/libffi/include -I /usr/lib64/ocaml -o /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-54/test.o -c /var/tmp/portage/dev-ml/ocaml-ctypes-0.21.1-r2/temp/build_fcbf72_dune/ocaml-configurator86cecc/c-test-54/test.c -lm
-> process exited with code 0
-> stdout:
-> stderr:
 | clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
Error: Unable to get value for FFI_UNIX64
```

Attaching logs.
Comment 1 ppw0 2024-07-30 14:39:22 UTC
Created attachment 898650 [details]
emerge --info