Nico Schlömer
Nico Schlömer

Reputation: 58721

meson doesn't link library

I'm tring to a fix a meson build not picking up on a link library. The meson.build file has

tz_dep = dependency(
    'date',
    default_options : [ 'use_system_tzdb=true' ],
    fallback: [ 'date', 'tz_dep' ]
)

# ...

executable(
    'waybar',
    src_files,
    dependencies: [
        # ...
        tz_dep
    ],
    include_directories: [include_directories('include')],
    install: true,
)

and it does find /usr/lib/x86_64-linux-gnu/cmake/date/dateConfig.cmake. The corresponding dateTargets-none.cmake is

#----------------------------------------------------------------
# Generated CMake target import file for configuration "None".
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Import target "date::date-tz" for configuration "None"
set_property(TARGET date::date-tz APPEND PROPERTY IMPORTED_CONFIGURATIONS NONE)
set_target_properties(date::date-tz PROPERTIES
  IMPORTED_LOCATION_NONE "${_IMPORT_PREFIX}/lib/x86_64-linux-gnu/libdate-tz.so.2.4.1"
  IMPORTED_SONAME_NONE "libdate-tz.so.2.4.1"
  )

list(APPEND _IMPORT_CHECK_TARGETS date::date-tz )
list(APPEND _IMPORT_CHECK_FILES_FOR_date::date-tz "${_IMPORT_PREFIX}/lib/x86_64-linux-gnu/libdate-tz.so.2.4.1" )

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

However, meson does not link /usr/lib/x86_64-linux-gnu/libdate-tz.so.2.4.1.

I'm not sure if the problem is in meson or the cmake config. I can provide more details if required.

Upvotes: 1

Views: 1430

Answers (1)

jonas_toth
jonas_toth

Reputation: 872

i am wrinting an ebuild (gentoo package) for waybar right now and had the same issue you are describing. The solution is in your meson.build file, it specified the date dependency incomplete.

This is the patch i apply, and then it works (i have no clue about meson and stuff, but this seems makes waybar compile):

diff --git a/meson.build b/meson.build
index 5d45a29..dd56c29 100644
--- a/meson.build
+++ b/meson.build
@@ -98,7 +98,7 @@ gtk_layer_shell = dependency('gtk-layer-shell-0',
         required: get_option('gtk-layer-shell'),
         fallback : ['gtk-layer-shell', 'gtk_layer_shell_dep'])
 systemd = dependency('systemd', required: get_option('systemd'))
-tz_dep = dependency('date', default_options : [ 'use_system_tzdb=true' ], fallback: [ 'date', 'tz_dep' ])
+tz_dep = dependency('date', default_options : [ 'use_system_tzdb=true' ], modules : [ 'date::date', 'date::date-tz' ], fallback: [ 'date', 'tz_dep' ])

 prefix = get_option('prefix')
 sysconfdir = get_option('sysconfdir')

Maybe that helps!

Best Regards, Jonas

Upvotes: 2

Related Questions