Snaipe / Criterion

A cross-platform C and C++ unit testing framework for the 21st century

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't compile on openSUSE

paolostivanin opened this issue · comments

Hello,
I'm trying to package Criterion on openSUSE, but I'm facing some issues:

[   12s] The Meson build system
[   12s] Version: 0.64.1
[   12s] Source dir: /home/abuild/rpmbuild/BUILD/Criterion-2.4.1
[   12s] Build dir: /home/abuild/rpmbuild/BUILD/Criterion-2.4.1/x86_64-suse-linux
[   12s] Build type: native build
[   12s] Project name: criterion
[   12s] Project version: 2.4.1
[   12s] C compiler for the host machine: cc (gcc 12.2.1 "cc (SUSE Linux) 12.2.1 20221020 [revision 0aaef83351473e8f4eb774f8f999bbe87a4866d7]")
[   12s] C linker for the host machine: cc ld.bfd 2.39.0.20220810-1
[   12s] Host machine cpu family: x86_64
[   12s] Host machine cpu: x86_64
[   12s] Program python3 found: YES (/usr/bin/python3)
[   12s] Program git found: NO
[   12s] WARNING: You should add the boolean check kwarg to the run_command call.
[   12s]          It currently defaults to false,
[   12s]          but it will default to true in future releases of meson.
[   12s]          See also: https://github.com/mesonbuild/meson/issues/9300
[   12s] C++ compiler for the host machine: c++ (gcc 12.2.1 "c++ (SUSE Linux) 12.2.1 20221020 [revision 0aaef83351473e8f4eb774f8f999bbe87a4866d7]")
[   12s] C++ linker for the host machine: c++ ld.bfd 2.39.0.20220810-1
[   12s] Compiler for C supports arguments -Wno-unused-parameter: YES 
[   12s] Compiler for C supports arguments -Wno-unused-value: YES 
[   12s] Compiler for C supports arguments -fvisibility=hidden: YES 
[   12s] Compiler for C supports arguments -fexceptions: YES 
[   12s] Compiler for C supports arguments /SAFESEH:NO: NO 
[   12s] Compiler for C supports arguments /source-charset:utf-8: NO 
[   12s] Checking for function "clock_gettime" : YES 
[   12s] Checking for function "fopencookie" : YES 
[   12s] Checking for function "funopen" : NO 
[   12s] Checking for function "getcwd" : YES 
[   12s] Checking for function "isatty" : YES 
[   12s] Checking for function "nl_langinfo" : YES 
[   12s] Checking for function "open_memstream" : YES 
[   12s] Checking for function "strtok_r" : YES 
[   12s] Checking for function "strtok_s" : NO 
[   12s] Header "time.h" has symbol "CLOCK_MONOTONIC_RAW" : YES 
[   12s] Checking for function "GetCurrentDirectory" : NO 
[   12s] Checking for function "PathIsRelative" : NO 
[   12s] Has header "synchapi.h" : NO 
[   12s] Program gettext found: YES (/usr/bin/gettext)
[   12s] Program msgfmt found: YES (/usr/bin/msgfmt)
[   12s] Program msginit found: YES (/usr/bin/msginit)
[   12s] Program msgmerge found: YES (/usr/bin/msgmerge)
[   12s] Program xgettext found: YES (/usr/bin/xgettext)
[   12s] Run-time dependency threads found: YES
[   12s] Found pkg-config: /usr/bin/pkg-config (1.8.0)
[   12s] Run-time dependency nanomsg found: YES 1.1.5
[   12s] Found CMake: /usr/bin/cmake (3.25.1)
[   12s] Run-time dependency nanopb (modules: nanopb::protobuf-nanopb) found: YES 0.4.6
[   12s] Run-time dependency libgit2 found: YES 1.5.0
[   12s] Run-time dependency boxfort found: YES 0.0.1
[   12s] Run-time dependency libffi found: YES 3.4.4
[   12s] Library rt found: YES
[   12s] Library m found: YES
[   12s] Library intl found: NO
[   12s] Header "libintl.h" has symbol "gettext" with dependency -lintl: YES 
[   12s] Program protoc found: YES (/usr/bin/protoc)
[   12s] Program protoc-gen-nanopb found: YES (/usr/bin/protoc-gen-nanopb)
[   12s] Configuring config.h using configuration
[   12s] Compiler for C supports link arguments -Wl,--exclude-libs,ALL: YES 
[   12s] Program sh found: YES (/usr/bin/sh)
[   12s] Program cram found: NO
[   12s] Build targets in project: 49
[   12s] NOTICE: Future-deprecated features used:
[   12s]  * 0.55.0: {'ExternalProgram.path'}
[   12s]  * 0.56.0: {'meson.source_root'}
[   12s] 
[   12s] criterion 2.4.1
[   12s] 
[   12s]   User defined options
[   12s]     auto_features : enabled
[   12s]     bindir        : /usr/bin
[   12s]     buildtype     : plain
[   12s]     datadir       : /usr/share
[   12s]     includedir    : /usr/include
[   12s]     infodir       : /usr/share/info
[   12s]     libdir        : /usr/lib64
[   12s]     libexecdir    : /usr/libexec
[   12s]     localedir     : /usr/share/locale
[   12s]     localstatedir : /var
[   12s]     mandir        : /usr/share/man
[   12s]     prefix        : /usr
[   12s]     sbindir       : /usr/sbin
[   12s]     sharedstatedir: /var/lib
[   12s]     sysconfdir    : /etc
[   12s]     wrap_mode     : nodownload

