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

Enable building on AIX #2536

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

andreaskem
Copy link

This merge request allows for a simple build on AIX using GNU make with or without cmake. The mosquitto develop branch uses an OpenSSL version that is not yet packaged for AIX, so TLS and web sockets need to be disabled. On the master branch, WITH_TLS could still be used.

Only the persistence test suite is currently failing.

  • Have you signed the Eclipse Contributor Agreement, using the same email address as you used in your commits?
  • Do each of your commits have a "Signed-off-by" line, with the correct email address? Use "git commit -s" to generate this line for you.
  • If you are contributing a new feature, is your work based off the develop branch?
  • If you are contributing a bugfix, is your work based off the fixes branch?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run make test with your changes locally?

@andreaskem andreaskem changed the title Develop Enable building on AIX May 16, 2022
@ralight
Copy link
Contributor

ralight commented May 17, 2022

This looks great, and I'd be happy to add support for new platforms, but your comment about OpenSSL is a bit concerning. The develop branch works just fine with version OpenSSL 1.1.1, which is now 3.5 years old. Is it really the case that this isn't packaged for AIX? I've no experience with AIX, but this page suggests that 1.1.1 is available: https://www.ibm.com/support/pages/downloading-and-installing-or-upgrading-openssl-and-openssh

@andreaskem
Copy link
Author

You are 100% correct. This development machine I am on does still seem to be using OpenSSL 1.0.2 for some reason. I foolishly thought that the missing symbols I encountered were related to a OpenSSL 3 migration in mosquitto because the master branch was building just fine and I was under the impression that this machine was kept up to date. I will have to talk to somebody about that and try to test with 1.1 but I do not assume that there would be an impact on this merge request.

@andreaskem
Copy link
Author

andreaskem commented May 18, 2022

Apparently, and don't quote me on that, OpenSSL might not get updated to 1.1 automatically on AIX (yet). It is also possible that IBM is paying for extended support for OpenSSL 1.0.2, as is being offered on the OpenSSL website.

In any case, I was now able to test this merge request with OpenSSL 1.1 and could build including SSL/TLS support. I reworded the commit message accordingly and fixed some additional issues along the way (a warning in src/context.c and two install failures).

Unfortunately, set-version.sh is using the non-POSIX option -i and AIX sed does not implement that. I worked around that locally by modifying my PATH to point to GNU sed instead.

else
ALL_DEPS:=
endif

Copy link
Contributor

Choose a reason for hiding this comment

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

these two cjson patches seem unrelated to building on aix, are they just fixes for "building without json support" ?

Copy link
Author

Choose a reason for hiding this comment

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

The latter, because the build seemed to fail when using WITH_CJSON=no (cjson does not seem to be available in the "AIX Toolbox for Open Source Software"). I used a separate commit but if you prefer, I can put this commit into another merge request, instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

fine as is for me, I'm not used to people doing that nicely :) I was just looking at the whole set

@@ -261,6 +261,7 @@ if(UNIX)
set_target_properties(mosquitto PROPERTIES
LINK_FLAGS "-Wl,-exported_symbols_list -Wl,${mosquitto_SOURCE_DIR}/src/linker-macosx.syms"
)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't you be adding your linker-aix.syms here too? (Or make it emit a warning that cmake isn't supported on AIX?)

Copy link
Author

Choose a reason for hiding this comment

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

cmake seems to generate an export file and adds some AIX export flags on its own. Using make VERBOSE=1 I noticed:

-Wl,-bE:CMakeFiles/libmosquitto.dir/objects.exp

I have no idea how cmake handles this stuff but the build artifacts seem to work just the same.

Copy link
Contributor

Choose a reason for hiding this comment

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

cool :) I'm not a cmake person either, just looked wrong here

@@ -651,7 +653,7 @@ int net__tls_load_verify(struct mosquitto__listener *listener)
}


#ifndef WIN32
#if !defined(WIN32) && !defined(_AIX)
Copy link
Contributor

Choose a reason for hiding this comment

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

This means you should probably update https://github.com/eclipse/mosquitto/blob/master/man/mosquitto.conf.5.xml#L1096 to include AIX there too.

Copy link
Author

Choose a reason for hiding this comment

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

Sure.

The AIX operating system by IBM does not provide the getifaddrs function
and requires a custom linker script syntax. This commit allows for a
basic GCC build on AIX 7.2.

The build was tested using the command lines

make CC=gcc WITH_CJSON=no WITH_DOCS=no WITH_STATIC_LIBRARIES=yes
and
CC=gcc cmake <srcpath> -DDOCUMENTATION=no

At this point, the persistence test suite seems to fail. The library, as
well as the mosquitto_sub and mosquitto_pub executables were tested and
appear to be functional.

Signed-off-by: Andreas Kempf <[email protected]>
@ralight
Copy link
Contributor

ralight commented May 18, 2022

set-version.sh is for use by the project maintainers, so I'm comfortable with it not running on AIX.

@andreaskem
Copy link
Author

Hi, just checking in. Is there anything you would like to have changed?

@andreaskem
Copy link
Author

Sorry for bothering you, but is there a blocker for this pull request or do I just have to be patient?

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.

None yet

3 participants