Skip to content

Commit 3a70d34

Browse files
committed
chore: wip
1 parent e4e9238 commit 3a70d34

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/build-php.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,12 @@ async function buildPhp(config: BuildConfig): Promise<string> {
868868
buildEnv.PKG_CONFIG_PATH = pkgConfigPaths.join(':')
869869
}
870870

871-
buildEnv.LDFLAGS = libPaths.map(path => `-L${path}`).join(' ')
871+
// Filter out libstdcxx paths on Linux to avoid linking issues
872+
const filteredLibPaths = config.platform === 'linux'
873+
? libPaths.filter(path => !path.includes('libstdcxx'))
874+
: libPaths
875+
876+
buildEnv.LDFLAGS = filteredLibPaths.map(path => `-L${path}`).join(' ')
872877
buildEnv.CPPFLAGS = includePaths.map(path => `-I${path}`).join(' ')
873878

874879
// Add macOS-specific linker flags for DNS resolver functions
@@ -896,8 +901,7 @@ async function buildPhp(config: BuildConfig): Promise<string> {
896901
buildEnv.CXX = 'g++'
897902
buildEnv.CFLAGS = (buildEnv.CFLAGS || '') + ' -O2 -fPIC'
898903
buildEnv.CXXFLAGS = (buildEnv.CXXFLAGS || '') + ' -O2 -fPIC'
899-
// Use system libstdc++ and iconv instead of Launchpad's to avoid linking issues
900-
buildEnv.LDFLAGS = buildEnv.LDFLAGS.replace(/-L[^\s]*libstdcxx[^\s]*/g, '')
904+
// Use system libstdc++ instead of Launchpad's to avoid linking issues
901905
// Set preprocessor to avoid traditional-cpp issues
902906
buildEnv.CPP = 'gcc -E'
903907
// Disable iconv completely on Linux due to glibc errno check failure

0 commit comments

Comments
 (0)