then the compilation starts and fails at the following steps:

[   13s] [37/138] cc -Isrc/libcriterion.so.3.2.0.p -Isrc -I../src -I../dependencies/debugbreak -I../dependencies/klib -I../dependencies/valgrind/include -Iinclude -I../include -I/usr/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -Wno-unused-parameter -Wno-unused-value -fvisibility=hidden -fexceptions -DCRITERION_BUILDING_DLL=1 -DPB_ENABLE_MALLOC=1 -DPB_NO_PACKED_STRUCTS=1 -D_GNU_SOURCE '-DGETTEXT_PACKAGE="criterion"' -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -fPIC -DOPENSSL_LOAD_CONF -pthread -DBXF_STATIC_LIB=1 -D__USE_MINGW_ANSI_STDIO -MD -MQ src/libcriterion.so.3.2.0.p/core_abort.c.o -MF src/libcriterion.so.3.2.0.p/core_abort.c.o.d -o src/libcriterion.so.3.2.0.p/core_abort.c.o -c ../src/core/abort.c
[   13s] FAILED: src/libcriterion.so.3.2.0.p/core_abort.c.o 
[   13s] cc -Isrc/libcriterion.so.3.2.0.p -Isrc -I../src -I../dependencies/debugbreak -I../dependencies/klib -I../dependencies/valgrind/include -Iinclude -I../include -I/usr/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -Wno-unused-parameter -Wno-unused-value -fvisibility=hidden -fexceptions -DCRITERION_BUILDING_DLL=1 -DPB_ENABLE_MALLOC=1 -DPB_NO_PACKED_STRUCTS=1 -D_GNU_SOURCE '-DGETTEXT_PACKAGE="criterion"' -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -fPIC -DOPENSSL_LOAD_CONF -pthread -DBXF_STATIC_LIB=1 -D__USE_MINGW_ANSI_STDIO -MD -MQ src/libcriterion.so.3.2.0.p/core_abort.c.o -MF src/libcriterion.so.3.2.0.p/core_abort.c.o.d -o src/libcriterion.so.3.2.0.p/core_abort.c.o -c ../src/core/abort.c
[   13s] ../src/core/abort.c:32:10: fatal error: debugbreak.h: No such file or directory
[   13s]    32 | #include "debugbreak.h"
[   13s]       |          ^~~~~~~~~~~~~~
[   13s] compilation terminated.

