From e5e205bdda38bfbfbdd18782548b0cbe5a304ecd Mon Sep 17 00:00:00 2001 From: Curtis Hamilton Date: Thu, 15 Jan 2026 14:18:01 -0500 Subject: [PATCH 1/3] Work around for issuea #383 and #443 For some reason 'gcc -print-file-name' does not return path for startup files on powerpc64. This is a work around. --- src/compiler/fbc.bas | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas index 8e32c5d6d..f7c293551 100644 --- a/src/compiler/fbc.bas +++ b/src/compiler/fbc.bas @@ -394,6 +394,35 @@ private function fbcBuildPathToLibFile( byval file as zstring ptr ) as string end if #endif + '' FreeBSD: Prefer base system locations for CRT objects. + '' Do this *before* invoking gcc -print-file-name, because on some setups + '' gcc may return just the basename (no sysroot configured). + if( fbGetCpuFamily( ) = FB_CPUFAMILY_PPC64 ) then + select case lcase( *file ) + case "crt1.o", "gcrt1.o", "crti.o", "crtn.o", _ + "crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o" + dim as string tryfile + + tryfile = "/usr/lib/" + *file + if( hFileExists( tryfile ) ) then + function = tryfile + exit function + end if + + tryfile = "/usr/lib64/" + *file + if( hFileExists( tryfile ) ) then + function = tryfile + exit function + end if + + tryfile = "/lib/" + *file + if( hFileExists( tryfile ) ) then + function = tryfile + exit function + end if + end select + end if + '' Does it exist in our lib/? if( hFileExists( found ) ) then '' Overrides anything else @@ -4191,6 +4220,20 @@ private sub hSetDefaultLibPaths( ) '' and the current path fbcAddDefLibPath( "." ) + '' + '' FreeBSD base system libraries live in /usr/lib and /lib. + '' When fbc invokes ld directly (not via cc), it must provide these + '' search paths explicitly so -lc/-lm/-lpthread/-lncurses/-lgcc can + '' be resolved by the linker. + '' + '' Only add them for native builds (no --sysroot); cross builds should + '' rely on --sysroot or explicit -p/-P paths. + '' + if(fbGetCpuFamily( ) = FB_CPUFAMILY_PPC64) andalso (len( fbc.sysroot ) = 0) ) then + fbcAddDefLibPath( "/usr/lib" ) + fbcAddDefLibPath( "/lib" ) + end if + #ifndef ENABLE_STANDALONE '' Add gcc's private lib directory, to find libgcc '' This is for installing into Unix-like systems, and not for From df36ee3deaa1268c7fffec989b73aa4ab5be2efa Mon Sep 17 00:00:00 2001 From: Curtis Hamilton Date: Thu, 15 Jan 2026 17:44:22 -0500 Subject: [PATCH 2/3] Fix Powerpc64 work around --- src/compiler/fbc.bas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas index f7c293551..a9fba685d 100644 --- a/src/compiler/fbc.bas +++ b/src/compiler/fbc.bas @@ -409,7 +409,7 @@ private function fbcBuildPathToLibFile( byval file as zstring ptr ) as string exit function end if - tryfile = "/usr/lib64/" + *file + tryfile = "/usr/lib/" + *file if( hFileExists( tryfile ) ) then function = tryfile exit function @@ -4229,8 +4229,10 @@ private sub hSetDefaultLibPaths( ) '' Only add them for native builds (no --sysroot); cross builds should '' rely on --sysroot or explicit -p/-P paths. '' - if(fbGetCpuFamily( ) = FB_CPUFAMILY_PPC64) andalso (len( fbc.sysroot ) = 0) ) then + if( (fbGetCpuFamily( ) = FB_CPUFAMILY_PPC64) andalso (len( fbc.sysroot ) = 0) ) then fbcAddDefLibPath( "/usr/lib" ) + fbcAddDefLibPath( "/usr/lib64" ) + fbcAddDefLibPath( "/usr/local/lib" ) fbcAddDefLibPath( "/lib" ) end if @@ -4319,6 +4321,7 @@ private sub hAddDefaultLibs( ) defined(__FB_OPENBSD__) or _ defined(__FB_NETBSD__) fbcAddDefLibPath( "/usr/X11R6/lib" ) + fbcAddDefLibPath( "/usr/local/lib" ) #endif #if defined(__FB_DARWIN__) and defined(ENABLE_XQUARTZ) From 07e56fb715e78ec3a920fe564902b0b48472974a Mon Sep 17 00:00:00 2001 From: Curtis Hamilton Date: Thu, 15 Jan 2026 18:27:41 -0500 Subject: [PATCH 3/3] Revert unintended change --- src/compiler/fbc.bas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas index a9fba685d..7adf505ca 100644 --- a/src/compiler/fbc.bas +++ b/src/compiler/fbc.bas @@ -409,7 +409,7 @@ private function fbcBuildPathToLibFile( byval file as zstring ptr ) as string exit function end if - tryfile = "/usr/lib/" + *file + tryfile = "/usr/lib64/" + *file if( hFileExists( tryfile ) ) then function = tryfile exit function