Skip to content

Commit d372ac6

Browse files
committed
chore: wip
1 parent 45bc58a commit d372ac6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

scripts/build-php.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,12 @@ async function buildPhp(config: BuildConfig): Promise<string> {
823823
`${launchpadRoot}/libzip.org/v1.11.4/lib/pkgconfig`
824824
]
825825

826-
buildEnv.PKG_CONFIG_PATH = pkgConfigPaths.join(':')
826+
// Filter out libstdcxx paths from PKG_CONFIG_PATH on Linux
827+
const filteredPkgConfigPaths = config.platform === 'linux'
828+
? pkgConfigPaths.filter(path => !path.includes('libstdcxx'))
829+
: pkgConfigPaths
830+
831+
buildEnv.PKG_CONFIG_PATH = filteredPkgConfigPaths.join(':')
827832

828833
// Set up targeted library and include paths
829834
const libPaths = [
@@ -865,18 +870,16 @@ async function buildPhp(config: BuildConfig): Promise<string> {
865870
libPaths.push(`${launchpadRoot}/gnu.org/libiconv/v1.18.0/lib`)
866871
includePaths.push(`${launchpadRoot}/gnu.org/libiconv/v1.18.0/include`)
867872
pkgConfigPaths.push(`${launchpadRoot}/gnu.org/libiconv/v1.18.0/lib/pkgconfig`)
873+
// Re-apply filtering with iconv added (no libstdcxx on macOS)
868874
buildEnv.PKG_CONFIG_PATH = pkgConfigPaths.join(':')
869875
}
870876

871-
// Filter out libstdcxx and gcc paths on Linux to avoid linking issues
877+
// Filter out libstdcxx paths on Linux to avoid linking issues
872878
const filteredLibPaths = config.platform === 'linux'
873-
? libPaths.filter(path => !path.includes('libstdcxx') && !path.includes('gcc'))
879+
? libPaths.filter(path => !path.includes('libstdcxx'))
874880
: libPaths
875881

876-
const ldflags = filteredLibPaths.map(path => `-L${path}`).join(' ')
877-
buildEnv.LDFLAGS = config.platform === 'linux'
878-
? `${ldflags} -lstdc++`
879-
: ldflags
882+
buildEnv.LDFLAGS = filteredLibPaths.map(path => `-L${path}`).join(' ')
880883
buildEnv.CPPFLAGS = includePaths.map(path => `-I${path}`).join(' ')
881884

882885
// Add macOS-specific linker flags for DNS resolver functions
@@ -904,12 +907,9 @@ async function buildPhp(config: BuildConfig): Promise<string> {
904907
buildEnv.CXX = 'g++'
905908
buildEnv.CFLAGS = (buildEnv.CFLAGS || '') + ' -O2 -fPIC'
906909
buildEnv.CXXFLAGS = (buildEnv.CXXFLAGS || '') + ' -O2 -fPIC'
907-
// Force use of system libstdc++ and prevent Launchpad gcc paths
908-
buildEnv.LDFLAGS = (buildEnv.LDFLAGS || '') + ' -lstdc++'
910+
// Use system libstdc++ instead of Launchpad's to avoid linking issues
909911
// Set preprocessor to avoid traditional-cpp issues
910912
buildEnv.CPP = 'gcc -E'
911-
// Clear any existing PKG_CONFIG_PATH that might include gcc paths
912-
buildEnv.PKG_CONFIG_PATH = pkgConfigPaths.filter(path => !path.includes('gcc')).join(':')
913913
// Disable iconv completely on Linux due to glibc errno check failure
914914
}
915915

0 commit comments

Comments
 (0)