[   13s] [38/138] cc -Isrc/libcriterion.so.3.2.0.p -Isrc -I../src -I../dependencies/debugbreak -I../dependencies/klib -I../dependencies/valgrind/include -Iinclude -I../include -I/usr/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -Wno-unused-parameter -Wno-unused-value -fvisibility=hidden -fexceptions -DCRITERION_BUILDING_DLL=1 -DPB_ENABLE_MALLOC=1 -DPB_NO_PACKED_STRUCTS=1 -D_GNU_SOURCE '-DGETTEXT_PACKAGE="criterion"' -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -fPIC -DOPENSSL_LOAD_CONF -pthread -DBXF_STATIC_LIB=1 -D__USE_MINGW_ANSI_STDIO -MD -MQ src/libcriterion.so.3.2.0.p/core_client.c.o -MF src/libcriterion.so.3.2.0.p/core_client.c.o.d -o src/libcriterion.so.3.2.0.p/core_client.c.o -c ../src/core/client.c
[   13s] FAILED: src/libcriterion.so.3.2.0.p/core_client.c.o 
[   13s] cc -Isrc/libcriterion.so.3.2.0.p -Isrc -I../src -I../dependencies/debugbreak -I../dependencies/klib -I../dependencies/valgrind/include -Iinclude -I../include -I/usr/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -Wno-unused-parameter -Wno-unused-value -fvisibility=hidden -fexceptions -DCRITERION_BUILDING_DLL=1 -DPB_ENABLE_MALLOC=1 -DPB_NO_PACKED_STRUCTS=1 -D_GNU_SOURCE '-DGETTEXT_PACKAGE="criterion"' -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -fPIC -DOPENSSL_LOAD_CONF -pthread -DBXF_STATIC_LIB=1 -D__USE_MINGW_ANSI_STDIO -MD -MQ src/libcriterion.so.3.2.0.p/core_client.c.o -MF src/libcriterion.so.3.2.0.p/core_client.c.o.d -o src/libcriterion.so.3.2.0.p/core_client.c.o -c ../src/core/client.c
[   13s] In file included from ../src/core/client.c:33:
[   13s] ../src/core/client.h:27:10: fatal error: khash.h: No such file or directory
[   13s]    27 | #include <khash.h>
[   13s]       |          ^~~~~~~~~
[   13s] compilation terminated.
[   13s] [40/138] cc -Isrc/libcriterion.so.3.2.0.p -Isrc -I../src -I../dependencies/debugbreak -I../dependencies/klib -I../dependencies/valgrind/include -Iinclude -I../include -I/usr/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -Wno-unused-parameter -Wno-unused-value -fvisibility=hidden -fexceptions -DCRITERION_BUILDING_DLL=1 -DPB_ENABLE_MALLOC=1 -DPB_NO_PACKED_STRUCTS=1 -D_GNU_SOURCE '-DGETTEXT_PACKAGE="criterion"' -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -fPIC -DOPENSSL_LOAD_CONF -pthread -DBXF_STATIC_LIB=1 -D__USE_MINGW_ANSI_STDIO -MD -MQ src/libcriterion.so.3.2.0.p/core_runner.c.o -MF src/libcriterion.so.3.2.0.p/core_runner.c.o.d -o src/libcriterion.so.3.2.0.p/core_runner.c.o -c ../src/core/runner.c
[   13s] FAILED: src/libcriterion.so.3.2.0.p/core_runner.c.o 
[   13s] cc -Isrc/libcriterion.so.3.2.0.p -Isrc -I../src -I../dependencies/debugbreak -I../dependencies/klib -I../dependencies/valgrind/include -Iinclude -I../include -I/usr/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -Wno-unused-parameter -Wno-unused-value -fvisibility=hidden -fexceptions -DCRITERION_BUILDING_DLL=1 -DPB_ENABLE_MALLOC=1 -DPB_NO_PACKED_STRUCTS=1 -D_GNU_SOURCE '-DGETTEXT_PACKAGE="criterion"' -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -fPIC -DOPENSSL_LOAD_CONF -pthread -DBXF_STATIC_LIB=1 -D__USE_MINGW_ANSI_STDIO -MD -MQ src/libcriterion.so.3.2.0.p/core_runner.c.o -MF src/libcriterion.so.3.2.0.p/core_runner.c.o.d -o src/libcriterion.so.3.2.0.p/core_runner.c.o -c ../src/core/runner.c
[   13s] In file included from ../src/core/runner.c:51:
[   13s] ../src/core/client.h:27:10: fatal error: khash.h: No such file or directory
[   13s]    27 | #include <khash.h>
[   13s]       |          ^~~~~~~~~
[   13s] compilation terminated.

Hi,

Did you run git submodule update --init --recursive before starting the build?

hello,
no, we don't have internet access in OBS (build.opensuse.org). In order to have reproducible builds, we must either declare each dependency or, in case of Golang, pack the vendored deps in an archive.

