Bug 274484

Summary: build failure - linking kstat
Product: [Applications] digikam Reporter: tropikhajma <tropikhajma>
Component: Portability-CmakeAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles
Priority: NOR    
Version: 2.0.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Solaris   
Latest Commit: Version Fixed In: 2.5.0
Sentry Crash Report:

Description tropikhajma 2011-05-29 23:56:39 UTC
Version:           2.0.0 (using KDE 4.6.2) 
OS:                Solaris

building digikam-2.0.0-beta5 fails with the below error.


Linking CXX executable testlensfuniface
cd /home/test/packages/BUILD/digikam-2.0.0-beta5/i386/digikam-2.0.0-beta5/build/core/libs/dimg/filters/lens && /opt/kde4/bin/cmake -E cmake_link_script CMakeFiles/testlensfuniface.dir/link.txt --verbose=1
/usr/gcc/4.5/bin/g++    -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden -fvisibility-inlines-hidden -O2 -g -DNDEBUG -DQT_NO_DEBUG   CMakeFiles/testlensfuniface.dir/testlensfuniface_automoc.cpp.o CMakeFiles/testlensfuniface.dir/testlensfuniface.cpp.o  -o testlensfuniface  -L/opt/kde4/lib -L/home/test/packages/BUILD/digikam-2.0.0-beta5/i386/digikam-2.0.0-beta5/build/lib ../../../../../lib/libdigikamcore.so.2.0.0 /opt/kde4/lib/libQtCore.so -lthread /opt/kde4/lib/libkdecore.so.5.6.0 ../../../../../lib/libkexiv2.so.10.0.0 /opt/kde4/lib/libkdecore.so.5.6.0 /opt/kde4/lib/libQtCore.so -lthread /opt/kde4/lib/libQtDBus.so -Wl,-R/home/test/packages/BUILD/digikam-2.0.0-beta5/i386/digikam-2.0.0-beta5/build/lib:/opt/kde4/lib 
ld: warning: file /opt/kde4/lib/libkdecore.so.5.6.0: attempted multiple inclusion of file
ld: warning: file /opt/kde4/lib/libQtCore.so: attempted multiple inclusion of file
Undefined			first referenced
 symbol  			    in file
kstat_data_lookup                   ../../../../../lib/libdigikamcore.so.2.0.0
kstat_lookup                        ../../../../../lib/libdigikamcore.so.2.0.0
kstat_read                          ../../../../../lib/libdigikamcore.so.2.0.0
kstat_open                          ../../../../../lib/libdigikamcore.so.2.0.0
kstat_close                         ../../../../../lib/libdigikamcore.so.2.0.0
ld: fatal: symbol referencing errors. No output written to testlensfuniface
collect2: ld returned 1 exit status
gmake[2]: *** [core/libs/dimg/filters/lens/testlensfuniface] Error 1


below patch fixes that, although it should probably have some platform specific ifs:
--- core/libs/dimg/filters/lens/CMakeLists.txt.orig	2011-05-29 23:03:07.143272230 +0200
+++ core/libs/dimg/filters/lens/CMakeLists.txt	2011-05-29 23:03:54.472413389 +0200
@@ -29,4 +29,5 @@
                       ${QT_QTCORE_LIBRARY}
                       ${KDE4_KDECORE_LIBS}
                       ${KEXIV2_LIBRARIES}
+                      kstat
                      )
--- core/digikam/CMakeLists.txt.orig	2011-05-29 23:32:47.655390948 +0200
+++ core/digikam/CMakeLists.txt	2011-05-29 23:33:36.660466837 +0200
@@ -279,6 +279,7 @@
         advancedrename
         queuemanager
         cameragui
+        kstat
 )
 
 IF(USE_SCRIPT_IFACE)
--- core/showfoto/CMakeLists.txt.orig	2011-05-29 23:39:06.437811852 +0200
+++ core/showfoto/CMakeLists.txt	2011-05-29 23:39:26.724301647 +0200
@@ -36,6 +36,7 @@
                       ${KDE4_KIO_LIBS}
                       ${LCMS_LIBRARIES}
                       ${QT_QT3SUPPORT_LIBRARY}
+                      kstat
                      )
 
 INSTALL(TARGETS showfoto ${INSTALL_TARGETS_DEFAULT_ARGS})
--- core/databaseserver/CMakeLists.txt.orig	2011-05-29 23:42:49.945582201 +0200
+++ core/databaseserver/CMakeLists.txt	2011-05-29 23:43:02.305416095 +0200
@@ -17,6 +17,7 @@
                       ${KDE4_KDECORE_LIBS}
                       ${QT_QTSQL_LIBRARY}
                       ${QT_QT3SUPPORT_LIBRARY}
+                      kstat
                      )
 
 INSTALL(TARGETS digikamdatabaseserver DESTINATION ${LIBEXEC_INSTALL_DIR})


Reproducible: Always
Comment 1 Marcel Wiesweg 2011-06-11 17:18:15 UTC
Would be awesome if you could provide us with these platform-specific ifs, we really cannot test. Easiest way is to setup a variable, something like SOLARIS_KSTAT_LIBS, and give it a value only if on Solaris.

Is the change in filters/lens really necessary?
I would also assume that digikamcore and digikamdatabase need to link, just to be clean.
Comment 2 tropikhajma 2011-06-11 23:12:28 UTC
I've seen this used in phonon (phonon/CMakeLists.txt):

if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
  # We need to explicitly link libm to phonon in Solaris
  target_link_libraries(phonon m)
endif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")


I don't have the build env. ready right now, it can take me a week or so to be able to play with this again.
Comment 3 caulier.gilles 2011-06-20 17:56:58 UTC
What's new in this file ?

Gilles Caulier
Comment 4 caulier.gilles 2011-12-13 13:17:04 UTC
tropikhajma,

Do you have a build env for solaris now ?

Gilles Caulier
Comment 5 caulier.gilles 2011-12-14 08:37:11 UTC
Git commit 29766dbd2457286c01c7732a3e9369b2bff13522 by Gilles Caulier.
Committed on 14/12/2011 at 09:35.
Pushed by cgilles into branch 'master'.

fix linking under Solaris with missing Math library
BUGS: 274484

M  +5    -0    CMakeLists.txt
M  +3    -0    databaseserver/CMakeLists.txt
M  +4    -1    libs/dimg/filters/lens/CMakeLists.txt
M  +3    -0    showfoto/CMakeLists.txt

http://commits.kde.org/digikam/29766dbd2457286c01c7732a3e9369b2bff13522