Bug 240088 - databases/p5-Tie-LevelDB: fix build on powerpc64
Summary: databases/p5-Tie-LevelDB: fix build on powerpc64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-25 00:49 UTC by Piotr Kubaj
Modified: 2019-09-03 19:19 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments
patch (1.44 KB, patch)
2019-08-25 00:49 UTC, Piotr Kubaj
pkubaj: maintainer-approval? (sunpoet)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer freebsd_triage 2019-08-25 00:49:09 UTC
Created attachment 206869 [details]
patch

The script for detecting what atomic barrier is available doesn't run because of ports' tree patches from the framework.

Add statically -DLEVELDB_CSTDATOMIC_PRESENT to CFLAGS when using gcc and change include cstdatomic (removed in gcc 4.5) to atomic.
Comment 1 Po-Chuan Hsieh freebsd_committer freebsd_triage 2019-08-26 07:47:37 UTC
Why not just include <atomic> unconditionally?

--- port/atomic_pointer.h.orig  2011-11-14 02:54:56 UTC
+++ port/atomic_pointer.h
@@ -20,6 +20,7 @@
 #define PORT_ATOMIC_POINTER_H_

 #include <stdint.h>
+#include <atomic>
 #ifdef LEVELDB_CSTDATOMIC_PRESENT
 #include <cstdatomic>
 #endif
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2019-08-27 22:46:35 UTC
This fails to build for me:

In file included from ./port/port_posix.h:28,
                 from port/port_posix.cc:5:
./port/atomic_pointer.h:24:10: fatal error: cstdatomic: No such file or directory
 #include <cstdatomic>
Comment 3 Po-Chuan Hsieh freebsd_committer freebsd_triage 2019-08-28 17:55:06 UTC
(In reply to Mark Linimon from comment #2)

I forgot to say not to add CFLAGS hack to Makefile. That would keep LEVELDB_CSTDATOMIC_PRESENT undefined and "#include <cstdatomic>" skipped for gcc on powerpc64.
Comment 4 Po-Chuan Hsieh freebsd_committer freebsd_triage 2019-09-02 22:50:50 UTC
(In reply to Sunpoet Po-Chuan Hsieh from comment #3)

The complete patch: https://people.FreeBSD.org/~sunpoet/patch/databases-p5-Tie-LevelDB.txt

@Mark and @Piotr, does it work for you?
Comment 5 Piotr Kubaj freebsd_committer freebsd_triage 2019-09-03 09:17:09 UTC
(In reply to Sunpoet Po-Chuan Hsieh from comment #4)
No. The reason is that there's a ifdef block starting at line 90, which defines AtomicPointer according to how LEVELDB_HAVE_MEMORY_BARRIER is defined.

Build with your patch fails with:
In file included from ./port/port_posix.h:28,
                 from port/port_posix.cc:5:
./port/atomic_pointer.h:134:2: error: #error Please implement AtomicPointer for this platform.
  134 | #error Please implement AtomicPointer for this platform.
      |  ^~~~~
Comment 6 Po-Chuan Hsieh freebsd_committer freebsd_triage 2019-09-03 10:56:26 UTC
(In reply to Piotr Kubaj from comment #5)

OK, I missed the #elif defined(LEVELDB_CSTDATOMIC_PRESENT) on line 110 which defines class AtomicPointer (from line 111 to 129).

I'll commit your patch. Thanks!
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-09-03 19:13:35 UTC
A commit references this bug:

Author: sunpoet
Date: Tue Sep  3 19:12:52 UTC 2019
New revision: 511027
URL: https://svnweb.freebsd.org/changeset/ports/511027

Log:
  Fix build on powerpc64

  PR:		240088
  Submitted by:	pkubaj

Changes:
  head/databases/p5-Tie-LevelDB/Makefile
  head/databases/p5-Tie-LevelDB/files/
  head/databases/p5-Tie-LevelDB/files/patch-port-atomic_pointer.h
Comment 8 Po-Chuan Hsieh freebsd_committer freebsd_triage 2019-09-03 19:19:21 UTC
Committed. Thanks!