I see, I also have to package klib and debugbreak 🤔

Oh sorry, I missed the "packaging" part.

Yeah, there are subprojects and submodules as well:
https://github.com/Snaipe/Criterion/tree/bleeding/subprojects
https://github.com/Snaipe/Criterion/tree/bleeding/dependencies

nice, thanks! BoxFort I already packaged it yesterday. Now I have to package those 2 submods.

Are you working on the official packaging of Criterion for SUSE?
I'd add openSUSE to #321 then :)

Yes, I am :)
I have a couple of questions:

  1. from klib, are you just using a single header file or more? Also, that project doesn't have a makefile or similar. Does it mean there's nothing to compile? Do I have to just install the headers file and not care about the .c ones?
  2. from debugbreak, a simple make is enough, right? no deps or anything?

Thanks for doing this.

  1. Only khash and kvec are used, and they happen to be header-only. klib is meant to be bundled; it can not be installed/packaged separately (no dynamic libraries, it always needs a dependent software). If we ever need more components from klib, Criterion's build system will compile those C files.
  2. debugbreak is used in a header-only manner too, but I think it would be cleaner to run their Makefile. There is no install target, though :( It has no deps.

klib is a tough one when bundling is discouraged; Debian has decided to add its headers as a patch:
https://salsa.debian.org/sasa/criterion/-/blob/debian/master/debian/patches/0002-Added-required-files-from-the-klib-dependency.patch

@MrAnno I think I'll do the same. No point in having a separate pacakge for klib. debugbreak seems trivial to package, let's see how it goes :)

in the end I packaged both klib and debugbreak, it was faster this way. Still, criterion doesn't compile:

