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

Compiling with shared objects & 32-bit support #42

Closed
ndfriedmanLRS opened this issue Sep 9, 2024 · 5 comments
Closed

Compiling with shared objects & 32-bit support #42

ndfriedmanLRS opened this issue Sep 9, 2024 · 5 comments

Comments

@ndfriedmanLRS
Copy link

Hello,

I am attempting to integrate OpenSSL into an existing project using this port and the zopen build tool, and for my purposes it is necessary to have libssl and libcrypto available as shared objects compiled in 32-bit mode (as the underlying project is using AMODE 31). So far I have been able to successfully compile and link the shared objects in 64-bit mode, but I am having some trouble with the linking process in 32-bit mode. The compiler I am using is the Open XL v2.1 ibm-clang, and with the -m32 flag specified it is able to successfully compile up to the linking phase.

Upon trying to link libcrypto, however, a number of errors are thrown related to conflicting AMODEs between a referencing ESD and the import statement, with the import statement in question being a 32-bit CODE import from the standard C Runtime Library, and the ESD coming from the (presumably 64-bit) zoslib modules. This also throws a separate error about both C_WSA and C_WSA64 being present in the module, due to the mixed AMODEs between the zoslib and OpenSSL object files.

From my understanding, this conflict is arising from zoslib being only available in 64-bit mode, and thus being unable to include the 32-bit runtime library that is required for the rest of the project (as well as being unable to be properly linked into a 32-bit libcrypto module altogether). I'm not sure if this is a question better served for the zoslib project, as I have also separately been unable to build zoslib in 32-bit mode myself, or if there is a way to bypass this requirement or use zoslib as-is in 32-bit mode.

This project has already been an enormous help, and I appreciate any help you may be able to provide in advance.

@ndfriedmanLRS
Copy link
Author

Hi, just want to briefly follow up on this and see if there's any chance I can get some guidance in the right direction. It seems pretty clear from further testing that the issue is definitely to do with zoslib only compiling in 64-bit mode, so if it would be better to direct this issue at that project I can do that as well. I've been exploring any possible alternatives, but having the ability to build this project in 32-bit mode would be a massive help.

@IgorTodorovskiIBM
Copy link
Collaborator

Porting zoslib to 32-bit may take a lot of effort. You could first try building without zoslib by adding this to the buildenv: https://github.com/zopencommunity/zos-code-page-toolsport/blob/main/buildenv#L8.

@ndfriedmanLRS
Copy link
Author

ndfriedmanLRS commented Nov 6, 2024

I have tried that previously, and the compile makes it as far as the first file (apps/lib/app_libctx.c) before throwing an error due to not being able to find <sys/param.h> and ending.

EDIT: Actually, since we don't seem to need param.h, I have temporarily defined the value that skips including param.h in include/internal/sockets.h, and I'm running the compile again now to test what further errors that raises.

@IgorTodorovskiIBM
Copy link
Collaborator

Yep, zoslib just adds a stub for param.h to avoid the error

@ndfriedmanLRS
Copy link
Author

Just want to follow up on this and say that setting that option in the buildenv worked perfectly! I'm not sure what option I was using before, but that let the compile complete without any issues and everything is working fine. Thank you for your help!

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

No branches or pull requests

2 participants