To maintainer of OpenBSD x11/grantlee, CC ports list,
x11/grantlee, a library for Qt4, was broken on at least macppc and
sparc64, and blocking other Qt4 ports:
> http://build-failures.rhaalovely.net//sparc64/2018-12-19/x11/grantlee.log
> https://marc.info/?l=openbsd-ports&m=154395291303800&w=2
I propose the below diff. This solves the error "undefined reference
to `pthread_cancel'" by removing -Wl,--no-undefined from the link.
Then it removes the patches that link libc, because we don't need to
link libc after removing --Wl,--no-undefined.
If you have a powerpc machine like me, and you try to test this diff,
then you will encounter some other problems:
- devel/glib2 is broken on powerpc and sparc64. My powerpc machine
has an older ports tree, so glib2 wasn't broken yet.
- print/poppler is broken with ld.bfd. I added a temporary patch to
work around the problem.
Also, I am using devel/gcc/6 (instead of the default devel/gcc/4.9)
as ports-gcc, but gcc 6 can't build x11/qt4. I have added about ten
patches to x11/qt4 to fix it; I will share those patches later.
The below diff allows my powerpc machine (with gcc 6) to build and
package x11/grantlee. I have not looked at x11/grantlee-qt5.
Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/grantlee/Makefile,v
retrieving revision 1.13
diff -u -p -r1.13 Makefile
--- Makefile 24 Oct 2018 14:28:12 -0000 1.13
+++ Makefile 10 Jan 2019 20:39:27 -0000
@@ -2,7 +2,7 @@
COMMENT = template and text document library for Qt4
PKG_VERSION = 0.5.1
-REVISION = 4
+REVISION = 5
PLIST_VERSION = ${PKG_VERSION:R}
DISTNAME = grantlee-${PKG_VERSION}
CATEGORIES = devel x11
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: /cvs/ports/x11/grantlee/patches/patch-CMakeLists_txt,v
retrieving revision 1.1
diff -u -p -r1.1 patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt 18 Aug 2018 15:04:40 -0000 1.1
+++ patches/patch-CMakeLists_txt 10 Jan 2019 20:39:27 -0000
@@ -1,8 +1,23 @@
$OpenBSD: patch-CMakeLists_txt,v 1.1 2018/08/18 15:04:40 rsadowski Exp $
+Don't use -Wl,--no-undefined on OpenBSD. This causes linker errors
+because OpenBSD doesn't link shared objects to libc, so libc symbols
+are undefined. Even if we add libc to the link, ports-gcc errors,
+"undefined reference to `pthread_cancel'", because libgcc.a refers to
+pthread_cancel, a symbol in libpthread or weak symbol in libestdc++.
+
Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
+@@ -62,7 +62,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors")
+ endif()
+
+- if (NOT APPLE)
++ if (NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
+ set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined
${CMAKE_SHARED_LINKER_FLAGS}")
+ set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined
${CMAKE_MODULE_LINKER_FLAGS}")
+ endif ()
@@ -96,7 +96,7 @@ set (LIB_SUFFIX "" CACHE STRING "Define suffix of libr
set( LIB_INSTALL_DIR lib${LIB_SUFFIX} )
set( PLUGIN_INSTALL_DIR
lib${LIB_SUFFIX}/grantlee/${Grantlee_MAJOR_MINOR_VERSION_STRING} )
Index: patches/patch-cmake_modules_GrantleeUse_cmake
===================================================================
RCS file: patches/patch-cmake_modules_GrantleeUse_cmake
diff -N patches/patch-cmake_modules_GrantleeUse_cmake
--- patches/patch-cmake_modules_GrantleeUse_cmake 2 Jul 2015 00:10:15
-0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-$OpenBSD: patch-cmake_modules_GrantleeUse_cmake,v 1.2 2015/07/02 00:10:15 zhuk
Exp $
---- cmake/modules/GrantleeUse.cmake.orig Fri Sep 19 14:50:36 2014
-+++ cmake/modules/GrantleeUse.cmake Tue Jun 30 10:05:28 2015
-@@ -47,5 +47,6 @@ macro(GRANTLEE_ADD_PLUGIN pluginname)
- )
- target_link_libraries(${pluginname}
- grantlee_core
-+ c
- )
- endmacro()
Index: patches/patch-templates_lib_CMakeLists_txt
===================================================================
RCS file: /cvs/ports/x11/grantlee/patches/patch-templates_lib_CMakeLists_txt,v
retrieving revision 1.3
diff -u -p -r1.3 patch-templates_lib_CMakeLists_txt
--- patches/patch-templates_lib_CMakeLists_txt 18 Aug 2018 15:04:40 -0000
1.3
+++ patches/patch-templates_lib_CMakeLists_txt 10 Jan 2019 20:39:27 -0000
@@ -2,15 +2,7 @@ $OpenBSD: patch-templates_lib_CMakeLists
Index: templates/lib/CMakeLists.txt
--- templates/lib/CMakeLists.txt.orig
+++ templates/lib/CMakeLists.txt
-@@ -100,6 +100,7 @@ if (NOT Grantlee_Qt5_TRANSITIONAL)
- target_link_libraries(grantlee_core
- LINK_PUBLIC Qt4::QtCore
- LINK_PRIVATE Qt4::QtScript
-+ c
- )
- else()
- target_link_libraries(grantlee_core
-@@ -119,7 +120,7 @@ install(TARGETS grantlee_core EXPORT grantlee_targets
+@@ -119,7 +119,7 @@ install(TARGETS grantlee_core EXPORT grantlee_targets
RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT Templates
LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT Templates
ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT Templates
Index: patches/patch-templates_scriptabletags_CMakeLists_txt
===================================================================
RCS file: patches/patch-templates_scriptabletags_CMakeLists_txt
diff -N patches/patch-templates_scriptabletags_CMakeLists_txt
--- patches/patch-templates_scriptabletags_CMakeLists_txt 2 Jul 2015
00:10:15 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-$OpenBSD: patch-templates_scriptabletags_CMakeLists_txt,v 1.2 2015/07/02
00:10:15 zhuk Exp $
---- templates/scriptabletags/CMakeLists.txt.orig Fri Sep 19 14:50:36 2014
-+++ templates/scriptabletags/CMakeLists.txt Tue Jun 30 10:06:36 2015
-@@ -16,6 +16,7 @@ grantlee_add_plugin(grantlee_scriptabletags
-
- target_link_libraries(grantlee_scriptabletags
- Qt4::QtScript
-+ c
- )
-
- install(TARGETS grantlee_scriptabletags
Index: patches/patch-templates_tests_CMakeLists_txt
===================================================================
RCS file: patches/patch-templates_tests_CMakeLists_txt
diff -N patches/patch-templates_tests_CMakeLists_txt
--- patches/patch-templates_tests_CMakeLists_txt 2 Jul 2015 00:10:15
-0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-templates_tests_CMakeLists_txt,v 1.2 2015/07/02 00:10:15 zhuk
Exp $
---- templates/tests/CMakeLists.txt.orig Fri Sep 19 14:50:36 2014
-+++ templates/tests/CMakeLists.txt Tue Jun 30 10:07:37 2015
-@@ -90,7 +90,7 @@ add_library(template_test_builtins STATIC coverageobje
- ${_testresource_rcc_src}
- )
- if(NOT Grantlee_Qt5_TRANSITIONAL)
-- target_link_libraries(template_test_builtins Qt4::QtTest)
-+ target_link_libraries(template_test_builtins Qt4::QtTest c)
- else()
- target_link_libraries(template_test_builtins Qt5::Test)
- endif()
Index: patches/patch-templates_tests_pluginpointertest_CMakeLists_txt
===================================================================
RCS file: patches/patch-templates_tests_pluginpointertest_CMakeLists_txt
diff -N patches/patch-templates_tests_pluginpointertest_CMakeLists_txt
--- patches/patch-templates_tests_pluginpointertest_CMakeLists_txt 2 Jul
2015 00:10:15 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
-$OpenBSD: patch-templates_tests_pluginpointertest_CMakeLists_txt,v 1.2
2015/07/02 00:10:15 zhuk Exp $
---- templates/tests/pluginpointertest/CMakeLists.txt.orig Fri Sep 19
14:50:36 2014
-+++ templates/tests/pluginpointertest/CMakeLists.txt Tue Jun 30 10:06:56 2015
-@@ -18,6 +18,7 @@ if (Grantlee_Qt5_TRANSITIONAL)
- else()
- target_link_libraries(myplugin
- Qt4::QtCore
-+ c
- )
- endif()
-
-@@ -33,5 +34,6 @@ if (Grantlee_Qt5_TRANSITIONAL)
- else()
- target_link_libraries(main_app
- Qt4::QtCore
-+ c
- )
- endif()
Index: patches/patch-textdocument_lib_CMakeLists_txt
===================================================================
RCS file:
/cvs/ports/x11/grantlee/patches/patch-textdocument_lib_CMakeLists_txt,v
retrieving revision 1.3
diff -u -p -r1.3 patch-textdocument_lib_CMakeLists_txt
--- patches/patch-textdocument_lib_CMakeLists_txt 18 Aug 2018 15:04:40
-0000 1.3
+++ patches/patch-textdocument_lib_CMakeLists_txt 10 Jan 2019 20:39:27
-0000
@@ -2,15 +2,7 @@ $OpenBSD: patch-textdocument_lib_CMakeLi
Index: textdocument/lib/CMakeLists.txt
--- textdocument/lib/CMakeLists.txt.orig
+++ textdocument/lib/CMakeLists.txt
-@@ -26,6 +26,7 @@ generate_export_header(grantlee_gui)
- if (NOT Grantlee_Qt5_TRANSITIONAL)
- target_link_libraries(grantlee_gui
- LINK_PUBLIC Qt4::QtGui
-+ c
- )
- else()
- target_link_libraries(grantlee_gui
-@@ -44,7 +45,7 @@ install(TARGETS grantlee_gui EXPORT grantlee_targets
+@@ -44,7 +44,7 @@ install(TARGETS grantlee_gui EXPORT grantlee_targets
RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT TextDocument
LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT TextDocument
ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT TextDocument
--
George Koehler <[email protected]>