[   16s] cc  -o src/libcriterion.so.3.2.0 src/libcriterion.so.3.2.0.p/meson-generated_.._criterion.pb.c.o src/libcriterion.so.3.2.0.p/err.c.o src/libcriterion.so.3.2.0.p/mutex.c.o src/libcriterion.so.3.2.0.p/capi_specifiers.c.o src/libcriterion.so.3.2.0.p/capi_stream.c.o src/libcriterion.so.3.2.0.p/compat_alloc.c.o src/libcriterion.so.3.2.0.p/compat_kill.c.o src/libcriterion.so.3.2.0.p/compat_mockfile.c.o src/libcriterion.so.3.2.0.p/compat_path.c.o src/libcriterion.so.3.2.0.p/compat_pipe.c.o src/libcriterion.so.3.2.0.p/compat_process.c.o src/libcriterion.so.3.2.0.p/compat_processor.c.o src/libcriterion.so.3.2.0.p/compat_section.c.o src/libcriterion.so.3.2.0.p/compat_strtok.c.o src/libcriterion.so.3.2.0.p/compat_time.c.o src/libcriterion.so.3.2.0.p/core_abort.c.o src/libcriterion.so.3.2.0.p/core_assert.c.o src/libcriterion.so.3.2.0.p/core_client.c.o src/libcriterion.so.3.2.0.p/core_ordered-set.c.o src/libcriterion.so.3.2.0.p/core_report.c.o src/libcriterion.so.3.2.0.p/core_runner.c.o src/libcriterion.so.3.2.0.p/core_runner_coroutine.c.o src/libcriterion.so.3.2.0.p/core_stats.c.o src/libcriterion.so.3.2.0.p/core_test.c.o src/libcriterion.so.3.2.0.p/csptr_array.c.o src/libcriterion.so.3.2.0.p/csptr_mman.c.o src/libcriterion.so.3.2.0.p/entry_entry.c.o src/libcriterion.so.3.2.0.p/entry_options.c.o src/libcriterion.so.3.2.0.p/entry_params.c.o src/libcriterion.so.3.2.0.p/io_event.c.o src/libcriterion.so.3.2.0.p/io_file.c.o src/libcriterion.so.3.2.0.p/io_json.c.o src/libcriterion.so.3.2.0.p/io_output.c.o src/libcriterion.so.3.2.0.p/io_redirect.c.o src/libcriterion.so.3.2.0.p/io_tap.c.o src/libcriterion.so.3.2.0.p/io_xml.c.o src/libcriterion.so.3.2.0.p/log_logging.c.o src/libcriterion.so.3.2.0.p/log_normal.c.o src/libcriterion.so.3.2.0.p/protocol_connect.c.o src/libcriterion.so.3.2.0.p/protocol_messages.c.o src/libcriterion.so.3.2.0.p/protocol_protocol.c.o src/libcriterion.so.3.2.0.p/string_brz.c.o src/libcriterion.so.3.2.0.p/string_extglobmatch.c.o src/libcriterion.so.3.2.0.p/string_fmt.c.o src/libcriterion.so.3.2.0.p/string_i18n.c.o src/libcriterion.so.3.2.0.p/string_xxd.c.o src/libcriterion.so.3.2.0.p/string_diff.c.o src/libcriterion.so.3.2.0.p/core_theories.c.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libcriterion.so.3 -flto=auto -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -Wl,--exclude-libs,ALL -pthread /usr/lib64/libboxfort.a -lrt -lm /usr/lib64/../lib64/libffi.so /usr/lib64/libgit2.so /usr/lib64/libnanomsg.so /usr/lib64/libprotobuf-nanopb.so.0 -Wl,--end-group
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccmO68ox.ltrans0.ltrans.o: in function `destroy_client_context':
[   16s] <artificial>:(.text+0x56a7): undefined reference to `bxf_wait'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x56b4): undefined reference to `bxf_term'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccmO68ox.ltrans0.ltrans.o: in function `cr_malloc':
[   16s] <artificial>:(.text+0x60dc): undefined reference to `bxf_arena_alloc'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccmO68ox.ltrans0.ltrans.o: in function `cr_realloc':
[   16s] <artificial>:(.text+0x6156): undefined reference to `bxf_arena_realloc'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccmO68ox.ltrans0.ltrans.o: in function `run_test':
[   16s] <artificial>:(.text+0x8520): undefined reference to `bxf_context_init'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x854f): undefined reference to `bxf_context_addobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x8623): undefined reference to `bxf_spawn_struct'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x86ce): undefined reference to `bxf_context_term'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x8806): undefined reference to `bxf_context_addobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x8826): undefined reference to `bxf_context_addfnaddr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x8846): undefined reference to `bxf_context_addobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x886a): undefined reference to `bxf_context_addfnaddr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x8894): undefined reference to `bxf_context_addfnaddr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x88bd): undefined reference to `bxf_context_addobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x88e2): undefined reference to `bxf_context_addobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x8906): undefined reference to `bxf_context_addfnaddr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x8934): undefined reference to `bxf_context_addfnaddr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x8960): undefined reference to `bxf_context_addobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x8991): undefined reference to `bxf_context_addobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x89af): undefined reference to `bxf_context_addstatic'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0x89c8): undefined reference to `bxf_context_addarena'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccmO68ox.ltrans0.ltrans.o: in function `cr_send_to_runner':
[   16s] <artificial>:(.text+0xa033): undefined reference to `pb_release'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccmO68ox.ltrans0.ltrans.o: in function `criterion_internal_test_main':
[   16s] <artificial>:(.text+0xcb29): undefined reference to `bxf_context_current'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xcb3d): undefined reference to `bxf_context_getobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccmO68ox.ltrans0.ltrans.o: in function `criterion_run_all_tests':
[   16s] <artificial>:(.text+0xd8d8): undefined reference to `bxf_arena_init'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xdc1f): undefined reference to `pb_release'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xde0f): undefined reference to `bxf_arena_term'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xe100): undefined reference to `pb_release'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccmO68ox.ltrans0.ltrans.o: in function `run_test_child':
[   16s] <artificial>:(.text+0xec11): undefined reference to `bxf_context_current'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xec19): undefined reference to `bxf_context_current'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xec40): undefined reference to `bxf_context_getobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xec5c): undefined reference to `bxf_context_getobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xec78): undefined reference to `bxf_context_getfnaddr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xec97): undefined reference to `bxf_context_getobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xecb7): undefined reference to `bxf_context_getfnaddr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xecd7): undefined reference to `bxf_context_getfnaddr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xecf6): undefined reference to `bxf_context_getobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xed15): undefined reference to `bxf_context_getobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xed3a): undefined reference to `bxf_context_getfnaddr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xed5a): undefined reference to `bxf_context_getfnaddr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xed88): undefined reference to `bxf_context_getobject'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccmO68ox.ltrans0.ltrans.o: in function `cr_malloc':
[   16s] <artificial>:(.text+0x60f4): undefined reference to `bxf_arena_ptr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccmO68ox.ltrans0.ltrans.o: in function `cr_realloc':
[   16s] <artificial>:(.text+0x616e): undefined reference to `bxf_arena_ptr'
[   16s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccmO68ox.ltrans0.ltrans.o: in function `cr_free':
[   16s] <artificial>:(.text+0x61a2): undefined reference to `bxf_arena_free'
[   16s] collect2: error: ld returned 1 exit status
[   16s] ninja: build stopped: subcommand failed.
[   16s] INFO: autodetecting backend as ninja

any idea?

boxfort is found though:

[   13s] Run-time dependency nanopb (modules: nanopb::protobuf-nanopb) found: YES 0.4.6
[   13s] Run-time dependency libgit2 found: YES 1.5.0
[   13s] Run-time dependency boxfort found: YES 0.0.1
[   13s] Run-time dependency libffi found: YES 3.4.4

and correctly linked:

[   16s] cc  -o src/libcriterion.so.3.2.0 src/libcriterion.so.3.2.0.p/meson-generated_.._criterion.pb.c.o src/libcriterion.so.3.2.0.p/err.c.o src/libcriterion.so.3.2.0.p/mutex.c.o src/libcriterion.so.3.2.0.p/capi_specifiers.c.o src/libcriterion.so.3.2.0.p/capi_stream.c.o src/libcriterion.so.3.2.0.p/compat_alloc.c.o src/libcriterion.so.3.2.0.p/compat_kill.c.o src/libcriterion.so.3.2.0.p/compat_mockfile.c.o src/libcriterion.so.3.2.0.p/compat_path.c.o src/libcriterion.so.3.2.0.p/compat_pipe.c.o src/libcriterion.so.3.2.0.p/compat_process.c.o src/libcriterion.so.3.2.0.p/compat_processor.c.o src/libcriterion.so.3.2.0.p/compat_section.c.o src/libcriterion.so.3.2.0.p/compat_strtok.c.o src/libcriterion.so.3.2.0.p/compat_time.c.o src/libcriterion.so.3.2.0.p/core_abort.c.o src/libcriterion.so.3.2.0.p/core_assert.c.o src/libcriterion.so.3.2.0.p/core_client.c.o src/libcriterion.so.3.2.0.p/core_ordered-set.c.o src/libcriterion.so.3.2.0.p/core_report.c.o src/libcriterion.so.3.2.0.p/core_runner.c.o src/libcriterion.so.3.2.0.p/core_runner_coroutine.c.o src/libcriterion.so.3.2.0.p/core_stats.c.o src/libcriterion.so.3.2.0.p/core_test.c.o src/libcriterion.so.3.2.0.p/csptr_array.c.o src/libcriterion.so.3.2.0.p/csptr_mman.c.o src/libcriterion.so.3.2.0.p/entry_entry.c.o src/libcriterion.so.3.2.0.p/entry_options.c.o src/libcriterion.so.3.2.0.p/entry_params.c.o src/libcriterion.so.3.2.0.p/io_event.c.o src/libcriterion.so.3.2.0.p/io_file.c.o src/libcriterion.so.3.2.0.p/io_json.c.o src/libcriterion.so.3.2.0.p/io_output.c.o src/libcriterion.so.3.2.0.p/io_redirect.c.o src/libcriterion.so.3.2.0.p/io_tap.c.o src/libcriterion.so.3.2.0.p/io_xml.c.o src/libcriterion.so.3.2.0.p/log_logging.c.o src/libcriterion.so.3.2.0.p/log_normal.c.o src/libcriterion.so.3.2.0.p/protocol_connect.c.o src/libcriterion.so.3.2.0.p/protocol_messages.c.o src/libcriterion.so.3.2.0.p/protocol_protocol.c.o src/libcriterion.so.3.2.0.p/string_brz.c.o src/libcriterion.so.3.2.0.p/string_extglobmatch.c.o src/libcriterion.so.3.2.0.p/string_fmt.c.o src/libcriterion.so.3.2.0.p/string_i18n.c.o src/libcriterion.so.3.2.0.p/string_xxd.c.o src/libcriterion.so.3.2.0.p/string_diff.c.o src/libcriterion.so.3.2.0.p/core_theories.c.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libcriterion.so.3 -flto=auto -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -Wl,--exclude-libs,ALL -pthread /usr/lib64/libboxfort.a -lrt -lm /usr/lib64/../lib64/libffi.so /usr/lib64/libgit2.so /usr/lib64/libnanomsg.so /usr/lib64/libprotobuf-nanopb.so.0 -Wl,--end-group

Hmm, let me check the out-of-tree linking against Boxfort in my dev env.

@paolostivanin Can you share your build commands and the BoxFort version you use, please?

I'm using boxfort = 0.1.4 taken from https://github.com/Snaipe/BoxFort/archive/refs/tags/v%{version}.tar.gz

For both boxtrot and criterion the build and install cmds are:

%meson
%meson_build
%meson_install

but on criterion I also add -Dtests=false.

About those macros:

%meson:

  CONFIG_SHELL="${CONFIG_SHELL:-/usr/bin/bash}" ; export CONFIG_SHELL ; 
  CFLAGS="${CFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CFLAGS ; 
  CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CXXFLAGS ; 
  FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables }" ; export FFLAGS ; 
  FCFLAGS="${FCFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables }" ; export FCFLAGS ; 
  LDFLAGS="${LDFLAGS:-}" ; export LDFLAGS 
    /usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled . x86_64-suse-linux
%meson_build

/usr/bin/meson compile -C x86_64-suse-linux -j 8 --verbose
%meson_install

DESTDIR=/home/pstivanin/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64 /usr/bin/meson install -C x86_64-suse-linux --no-rebuild

I've tried different stuff, but I always get stuck on that undef reference 🤔

I could not reproduce this, I'll try on openSUSE soon.

Steps to reproduce it:

  1. wget https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso
  2. install the OS
  3. add my custom repo with the needed deps: zypper ar -f https://download.opensuse.org/repositories/home:/polslinux:/tools/openSUSE_Tumbleweed/ criterion
  4. install all needed deps: sudo zypper in klib-devel debugbreak-devel nanopb-devel boxfort-devel libffi-devel libgit2-devel nanomsg-devel libprotobuf-c-devel protobuf-devel libprotobuf-nanopb0 python3-protobuf nanopb-devel meson
  5. git clone criterion and try to build it using the cmds from #470 (comment)

also, for criterion I've applied the following patch, otherwise nanopb is not correctly detected:

--- Criterion-2.4.1/meson.build.orig	2023-01-05 08:13:30.258556378 +0100
+++ Criterion-2.4.1/meson.build	2023-01-05 08:24:59.154097804 +0100
@@ -171,18 +171,8 @@
 	config.set('NN_REQREP_H', '<nanomsg/reqrep.h>')
 endif
 
