Skip to content

dynamically links without warning, despite static in config #14427

Open
@lefp

Description

@lefp

Describe the bug

I have dependency('SDL3', static: true), but the output is still dynamically linked to SDL3.

To reproduce

meson.build:

project('test', 'c')

deps = []
deps += dependency('SDL3', static: true)

executable('out', 'main.c', dependencies: deps)

main.c:

#include <SDL3//SDL.h>

int main(void)
{
    SDL_Init(0);
}

Commands:

meson setup build && meson compile -C build
ldd build/out

Result:

	linux-vdso.so.1 (0x00007f578a71d000)
	libSDL3.so.0 => /lib64/libSDL3.so.0 (0x00007f578a400000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f578a20d000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f578a127000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f578a71f000)

Expected behavior

Meson either statically links SDL3 or throws an error.

The following CMakeLists.txt, for example, links correctly:

cmake_minimum_required(VERSION 3.30)
project(project_name)

find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3-static)
add_executable(out main.c)
target_link_libraries(out PRIVATE SDL3::SDL3-static)

Command:

mkdir build && cd build && cmake .. && make && ldd out

Result:

	linux-vdso.so.1 (0x00007ff355f26000)
	libm.so.6 => /lib64/libm.so.6 (0x00007ff355e18000)
	libc.so.6 => /lib64/libc.so.6 (0x00007ff355c25000)
	/lib64/ld-linux-x86-64.so.2 (0x00007ff355f28000)

system parameters

OS: Fedora
Python: 3.13.2
Meson: 1.5.1
Ninja: 1.12.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions