From 8599795d9b5d025b8c55370525cb58558142be65 Mon Sep 17 00:00:00 2001 From: ankurv Date: Wed, 12 Nov 2025 12:39:54 -0800 Subject: [PATCH] Fix stderr (info) log messages bleeding into stdout --- tools/mtmd/CMakeLists.txt | 2 +- tools/mtmd/mtmd-cli.cpp | 2 +- tools/mtmd/mtmd-helper.cpp | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/mtmd/CMakeLists.txt b/tools/mtmd/CMakeLists.txt index f640ae2a6ea5f..b79a1b6458dd7 100644 --- a/tools/mtmd/CMakeLists.txt +++ b/tools/mtmd/CMakeLists.txt @@ -19,7 +19,7 @@ set_target_properties(mtmd PROPERTIES ) target_link_libraries (mtmd PUBLIC ggml llama) -target_link_libraries (mtmd PRIVATE Threads::Threads) +target_link_libraries (mtmd PRIVATE common Threads::Threads) target_include_directories(mtmd PUBLIC .) target_include_directories(mtmd PRIVATE ../..) target_include_directories(mtmd PRIVATE ../../vendor) diff --git a/tools/mtmd/mtmd-cli.cpp b/tools/mtmd/mtmd-cli.cpp index 3e19e95958a2f..9607136eb06db 100644 --- a/tools/mtmd/mtmd-cli.cpp +++ b/tools/mtmd/mtmd-cli.cpp @@ -285,7 +285,7 @@ int main(int argc, char ** argv) { } mtmd_cli_context ctx(params); - LOG("%s: loading model: %s\n", __func__, params.model.path.c_str()); + LOG_INF("%s: loading model: %s\n", __func__, params.model.path.c_str()); bool is_single_turn = !params.prompt.empty() && !params.image.empty(); diff --git a/tools/mtmd/mtmd-helper.cpp b/tools/mtmd/mtmd-helper.cpp index 89e3355bbab27..6908979510536 100644 --- a/tools/mtmd/mtmd-helper.cpp +++ b/tools/mtmd/mtmd-helper.cpp @@ -7,6 +7,7 @@ #include #endif +#include "log.h" #include "mtmd.h" #include "mtmd-helper.h" #include "llama.h" @@ -32,9 +33,6 @@ #define STB_IMAGE_IMPLEMENTATION #include "stb/stb_image.h" -#define LOG_INF(...) fprintf(stdout, __VA_ARGS__) -#define LOG_ERR(...) fprintf(stderr, __VA_ARGS__) - size_t mtmd_helper_get_n_tokens(const mtmd_input_chunks * chunks) { size_t n_tokens = 0; for (size_t i = 0; i < mtmd_input_chunks_size(chunks); i++) {