-nanopb = dependency('nanopb', required: false, method: 'cmake', modules: ['nanopb::protobuf-nanopb-static'])
+nanopb = dependency('nanopb', required: true, method: 'cmake', modules: ['nanopb::protobuf-nanopb'])
 must_regenerate_pb = nanopb.found()
-if not nanopb.found()
-	nanopb_proj = cmake.subproject('nanopb',
-		cmake_options: [
-			'-Dnanopb_BUILD_GENERATOR=OFF',
-			'-DBUILD_SHARED_LIBS=OFF',
-			'-DCMAKE_C_FLAGS=-DPB_ENABLE_MALLOC=1 -DPB_NO_PACKED_STRUCTS=1',
-			'-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
-		])
-	nanopb = nanopb_proj.dependency('protobuf-nanopb-static')
-endif
 
 libgit2 = dependency('libgit2', required: false)
 if not libgit2.found() and get_option('diffs').enabled()

Thanks, I'm checking it.

I've reproduced it too. It seems symbols are really missing from BoxFort and nanopb:

$ nm /usr/lib64/libboxfort.a

addr.c.o:
nm: addr.c.o: plugin needed to handle lto object
0000000000000001 C __gnu_lto_slim

arena.c.o:
0000000000000001 C __gnu_lto_slim

