On Wed, Sep 04, 2024 at 11:28:49AM +0100, Stuart Henderson wrote:
> On 2024/09/04 11:09, Tom Smyth wrote:
> > Hi 
> > Is the nsh static build failing because  the nsh  dynamic build is locked ?
> 
> no, it's failing because of linker errors around libm symbols
> http://build-failures.rhaalovely.net/sparc64/2024-09-01/shells/nsh,static.log
> 
> > it seems to be working on amd64, and arm64.
> 
> sparc64 uses a different toolchain (compiler, linker, etc)
> 
> it might be worth trying this (I don't have sparc64)
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/shells/nsh/Makefile,v
> diff -u -p -r1.51 Makefile
> --- Makefile  19 Jun 2024 15:09:50 -0000      1.51
> +++ Makefile  4 Sep 2024 10:27:59 -0000
> @@ -32,7 +32,7 @@ LIB_DEPENDS =       databases/sqlite3
>  FAKE_FLAGS = PREFIX=${TRUEPREFIX}
> 
>  .if ${FLAVOR:Mstatic}
> -MAKE_FLAGS +=        LDFLAGS="-L${LOCALBASE}/lib -ledit -ltermcap -lsqlite3 
> -lm -lpthread -static"
> +MAKE_FLAGS +=        LDFLAGS="-L${LOCALBASE}/lib -ledit -ltermcap -lm 
> -lsqlite3 -lpthread -static"
>  .endif
> 
>  NO_TEST=     Yes
> 

It appears that the problem was due to -lsqlite3 appearing too far
towards at the tail of the linker command line.

Fixed upstream (with testing help from tb@) by providing a 'make static'
build target which passes all linker flags in the correct order:
https://github.com/yellowman/nsh/commit/21b1dfdbf54e96ff9cb8cb9a05f38ac2d344dbaa

Since a new nsh release is planned soon I'd recommend waiting for
that release to happen instead of patching the port for this.

Reply via email to