fix: ncurses/ncursesw need -fPIC for static linking into PIE

--with-pic alone doesn't generate PIC code in newer ncurses (6.6+).
The static archive produced non-PIC objects using R_X86_64_PC32
relocations, which can't be linked into PIE executables.

Forced PIC via:
- Switched DYNAMIC_INIT → DYNAMIC_STATIC_INIT (builds both shared AND static)
- Added CFLAGS+=+=-fPIC CXXFLAGS+=+=-fPIC export (forces PIC at compile)

redbear-netctl-console now links successfully against libncursesw.a.
This commit is contained in:
2026-07-12 22:46:27 +03:00
parent 34d9d28d9e
commit cbb1d7ec37
2 changed files with 7 additions and 2 deletions
+3 -1
View File
@@ -8,7 +8,7 @@ patches = [
[build]
template = "custom"
script = """
DYNAMIC_INIT
DYNAMIC_STATIC_INIT
COOKBOOK_CONFIGURE_FLAGS+=(
--disable-db-install
--disable-stripping
@@ -26,6 +26,8 @@ if [ "${COOKBOOK_DYNAMIC}" == "1" ]
then
COOKBOOK_CONFIGURE_FLAGS+=(--with-shared)
fi
export CFLAGS="${CFLAGS} -fPIC"
export CXXFLAGS="${CXXFLAGS} -fPIC"
cookbook_configure
"""
+4 -1
View File
@@ -8,7 +8,7 @@ same_as = "../ncurses"
[build]
template = "custom"
script = """
DYNAMIC_INIT
DYNAMIC_STATIC_INIT
COOKBOOK_CONFIGURE_FLAGS+=(
--disable-db-install
--disable-ext-colors
@@ -24,6 +24,9 @@ COOKBOOK_CONFIGURE_FLAGS+=(
cf_cv_func_mkstemp=yes
cf_cv_wint_t=yes
)
# Force PIC compilation - --with-pic alone doesn't always work for static libs
export CFLAGS="${CFLAGS} -fPIC"
export CXXFLAGS="${CXXFLAGS} -fPIC"
cookbook_configure
"""