context.c.o:
0000000000000001 C __gnu_lto_slim

exe-trampoline-fixup.c.o:
0000000000000001 C __gnu_lto_slim

exe-elf.c.o:
0000000000000001 C __gnu_lto_slim

sandbox-posix.c.o:
0000000000000001 C __gnu_lto_slim

sandbox.c.o:
0000000000000001 C __gnu_lto_slim

timeout-posix.c.o:
0000000000000001 C __gnu_lto_slim

timestamp.c.o:
0000000000000001 C __gnu_lto_slim

asm_trampoline-x86_64.S.o:
0000000000000008 t addr_data
0000000000000000 T bxfi_trampoline
0000000000000008 T bxfi_trampoline_addr
0000000000000010 T bxfi_trampoline_end

After recompiling BoxFort (meson setup --libdir=/usr/lib64 build, meson install -C build) and nanopb, it started working.

I recompiled with the extended compiler flags and parameters you provided, and that build worked as expected too.
Is there something in the openSUSE build process that tries to strip "unused" symbols? Maybe some link time optimization?

Yes, the build system strips debug symbols by default.
FYI, here you can find the complete build log for boxfort: https://build.opensuse.org/package/live_build_log/home:polslinux:tools/boxfort/openSUSE_Tumbleweed/x86_64

Maybe you can spot what's causing the issue 🤔

It's brp-15-strip-debug that removes essential symbols from the BoxFort static library. Probably it is also responsible for removing pb_release from the nanopb shared library.

Right, thanks! That check + LTO are causing the issue. Working on a fix.
A question: is there a reason why boxfort is distributed as static library instead of a shared one?

I think BoxFort is currently not ready to operate as a shared library because it does some black magic during sandbox creation: it patches the user's main function.

But I believe we will eventually make it work as a shared lib too.

Hmm, it seems to be working perfectly as a shared library if I set -Db_lundef=false.

without any side issues? that'd be cool 😄

I will investigate this a little deeper and open a pull request.
Are you okay with the static lib for now?

Ok, so now boxfort is working fine, but the problem is with nanopb. I've disabled both stripping and lto, but it's not helping:
This is what I get when trying to compile criterion:

[   19s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccKugPao.ltrans0.ltrans.o: in function `cr_send_to_runner':
[   19s] <artificial>:(.text+0xa033): undefined reference to `pb_release'
[   19s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /tmp/ccKugPao.ltrans0.ltrans.o: in function `criterion_run_all_tests':
[   19s] <artificial>:(.text+0xdc1f): undefined reference to `pb_release'
[   19s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: <artificial>:(.text+0xe100): undefined reference to `pb_release'
[   19s] collect2: error: ld returned 1 exit status
[   19s] ninja: build stopped: subcommand failed.
[   19s] INFO: autodetecting backend as ninja
[   19s] INFO: calculating backend command to run: /usr/bin/ninja -C /home/abuild/rpmbuild/BUILD/Criterion-2.4.1/x86_64-suse-linux -j 16 -v
[   19s] error: Bad exit status from /var/tmp/rpm-tmp.cnPGhH (%build)

PS: yes, the static lib is fine for now, thanks!

Sorry, I was wrong about this one.
You need to enable the dynamic allocation feature when compiling nanopb:
https://github.com/Snaipe/Criterion/blob/bleeding/meson.build#L181

pb_release() is for ENABLE_MALLOC.

cool :D now it's working (well, it compiles at least! 😄 now I've gotta test it!)

thanks a lot for your help!

My pleasure. Thanks for the hard work. I'm really excited about the first RPM-based Criterion package.

FYI, first test package is ready: https://build.opensuse.org/package/show/home:polslinux:tools/criterion

will test it this afternoon, let's see how it goes :D

couple of findings:

  1. I had to change meson.build like the following, otherwiese nanopb wasn't detected:
-nanopb = dependency('nanopb', required: false, method: 'cmake', modules: ['nanopb::protobuf-nanopb-static'])
+nanopb = dependency('nanopb', required: true, method: 'cmake', modules: ['nanopb::protobuf-nanopb'])
  1. I had to disable LTO also on Criterion

that feeling when everything works :D can confirm that Criterion now works fine on openSUSE Tumbleweed. Will test Leap too and then tomorrow I'll start the official packaging process.