Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/packages/mmcif.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ versions:
- filename: mmcif-1.1.1-cp314-cp314t-manylinux_2_39_riscv64.whl
sha256: 694743bd4e50b39742aae0958728c802528b8af651d870db86fe1492646d55c4
requires-python: '>=3.8'
- version: 1.2.0
39 changes: 39 additions & 0 deletions patches/mmcif/1.2.0/0001-build-compile-the-C-core-with-fPIC.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From c4810cb4b5b938fd8c2f0bff467f1fbbd4d012ec Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Thu, 10 Sep 2026 08:07:11 +0200
Subject: [PATCH] build: compile the C++ core with -fPIC

Upstream-Status: To upstream [not submitted; this port's automation may not open issues or PRs on repos other than riseproject-dev/python-wheels]

CMAKE_C_FLAGS carries -fPIC but CMAKE_CXX_FLAGS does not, so the C++
object files that make up mmciflib-all (linked into the pybind11
shared module mmciflib.*.so) are compiled position-dependent. This
goes unnoticed on x86_64/aarch64, but riscv64's binutils ld enforces
PIC strictly for shared-object relocations and segfaults while
generating the -flto link (an assertion failure in elfnn-riscv.c),
after first reporting the underlying cause:

relocation R_RISCV_HI20 against `a local symbol' can not be used
when making a shared object; recompile with -fPIC

Add -fPIC to CMAKE_CXX_FLAGS to match CMAKE_C_FLAGS.
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 35eeaca..6571ac5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,7 +60,7 @@ if (NOT CONFIGURED_ONCE)
#set(CMAKE_CXX_FLAGS "${warnings} ${mydefines} -fno-common -fvisibility=hidden -fvisibility-inlines-hidden -std=c++14 -flto "
# CACHE STRING "Flags used by the compiler during all build types." FORCE)
#
- set(CMAKE_CXX_FLAGS "${warnings} ${mydefines} -fno-common -fvisibility=hidden -fvisibility-inlines-hidden -std=c++11 -flto "
+ set(CMAKE_CXX_FLAGS "${warnings} ${mydefines} -fno-common -fvisibility=hidden -fvisibility-inlines-hidden -std=c++11 -flto -fPIC "
CACHE STRING "Flags used by the compiler during all build types." FORCE)
#
set(CMAKE_C_FLAGS "${warnings} ${mydefines} -fPIC"
--
2.50.1 (Apple Git-155)

Loading