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

CMake on z/OS outputs shared libraries in a different directory compared to other platforms #4761

Open
fjeremic opened this issue Jan 23, 2020 · 2 comments

Comments

@fjeremic
Copy link
Contributor

When running CMake on z/OS to build OMR it seems to output all the shared libraries in the build directory. For example here is what the directory listing looks like after compiling the entire project:

:/trjit/sandbox/jeremif/investigation/jitbuilder-call/omr/build>ll
total 2014032
-rw-r-----   1 JEREMIF  TRJIT       1391 Jan 23 13:13 omrversionstrings.h
-rw-r-----   1 JEREMIF  TRJIT       8226 Jan 23 13:13 omrcfg.h
-rw-r-----   1 JEREMIF  TRJIT         53 Jan 23 13:13 OmrConfig.cmake
-rw-r-----   1 JEREMIF  TRJIT      29292 Jan 23 13:13 CMakeCache.txt
drwxr-x---   4 JEREMIF  TRJIT       8192 Jan 23 13:13 example
-rw-r-----   1 JEREMIF  TRJIT       4300 Jan 23 13:13 cmake_install.cmake
-rw-r-----   1 JEREMIF  TRJIT      47378 Jan 23 13:13 Makefile
-rw-r-----   1 JEREMIF  TRJIT        547 Jan 23 13:13 CTestTestfile.cmake
drwxr-x---  10 JEREMIF  TRJIT       8192 Jan 23 13:13 util
drwxr-x---   4 JEREMIF  TRJIT       8192 Jan 23 13:13 third_party
drwxr-x---   3 JEREMIF  TRJIT       8192 Jan 23 13:13 omrtrace
drwxr-x---   3 JEREMIF  TRJIT       8192 Jan 23 13:13 compiler
drwxr-x---   4 JEREMIF  TRJIT       8192 Jan 23 13:13 jitbuilder
drwxr-x---  19 JEREMIF  TRJIT       8192 Jan 23 13:13 fvtest
drwxr-x---   6 JEREMIF  TRJIT       8192 Jan 23 13:13 tools
-rw-r-----   1 JEREMIF  TRJIT       4279 Jan 23 13:13 OmrTargets.cmake
-rw-r-----   1 JEREMIF  TRJIT        102 Jan 23 13:13 testcompilerName.cpp
-rw-r-----   1 JEREMIF  TRJIT        240 Jan 23 13:13 libtraceOptionAgent.x
-rwxr-x---   1 JEREMIF  TRJIT      73728 Jan 23 13:13 libtraceOptionAgent.so
-rwxr-x---   1 JEREMIF  TRJIT      65536 Jan 23 13:13 libsltestlib.so
-rw-r-----   1 JEREMIF  TRJIT        160 Jan 23 13:13 libsampleSubscriber.x
-rwxr-x---   1 JEREMIF  TRJIT      73728 Jan 23 13:13 libsampleSubscriber.so
-rw-r-----   1 JEREMIF  TRJIT     809126 Jan 23 13:13 libpugixml.a
-rw-r-----   1 JEREMIF  TRJIT      17914 Jan 23 13:13 libomrtestutil.a
-rw-r-----   1 JEREMIF  TRJIT        160 Jan 23 13:13 libinvalidAgentReturnError.x
-rwxr-x---   1 JEREMIF  TRJIT      65536 Jan 23 13:13 libinvalidAgentReturnError.so
-rw-r-----   1 JEREMIF  TRJIT         80 Jan 23 13:13 libinvalidAgentMissingOnUnload.x
-rwxr-x---   1 JEREMIF  TRJIT      65536 Jan 23 13:13 libinvalidAgentMissingOnUnload.so
-rw-r-----   1 JEREMIF  TRJIT         80 Jan 23 13:13 libinvalidAgentMissingOnLoad.x
-rwxr-x---   1 JEREMIF  TRJIT      65536 Jan 23 13:13 libinvalidAgentMissingOnLoad.so
-rw-r-----   1 JEREMIF  TRJIT     157594 Jan 23 13:13 libtrace.a
-rw-r-----   1 JEREMIF  TRJIT       7520 Jan 23 13:13 libj9a2e.x
-rwxr-x---   1 JEREMIF  TRJIT     221184 Jan 23 13:13 libj9a2e.so
-rwxr-x---   1 JEREMIF  TRJIT     172032 Jan 23 13:13 tracemerge
-rwxr-x---   1 JEREMIF  TRJIT     258048 Jan 23 13:13 tracegen
-rw-r-----   1 JEREMIF  TRJIT        160 Jan 23 13:13 libtraceagent.x
-rwxr-x---   1 JEREMIF  TRJIT      98304 Jan 23 13:13 libtraceagent.so
-rw-r-----   1 JEREMIF  TRJIT        160 Jan 23 13:13 libtraceNotStartedAgent.x
-rwxr-x---   1 JEREMIF  TRJIT      90112 Jan 23 13:13 libtraceNotStartedAgent.so
-rw-r-----   1 JEREMIF  TRJIT        160 Jan 23 13:13 libsubscriberAgentWithJ9thread.x
-rwxr-x---   1 JEREMIF  TRJIT      98304 Jan 23 13:13 libsubscriberAgentWithJ9thread.so
-rw-r-----   1 JEREMIF  TRJIT        160 Jan 23 13:13 libsubscriberAgent.x
-rwxr-x---   1 JEREMIF  TRJIT      98304 Jan 23 13:13 libsubscriberAgent.so
-rw-r-----   1 JEREMIF  TRJIT    2543522 Jan 23 13:13 libomrGtest.a
-rw-r-----   1 JEREMIF  TRJIT        160 Jan 23 13:13 libmemorycategoriesagent.x
-rwxr-x---   1 JEREMIF  TRJIT     106496 Jan 23 13:13 libmemorycategoriesagent.so
-rw-r-----   1 JEREMIF  TRJIT        160 Jan 23 13:13 libcpuLoadAgent.x
-rwxr-x---   1 JEREMIF  TRJIT      81920 Jan 23 13:13 libcpuLoadAgent.so
-rw-r-----   1 JEREMIF  TRJIT        160 Jan 23 13:13 libbindthreadagent.x
-rwxr-x---   1 JEREMIF  TRJIT      98304 Jan 23 13:13 libbindthreadagent.so
-rwxr-x---   1 JEREMIF  TRJIT     811008 Jan 23 13:13 hookgen
drwxr-x---   3 JEREMIF  TRJIT       8192 Jan 23 13:13 thread
drwxr-x---   4 JEREMIF  TRJIT       8192 Jan 23 13:13 omr
drwxr-x---   3 JEREMIF  TRJIT       8192 Jan 23 13:13 gc
drwxr-x---   4 JEREMIF  TRJIT       8192 Jan 23 13:13 port
-rw-r-----   1 JEREMIF  TRJIT      11586 Jan 23 13:13 mmomrhook.h
-rw-r-----   1 JEREMIF  TRJIT          0 Jan 23 13:13 tracemerge.stamp
-rw-r-----   1 JEREMIF  TRJIT     102144 Jan 23 13:13 OMRTraceFormat.dat
-rw-r-----   1 JEREMIF  TRJIT        429 Jan 23 13:13 OMRTestTraceFormat.dat
-rw-r-----   1 JEREMIF  TRJIT     117567 Jan 23 13:13 J9TraceFormat.dat
-rw-r-----   1 JEREMIF  TRJIT      39570 Jan 23 13:13 libj9pool.a
-rw-r-----   1 JEREMIF  TRJIT      24840 Jan 23 13:13 libj9avl.a
-rw-r-----   1 JEREMIF  TRJIT     119658 Jan 23 13:13 libomrutil.a
-rw-r-----   1 JEREMIF  TRJIT     155262 Jan 23 13:13 libomrcore.a
-rw-r-----   1 JEREMIF  TRJIT     244192 Jan 23 13:13 libj9thrstatic.a
-rw-r-----   1 JEREMIF  TRJIT      48464 Jan 23 13:13 libj9hashtable.a
drwxr-x---   3 JEREMIF  TRJIT       8192 Jan 23 13:13 omrsigcompat
-rw-r-----   1 JEREMIF  TRJIT        800 Jan 23 13:13 libomrsig.x
-rwxr-x---   1 JEREMIF  TRJIT     106496 Jan 23 13:13 libomrsig.so
-rw-r-----   1 JEREMIF  TRJIT     679962 Jan 23 13:13 libomrport.a
drwxr-x---   3 JEREMIF  TRJIT       8192 Jan 23 13:13 jitbuilderclient
-rw-r-----   1 JEREMIF  TRJIT        100 Jan 23 13:13 jitbuilderName.cpp
-rwxr-x---   1 JEREMIF  TRJIT    2469888 Jan 23 13:13 omrutiltest
-rw-r-----   1 JEREMIF  TRJIT     222774 Jan 23 13:13 libomrtrace.a
-rw-r-----   1 JEREMIF  TRJIT      26246 Jan 23 13:13 libj9hookstatic.a
-rwxr-x---   1 JEREMIF  TRJIT    12681216 Jan 23 13:13 omrporttest
-rw-r-----   1 JEREMIF  TRJIT    6715078 Jan 23 13:14 libomrgc.a
-rw-r-----   1 JEREMIF  TRJIT      48448 Jan 23 13:14 libomrvmstartup.a
-rwxr-x---   1 JEREMIF  TRJIT    8531968 Jan 23 13:14 gcexample
-rwxr-x---   1 JEREMIF  TRJIT    2990080 Jan 23 13:14 TestTypeTraits
-rwxr-x---   1 JEREMIF  TRJIT    5623808 Jan 23 13:14 omralgotest
-rwxr-x---   1 JEREMIF  TRJIT    2969600 Jan 23 13:14 TestBytes
-rwxr-x---   1 JEREMIF  TRJIT    2895872 Jan 23 13:14 TestIntrusiveList
-rwxr-x---   1 JEREMIF  TRJIT    11460608 Jan 23 13:14 omrtraceoptiontest
-rwxr-x---   1 JEREMIF  TRJIT    11468800 Jan 23 13:14 omrsubscribertest
-rwxr-x---   1 JEREMIF  TRJIT    14934016 Jan 23 13:14 omrrastest
-rwxr-x---   1 JEREMIF  TRJIT    3772416 Jan 23 13:14 omrvmtest
-rwxr-x---   1 JEREMIF  TRJIT    4399104 Jan 23 13:14 omrsigtest
-rw-r-----   1 JEREMIF  TRJIT    59277364 Jan 23 13:14 libtestcompiler.a
-rwxr-x---   1 JEREMIF  TRJIT    4915200 Jan 23 13:14 omrthreadextendedtest
-rwxr-x---   1 JEREMIF  TRJIT    8318976 Jan 23 13:14 omrthreadtest
-rwxr-x---   1 JEREMIF  TRJIT    13479936 Jan 23 13:14 omrgctest
-rw-r-----   1 JEREMIF  TRJIT    2182810 Jan 23 13:14 libtril.a
-rwxr-x---   1 JEREMIF  TRJIT    53739520 Jan 23 13:14 tril_dumper
-rwxr-x---   1 JEREMIF  TRJIT    53739520 Jan 23 13:14 tril_compiler
-rwxr-x---   1 JEREMIF  TRJIT    53739520 Jan 23 13:14 incordec
-rwxr-x---   1 JEREMIF  TRJIT    53739520 Jan 23 13:15 mandelbrot
-rw-r-----   1 JEREMIF  TRJIT    59576272 Jan 23 13:15 libjitbuilder.a
-rwxr-x---   1 JEREMIF  TRJIT     110592 Jan 23 13:15 isSupportedType
-rwxr-x---   1 JEREMIF  TRJIT    59977728 Jan 23 13:15 triltest
-rwxr-x---   1 JEREMIF  TRJIT    61915136 Jan 23 13:15 compilertest
-rwxr-x---   1 JEREMIF  TRJIT    43896832 Jan 23 13:15 nestedloop
-rwxr-x---   1 JEREMIF  TRJIT    44056576 Jan 23 13:15 conditionals
-rwxr-x---   1 JEREMIF  TRJIT    44060672 Jan 23 13:15 worklist
-rwxr-x---   1 JEREMIF  TRJIT    44048384 Jan 23 13:15 simple
-rwxr-x---   1 JEREMIF  TRJIT    43896832 Jan 23 13:15 pow2
-rwxr-x---   1 JEREMIF  TRJIT    43896832 Jan 23 13:15 iterfib
-rwxr-x---   1 JEREMIF  TRJIT    51073024 Jan 23 13:15 jitbuildertest
-rwxr-x---   1 JEREMIF  TRJIT    129814528 Jan 23 13:16 comptest
drwxr-x---   8 JEREMIF  TRJIT       8192 Jan 23 13:16 CMakeFiles
drwxr-x---   3 JEREMIF  TRJIT       8192 Jan 23 13:18 Testing
drwxr-x---  30 JEREMIF  TRJIT       8192 Jan 23 13:20 ..
drwxr-x---  18 JEREMIF  TRJIT       8192 Jan 23 13:39 .

