View Issue Details

IDProjectCategoryView StatusLast Update
0017994ScribusOS-MacOSXpublic2026-10-17 20:07
Reporterjaca101 Assigned Tocbradney  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformMacBook M1 proOSMacOS Tahoe 26.6.2OS Version26.6.2 (25G83)
Product Version1.7.4.svn 
Fixed in Version1.6.7.svn 
Summary0017994: Build: linking fails with WANT_GRAPHICSMAGICK when GraphicsMagick is not in a default linker path
DescriptionWith -DWANT_GRAPHICSMAGICK=1, GraphicsMagick is found by pkg-config, but linking the Scribus executable fails when the library is not in a default linker search path, e.g. Homebrew on macOS (/opt/homebrew/lib):

    ld: library 'GraphicsMagick' not found

Cause, in scribus/CMakeLists.txt:
- the executable links ${GMAGICK_LIBRARIES}; pkg_check_modules() fills that variable with bare library names ("GraphicsMagick"), without the directory;
- the directory was meant to be added with link_directories(${GMAGICK_LIBRARY}), but pkg_check_modules() never sets GMAGICK_LIBRARY (it would be GMAGICK_LIBRARY_DIRS), so that call does nothing.

On Linux distributions the library usually sits in /usr/lib, which hides the problem.

Fix (patch attached, against trunk r27875): link ${GMAGICK_LINK_LIBRARIES}, which pkg_check_modules() provides with full paths (CMake >= 3.12; Scribus requires 3.16), and remove the ineffective link_directories() call.
Steps To Reproduce1. Install GraphicsMagick outside the default linker paths, e.g. on macOS: brew install graphicsmagick (installs into /opt/homebrew).
2. Configure and build with GraphicsMagick enabled:
       cmake -S scribus -B build -G Ninja -DWANT_GRAPHICSMAGICK=1
       cmake --build build
   -> Expected: the executable links against libGraphicsMagick.
   -> Actual: "ld: library 'GraphicsMagick' not found" when linking the executable.
Additional InformationEnvironment: macOS 26.6 (Tahoe), Apple Silicon, Homebrew (GraphicsMagick 1.3.48), CMake 4.4.3, Ninja 1.13.2, Qt 6.11.2, Scribus 1.7.4.svn trunk r27875.

Workaround without the patch: -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/graphicsmagick/lib

Verified with the patch applied: clean build directory, no extra linker flags, full build succeeds; the executable links /opt/homebrew/opt/graphicsmagick/lib/libGraphicsMagick.3.dylib (checked with otool -L). GMAGICK_LIBRARIES is only used for the main executable, so no plugin needs the same change.

The patch was prepared with AI assistance (Claude Code) and reviewed and tested by me; it carries a Co-Authored-By trailer.
Tagsbuild
Attached Files
0009-Link-GraphicsMagick-by-full-path-from-pkg-config.patch (1,532 bytes)   
From e8fa29dc1c1fc0a1c506bf093102a7fea566c0bc Mon Sep 17 00:00:00 2001
From: Satoshi Nakamoto <satoshi.nakamoto.xdos@proton.me>
Date: Thu, 1 Oct 2026 04:46:25 +0200
Subject: [PATCH 9/9] Link GraphicsMagick by full path from pkg-config

With WANT_GRAPHICSMAGICK, the executable linked ${GMAGICK_LIBRARIES},
which pkg_check_modules() fills with bare library names
("GraphicsMagick"), and tried to add the library directory with
link_directories(${GMAGICK_LIBRARY}), a variable pkg_check_modules()
never sets. Linking therefore only worked when GraphicsMagick lives in a
default linker path; with Homebrew on macOS (/opt/homebrew/lib) it failed
with "library 'GraphicsMagick' not found".

Link ${GMAGICK_LINK_LIBRARIES} (full paths, CMake >= 3.12) and drop the
ineffective link_directories() call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---
 scribus/CMakeLists.txt | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/scribus/CMakeLists.txt b/scribus/CMakeLists.txt
index 1dafac139..f5166a5b0 100644
--- a/scribus/CMakeLists.txt
+++ b/scribus/CMakeLists.txt
@@ -106,9 +106,6 @@ if (GMAGICK_FOUND)
 	include_directories(
 		BEFORE ${GMAGICK_INCLUDE_DIRS}
 	)
-	link_directories(
-		${GMAGICK_LIBRARY}
-	)
 endif()
 
 if(HAVE_PODOFO)
@@ -229,7 +226,7 @@ target_link_libraries(${EXE_NAME}
 	PRIVATE
 	${CUPS_LIBRARIES}
 	${FREETYPE_LIBRARIES}
-	${GMAGICK_LIBRARIES}
+	${GMAGICK_LINK_LIBRARIES}
 	${HARFBUZZ_LIBRARIES}
 	${HARFBUZZ_SUBSET_LIBRARIES}
 	${hunspell_LIBRARIES}
-- 
2.54.0 (Apple Git-157)

PatchYes

Activities

Issue History

Date Modified Username Field Change
2026-10-01 10:29 jaca101 New Issue
2026-10-01 10:29 jaca101 Tag Attached: build
2026-10-01 10:29 jaca101 File Added: 0009-Link-GraphicsMagick-by-full-path-from-pkg-config.patch
2026-10-01 20:27 cbradney Assigned To => cbradney
2026-10-01 20:27 cbradney Status new => resolved
2026-10-01 20:27 cbradney Resolution open => fixed
2026-10-01 20:27 cbradney Fixed in Version => 1.7.4.svn
2026-10-01 21:01 cbradney Fixed in Version 1.7.4.svn => 1.6.7.svn
2026-10-17 20:07 cbradney Status resolved => closed