Monday, November 30, 2020

[macppc] Fix archivers/innoextract

Hi,

> http://build-failures.rhaalovely.net/powerpc/2020-11-11/archivers/innoextract.log

The problem actually lies here:

> -- Checking C++11 feature: std::unique_ptr - unsupported
Run Build Command(s):/usr/local/bin/ninja cmTC_057
[...]
: && /usr/ports/pobj/innoextract-1.9/bin/c++ -O2 -pipe
-fmerge-all-constants -ffast-math -std=c++17 -fuse-linker-plugin
-Wl,--no-undefined -Wl,--as-needed
CMakeFiles/cmTC_057e6.dir/cxx11-std-unique_ptr.cpp.o -o cmTC_057e6
-Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :
/usr/bin/../lib/libc++abi.so.3.0: undefined reference to
`pthread_rwlock_rdlock'
[... more undefined references to pthread symbols ...]
c++: error: linker command failed with exit code 1

Innoextract then falls back to using std::auto_ptr, which is disabled
by C++17. It shows up now, because -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
has been ... removed by a recent commit.

The problem can be fixed by removing '-Wl,--as-needed', as often seen
on ld.bfd archs. We can't supply LDFLAGS to fix this, they're removed
during the test.

I thought it was better to point out the real issue instead of enabling
std::auto_ptr.

The below diff does that and it builds and runs fine on macppc (tested
with the Return to Castle Wolfenstein GOG installer).

That REVISION never built there, so i have not bumped it. sparc64
builds it fine ootb, and mips64 has no boost due to libexecinfo not
being built, so no other ld.bfd archs are impacted. As such, adding a
NO_AS_NEEDED cmake option looks like an overkill to me.

Feedback and alternatives are welcome.

Charlène.


Index: patches/patch-cmake_BuildType_cmake
===================================================================
RCS file: patches/patch-cmake_BuildType_cmake
diff -N patches/patch-cmake_BuildType_cmake
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-cmake_BuildType_cmake 30 Nov 2020 16:46:37 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+
+Index: cmake/BuildType.cmake
+--- cmake/BuildType.cmake.orig
++++ cmake/BuildType.cmake
+@@ -301,6 +301,15 @@ else(MSVC)
+ if(MACOS)
+ # TODO For some reason this check succeeds on macOS, but then
+ # flag causes the actual build to fail :(
++ elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD"
++ AND CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc")
++ # XXX Need a review once lld is the default linker on powerpc
++ # -Wl,--as-needed causes the std::unique_ptr test to
++ # fail due to undefined reference errors, and user
++ # supplied linker flags are removed during the test. A
++ # fallback exists, using std::auto_ptr, but it has been
++ # disabled by C++17. Use the same code as other archs
++ # instead of reenabling std::auto_ptr.
+ else()
+ # Link as few libraries as possible
+ # This is much easier than trying to decide which libraries are needed for each

No comments:

Post a Comment