libpsl icon indicating copy to clipboard operation
libpsl copied to clipboard

Add support for compiles on HPE NonStop

Open rsbeckerca opened this issue 1 year ago • 10 comments

Fixes: #229

rsbeckerca avatar Jan 31 '24 22:01 rsbeckerca

I still need help convincing configure to build a DLL. The arguments are not the same as for gcc and configure gets confused about it. -Wshared is the trigger to build .so files.

rsbeckerca avatar Jan 31 '24 22:01 rsbeckerca

Looking at the relevant libtool logic it appears that it matches irix5* | irix6* | nonstopux* and defines $archive_cmds to use -shared. Rough summary:

      if test yes = "$GCC"; then
        archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
      else
        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'

eli-schwartz avatar Jan 31 '24 23:01 eli-schwartz

Looking at the relevant libtool logic it appears that it matches irix5* | irix6* | nonstopux* and defines $archive_cmds to use -shared. Rough summary:

      if test yes = "$GCC"; then
        archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
      else
        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'

nonstopux* is not the same. It is, in fact, deprecated - old product naming from when Compaq owned Tandem and made everything "NonStop". This is a separate set of platforms - nsx-tandem-nsk and nse-tandem-nsk are currently value entries from config.guess. -Wshared is what is needed.

rsbeckerca avatar Feb 01 '24 02:02 rsbeckerca

:(

Those host identifiers aren't shown anywhere in libtool.m4 (which is used to generate the libtool script by configure) that I can tell.

My conclusion is that while config.guess knows the platform exists, libtool in particular doesn't actually do anything whatsoever with that information and does not know how to build libraries for nonstop. (This is ironic since the one selling point of libtool is supposed to be that it works on any platform ever.)

eli-schwartz avatar Feb 01 '24 02:02 eli-schwartz

Explains why libtool is a noop on the platform

rsbeckerca avatar Feb 01 '24 02:02 rsbeckerca

This PR also includes changes to some tests to honor HAVE_ALLOCA_H. The changes build and test correctly on the NonStop (TANDEM) x86 platform.

rsbeckerca avatar Feb 01 '24 21:02 rsbeckerca

@rsbeckerca Thanks for your contribution ! If we can get in #228, there should be no need to include network header files. I'll come back to here once #228 has been closed or merged.

rockdaboot avatar Feb 04 '24 14:02 rockdaboot

@rsbeckerca Thanks for your contribution ! If we can get in #228, there should be no need to include network header files. I'll come back to here once #228 has been closed or merged.

Let me know when you are ready. I can reroll the PR if you want. I think netdb.h is also required but not for #228.

rsbeckerca avatar Feb 04 '24 15:02 rsbeckerca

@rsbeckerca Removal of alloca: #231 Please drop that alloca commit from your PR (feel free to force-push).

rockdaboot avatar Feb 04 '24 17:02 rockdaboot

@rsbeckerca Removal of alloca: #231 Please drop that alloca commit from your PR (feel free to force-push).

Should be done. I repushed the original commit dropping e85cddd.

rsbeckerca avatar Feb 04 '24 18:02 rsbeckerca

@rsbeckerca Can you try to build and run tests from latest master without any changes?

rockdaboot avatar Mar 23 '24 18:03 rockdaboot

@rsbeckerca Can you try to build and run tests from latest master without any changes?

No, there are a few patches I have to apply to make this work. The summary of what I have to do from the tarball is as follows:

	        	sed "/<ws2tcpip.h>/a #elif defined __TANDEM" -i src/psl.c
	        	sed "/defined __TANDEM/a # include <unistd.h>" -i src/psl.c
	        	sed "/defined __TANDEM/a # include <netinet/in.h>" -i src/psl.c
	        	sed "/defined __TANDEM/a # include <netinet/in6.h>" -i src/psl.c
	        	sed "/defined __TANDEM/a # include <netdb.h>" -i src/psl.c
	        	sed "/defined __TANDEM/a # include <sys/socket.h>" -i src/psl.c

	        	sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-cookie-domain-acceptable.c
	        	sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-public-all.c
	        	sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-public-builtin.c
	        	sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-public.c
	        	sed "s/alloca(/(char *)malloc(/g" -i tests/test-registrable-domain.c

rsbeckerca avatar Mar 23 '24 19:03 rsbeckerca

@rsbeckerca Can you try to build and run tests from latest master without any changes?

No, there are a few patches I have to apply to make this work. The summary of what I have to do from the tarball is as follows:

	        	sed "/<ws2tcpip.h>/a #elif defined __TANDEM" -i src/psl.c
	        	sed "/defined __TANDEM/a # include <unistd.h>" -i src/psl.c
	        	sed "/defined __TANDEM/a # include <netinet/in.h>" -i src/psl.c
	        	sed "/defined __TANDEM/a # include <netinet/in6.h>" -i src/psl.c
	        	sed "/defined __TANDEM/a # include <netdb.h>" -i src/psl.c
	        	sed "/defined __TANDEM/a # include <sys/socket.h>" -i src/psl.c

	        	sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-cookie-domain-acceptable.c
	        	sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-public-all.c
	        	sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-public-builtin.c
	        	sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-public.c
	        	sed "s/alloca(/(char *)malloc(/g" -i tests/test-registrable-domain.c

Are you sure you are using latest git master? Because all usages of alloca() have been replaced/removed, as well as all the network related include directives.

Latest commit is

commit 15e7f407cbadf950410e45d97e76773b40377ac6 (HEAD -> master, origin/master, origin/HEAD)
Author: Tim Rühsen <[email protected]>
Date:   Sat Mar 23 18:16:17 2024 +0100

Just saw you are building from tarball... here the tarball with the latest changes: libpsl-0.21.5-15e7f407.tar.gz

rockdaboot avatar Mar 24 '24 15:03 rockdaboot

I can build libpsl.a from the above tarball. Thanks. configure.ac needs a little tweeking to get a .so file, but I don't have a delivery requirement for that, so it is fine as is for now.

rsbeckerca avatar Mar 24 '24 15:03 rsbeckerca

I can build libpsl.a from the above tarball. Thanks. configure.ac needs a little tweeking to get a .so file, but I don't have a delivery requirement for that, so it is fine as is for now.

Thanks for testing. Then I close this issue and #229.

rockdaboot avatar Mar 24 '24 17:03 rockdaboot