Notice that all the shared libraries (*.so) and archives (*.a) are generated in the build directory. On Linux this is not the case. The issue with this is that some tests rely on dynamically loading these libraries, for example omrrastest loads libj9a2e.so but it cannot find it as it expects it to be in a certain location.

To work around this we have to specify LIBPATH for z/OS builds to get all the tests running. If we fix up CMake to output the libraries in the same directories as on Linux we shouldn't need this workaround.

fjeremic added a commit to fjeremic/omr that referenced this issue Jan 23, 2020
Currently due to a limitation of the z/OS CMake port we require to
specify an explicit `LIBPATH` so that the various tests which
dynamically load DLLs can find them. Once CMake is fixed to properly
generate the dynamic libraries in the correct directories setting of
the `LIBPATH` environment variable should be removed. See eclipse-omr#4761.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
fjeremic added a commit to fjeremic/omr that referenced this issue Jan 24, 2020
Currently due to a limitation of the z/OS CMake port we require to
specify an explicit `LIBPATH` so that the various tests which
dynamically load DLLs can find them. Once CMake is fixed to properly
generate the dynamic libraries in the correct directories setting of
the `LIBPATH` environment variable should be removed. See eclipse-omr#4761.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
fjeremic added a commit to fjeremic/omr that referenced this issue Jan 26, 2020
Currently due to a limitation of the z/OS CMake port we require to
specify an explicit `LIBPATH` so that the various tests which
dynamically load DLLs can find them. Once CMake is fixed to properly
generate the dynamic libraries in the correct directories setting of
the `LIBPATH` environment variable should be removed. See eclipse-omr#4761.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
@fjeremic
Copy link
Contributor Author

fjeremic commented Mar 9, 2020

@dnakamura do you think this is related to CMake itself or something in OMR?

@dnakamura
Copy link
Contributor

dnakamura commented Mar 9, 2020

No, we do this intentionally in OMR. I don't recall exactly why, but I suspect its so we dont need to specify LIBPATH for the tests

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

No branches or pull requests

2 participants