Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a block to look for OpenSSL when pkconfig is not defined. #379

Closed
wants to merge 1 commit into from
Closed

Add a block to look for OpenSSL when pkconfig is not defined. #379

wants to merge 1 commit into from

Conversation

aixtools
Copy link
Contributor

@aixtools aixtools commented May 3, 2022

(Sadly) AIX is no longer a supported platform - and as AIX does not have pkconfig installed, the current checks for OpenSSL will never find OpenSSL - even though it is there.

This patch is an extract from the autoconf macro AX_CHECK_OPENSSL - that bases it's find on finding ssl.h.

@michaelrsweet
Copy link
Member

@aixtools OK, so I am uncomfortable taking the OpenSSL tests from the autoconf archive verbatim, and the test needs to define the TLSFLAGS, TLSLIBS, have_tls, and with_tls variables. Also, we really need to use a linking check, otherwise cross-compilation and installations in other directories will break, badly.

@aixtools aixtools marked this pull request as draft May 4, 2022 11:27
@aixtools
Copy link
Contributor Author

aixtools commented May 4, 2022

I added several comments in #375 - re the steps I took to get it to build for 98% (the manual bit was to create the libcups.a by adding both the 32-bit lib*.so.2 and later the 64-bit lib*.so.2 files.

So, for OpenSSL - I saw that, in any case, the TLSLIBS needed to be added. In this case TLSFLAGS was not needed, but if the entire AX_CHECk_OPENSSL macro was adopted you could also add --with-openssl=/some/where and it would take an OpenSSL from that location.

So, what might be an easy change is getting DSOFLAGS to be different (when AIX). However, I am uncertain what is needed re: LDFLAGS. (I had noticed, with the wrong flags libcups.so.2 was getting the other libraries (-liconv, -lz, -lm, -lcrypto and -lssl) information 'self-contained'. IMHO: that is an error and I continued searching - and came up with the simplest argument to ld - -G.

The make install activities does not include the libcups.a archive, so before the final packaging I used for testing I manually crested (as mentioned above) the ${prefix}/lib/libcups.a with both the 32 and 64 ${prefix}/lib*so.2 files.

My test is simply that it is accepted by ./configure by a project demanding cups support.

With some quidance I am happy to work on a PR or PR's that are acceptable for the project.

@michaelrsweet michaelrsweet self-assigned this May 4, 2022
Copy link
Member

@michaelrsweet michaelrsweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Just adding an actual review of the changes for Zdonal who is the CUPS 2.4.x release manager)

Not quite ready for merge - need to refactor the OpenSSL checks to use any CFLAGS/CPPFLAGS/LDFLAGS passed in to the configure script and do linker checks for libcrypto and libssl...

@michaelrsweet
Copy link
Member

@aixtools WRT libcups.a not getting installed, if you use the "--enable-static" or "--disable-shared" configure options it will, otherwise only the shared libraries get installed.

As for mixed 32-bit and 64-bit builds, unless AIX has something like macOS's multiple-architecture binaries, I'd do two separate builds where the second build you do is 32-bit (assuming that all AIX systems will do 64-bit these days?) for just the libraries, e.g.:

CFLAGS="..." CPPFLAGS="..." LDFLAGS="..." ./configure --with-components=libcups --libdir=/path/to/32-bit/libs
make
make install-libs

@aixtools
Copy link
Contributor Author

aixtools commented May 4, 2022

  • refactor sounds like something I do not directly understand - so I don't know how to proceed. Hacking in the entire AX_CHECK_OPENSSL, even if I did in the spot you identified does not feel like the correct location.
  • I would add the macro, and call the macro - and add my extra bits in the (assumed) spaces provided by the macro.
  • as to libcups.a - it is not uncommon on AIX to have both shared and static installed - with the .so file ALSO in the .a file.
  • In the example below: since only one .so file can be installed, for mixed support you need an additional library (e.g., /usr/lib64). Common in the Linux world, but less so in AIX (it happens, but the VAR ensures the application has different dlopen search paths).
  • with the following, in 64-bit mode, dlopen and dynamic rtl the libcups.so file is found first, and for 32-bit mode, since the .so file is the wrong mode, the search continues and it finds the 32-bit .so in the libcups.a file. More common on AIX is no .so file, and only the .a archive with dual members.
root@adopt10:[/opt/aixtools/lib]ls -l
total 88
drwxr-xr-x   10 bin      bin             256 May  4 09:31 cups
-rw-r--r--    1 bin      bin           22388 May  4 09:53 libcups.a
lrwxrwxrwx    1 root     system           12 May  4 12:03 libcups.so -> libcups.so.2
-rwxr-xr-x    1 bin      bin            5032 May  4 09:31 libcups.so.2
lrwxrwxrwx    1 root     system           17 May  4 12:03 libcupsimage.so -> libcupsimage.so.2
-rwxr-xr-x    1 bin      bin            5045 May  4 09:31 libcupsimage.so.2
drwxr-xr-x   14 bin      bin            4096 May  4 09:31 locale
drwxr-xr-x    2 bin      bin             256 May  4 09:31 pkgconfig
root@adopt10:[/opt/aixtools/lib]ar -Xany tv libcups.a
rwxr-xr-x     2/2       5032 May  4 09:31 2022 libcups.so.2
rwxr-xr-x     2/2       5045 May  4 09:31 2022 libcupsimage.so.2
rwxr-xr-x     2/2       4681 May  4 08:46 2022 libcups.so.2
rwxr-xr-x     2/2       4694 May  4 08:46 2022 libcupsimage.so.2
root@adopt10:[/opt/aixtools/lib]ar -X64 tv libcups.a
rwxr-xr-x     2/2       5032 May  4 09:31 2022 libcups.so.2
rwxr-xr-x     2/2       5045 May  4 09:31 2022 libcupsimage.so.2
root@adopt10:[/opt/aixtools/lib]ar -X32 tv libcups.a
rwxr-xr-x     2/2       4681 May  4 08:46 2022 libcups.so.2
rwxr-xr-x     2/2       4694 May  4 08:46 2022 libcupsimage.so.2

@aixtools
Copy link
Contributor Author

aixtools commented May 4, 2022

  • iirc, mac calls them fat libraries - and yes, that is the default behavior for archives. Applications find the appropriate member.
  • default is still 32-bit.
  • my process is roughly (buildaix; mkX32; make distclean; export OBJECT_SIZE=64; buildaix; mkX64; mkXany; buildaix -DXany | ksh
  • buildaix is a set of scripts that calls configure, make, make install DESTDIR=/some/where; mkinstallp /some/where - the end result is a single file such as http://download.aixtools.net/test/aixtools.cups.2.4.1.1.I

@michaelrsweet
Copy link
Member

I've pushed the following which should work:

[master dd93106] Look for OpenSSL the old way if pkg-config is not available (Issue #375)

It is missing the rsaref library checks from CUPS 1.2.12 but I don't think those have been necessary for a very long time.

@aixtools aixtools deleted the cups-openssl branch May 4, 2022 15:01
@aixtools
Copy link
Contributor Author

aixtools commented May 9, 2022

Thx. Is working great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants