~lattis/muon#86: 
Muon + TCC (TinyCC) can't find 'rt' library

When we try build Rizin with Muon + TinyCC it can't find the necessary library, while Meson can:

/home/runner/work/rizin/rizin/meson.build:354:33: error library not found
354 |     it_lrt = it_cc.find_library('rt', required: true, static: is_static_build)
                                      ^
/home/runner/work/rizin/rizin/meson.build:354:20: error in method compiler.find_library()
354 |     it_lrt = it_cc.find_library('rt', required: true, static: is_static_build)
                         ^
Error: Process completed with exit code 1.

See PR at https://github.com/rizinorg/rizin/pull/3345

Status
REPORTED
Submitter
~xvilka
Assigned to
No-one
Submitted
3 months ago
Updated
4 days ago
Labels
No labels applied.

~lattis 3 months ago

When you say meson can, what to you mean? I thought meson didn't support tinycc.

~lattis 3 months ago

Right now muon gets the list of dirs to search through via cc --print-search-dirs, which isn't posix. There should maybe be a fallback like get_option('prefix') / get_option('libdir')?

~xvilka 3 months ago

Ah, we use our patched fork for that: https://github.com/ret2libc/meson.git There was a PR (https://github.com/mesonbuild/meson/pull/8248) to meson but it was never accepted, so we decided it will be easier to just completely move to Muon for this configuration.

~vtorri 3 months ago

@lattis according to https://bellard.org/tcc/tcc-doc.html#Option-summary there is -print-search-dirs (note the single -)

~vtorri 3 months ago

@~xvilka look at line 316 in compiler.c:

https://git.sr.ht/~lattis/muon/tree/master/item/src/compilers.c#L313

you can try to fix tinycc here with the correct option to pass to tinycc.

~wdlkmpx 4 days ago

There are 2 ways to fix this, both are valid

  1. patch tcc to accept -print-search-dirs & --print-search-dirs (recommended)
  2. patch muon to append -print-search-dirs

All GCC versions accept both -print-search-dirs & --print-search-dirs (tested gcc4.7, gcc5 & gcc11), but only -print-search-dirs is canonical according to the help msg

gcc 4.7

# i486-slackware-linux-gcc --help | grep print
  -print-search-dirs       Display the directories in the compiler's search path
  -print-libgcc-file-name  Display the name of the compiler's companion library
  -print-file-name=<lib>   Display the full path to library <lib>
  -print-prog-name=<prog>  Display the full path to compiler component <prog>
  -print-multi-directory   Display the root directory for versions of libgcc
  -print-multi-lib         Display the mapping between command line options and
  -print-multi-os-directory Display the relative path to OS libraries
  -print-sysroot           Display the target libraries directory
  -print-sysroot-headers-suffix Display the sysroot suffix used to find headers

gcc 11.2

# ./i686-linux-musl-gcc --help | grep print
  -print-search-dirs       Display the directories in the compiler's search path.
  -print-libgcc-file-name  Display the name of the compiler's companion library.
  -print-file-name=<lib>   Display the full path to library <lib>.
  -print-prog-name=<prog>  Display the full path to compiler component <prog>.
  -print-multiarch         Display the target's normalized GNU triplet, used as
  -print-multi-directory   Display the root directory for versions of libgcc.
  -print-multi-lib         Display the mapping between command line options and
  -print-multi-os-directory Display the relative path to OS libraries.
  -print-sysroot           Display the target libraries directory.
  -print-sysroot-headers-suffix Display the sysroot suffix used to find headers.

~vtorri 4 days ago

clang also supports -print-search-dirs

Register here or Log in to comment, or comment via email.