View Issue Details

IDProjectCategoryView StatusLast Update
0016614ScribusBuild Systempublic2021-11-09 21:39
Reporterfsimonis Assigned Tojghali  
PrioritynormalSeveritymajorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.5.8.svn 
Fixed in Version1.5.8.svn 
Summary0016614: EXE Linker flags incorrect for clang
DescriptionThe linker flags of the executable are set for GCC, but not clang.
Thus compiling with clang leads to unresolved symbols when loading plugins.

The attached patch fixes this.
TagsNo tags attached.
PatchYes

Activities

fsimonis

2021-08-11 10:47

reporter  

0001-Fix-linker-flags-using-clang.patch (1,178 bytes)   
From bc6e04628bb3c0d2fe220f06752e4b986292b025 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= <simonisfrederic@gmail.com>
Date: Mon, 9 Aug 2021 15:52:55 +0200
Subject: [PATCH] Fix linker flags using clang

---
 scribus/CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scribus/CMakeLists.txt b/scribus/CMakeLists.txt
index 03b4ef179..943af231a 100644
--- a/scribus/CMakeLists.txt
+++ b/scribus/CMakeLists.txt
@@ -762,13 +762,15 @@ if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD"
 # Should fix bug 6897 .
 	set_target_properties(${EXE_NAME} PROPERTIES LINK_FLAGS -Wl,-E)
 endif ()
-if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT WIN32)
+
+if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT WIN32)
 # Use the -E / --export-dynamic flag to ensure that symbols in the Scribus
 # binary are in the public symbol table for plugins. The symbols must also
 # be set as SCRIBUS_API if we're building with -fvisibility=hidden .
 # Should fix bug 6897 .
 	set_target_properties(${EXE_NAME} PROPERTIES LINK_FLAGS -Wl,-E)
 endif ()
+
 ##
 
 
-- 
2.32.0

jghali

2021-08-11 13:40

administrator   ~0049207

Fixed. I would be however curious to see if that replacing the set_target_properties() by this line could also solve the problem:
set_target_properties(${EXE_NAME} PROPERTIES ENABLE_EXPORTS 1)

fsimonis

2021-08-11 14:29

reporter   ~0049212

Right. The ideal solution would be to replace the flag twiddling with:

ENABLE_EXPORTS
POSITION_INDEPENDENT_CODE
CXX_VISIBILITY_PRESET

This "should" be relatively simple as the API is already marked with SCRIBUS_API and PLUGIN_API.

Issue History

Date Modified Username Field Change
2021-08-11 10:47 fsimonis New Issue
2021-08-11 10:47 fsimonis File Added: 0001-Fix-linker-flags-using-clang.patch
2021-08-11 13:40 jghali Note Added: 0049207
2021-08-11 13:41 jghali Assigned To => jghali
2021-08-11 13:41 jghali Status new => resolved
2021-08-11 13:41 jghali Resolution open => fixed
2021-08-11 13:41 jghali Fixed in Version => 1.5.8.svn
2021-08-11 14:29 fsimonis Note Added: 0049212
2021-11-09 21:39 cbradney Status resolved => closed