Verifying and Troubleshooting the libp2j.so Build¶
Using Linux Utilities¶
The .so
library is built on Linux, so you can use the following two utilities for testing and troubleshooting.
ldd
nm
ldd¶
If you run ldd libp2j.so
, the availability of dynamic 'dependent' *.so
files will be determined.
For statically linked ncurses
, you must NOT see the reference to ncurses
in the output of ldd
, because it is "built in".
For dynamically linked ncurses
, you MUST see the reference to ncurses
in the output of ldd
nm on statically linked ncurses¶
If you run nm -g libp2j.so
, you will see the external symbols listed.
auto_getch_refresh
is present in the listing, where:
- the reported line must be starting with a memory address string, followed by the letter
T
, followed byauto_getch_refresh
, space delimited.
Here is an example for a proper nm
test:
nm -g libp2j.so | grep -Ew '[0-9A-Fa-f]+ +T +auto_getch_refresh' && echo 'Test libp2j.so for auto_getch_refresh is OK' || echo 'Test libp2jso for auto_getch_refresh FAILED'
Which should output:
Test libp2j.so for auto_getch_refresh is OK
For reference, here is a correct output line of nm -g
:
0000000000011fa0 T auto_getch_refresh
The reported type
T
means: Global text symbol. A memory address is shown.
And here is an incorrect output line of nm -g
:
U auto_getch_refresh
This incorrect output (detected at a customer) was caused by a symbol is declared but not defined situation.
The reported type
U
means: Undefined symbol.Recent versions of FWD use the
-z defs
linker flag, which guards against these situations.
nm on dynamically linked ncurses¶
When you have the dynamically linked ncurses
setup for libp2j.so
, the proper check on the system-wide patched ncurses
shared object would be:
nm -g libncurses.so | grep -Ew '[0-9A-Fa-f]+ +T +auto_getch_refresh' && echo 'Test libncurses.so for auto_getch_refresh is OK' || echo 'Test libncurses.so for auto_getch_refresh FAILED'
The p2j.so
will have auto_getch_refresh
as well, so also do the check in the previous paragraph.
Using Java and FWD¶
To run a quick check by java/FWD: Start a 'dummy' ChUI
session, using the command below.
Note 1:
Be aware that processes
defined in your directory.xml
currently run in ChUI
mode, as of 2024Q2
.
So even if you only run WebClient sessions, and do not have any ChUI
programs to convert, you need the ChUI
mode to work if you have processes
defined.
Note 2:
Building libp2j.so
does not require the TERMINFO
patch, but running this ChUI
test does require it.
Instructions are at Patching TERMINFO .
Here is the command for the ChUI
test. Adjust paths where needed.
TERM=xterm LANG=en_US.UTF-8 $JAVA_HOME/bin/java -Djava.library.path=/my-converted-app-path/deploy/lib -classpath /my-converted-app-path/deploy/lib/p2j.jar com.goldencode.p2j.main.ClientDriver net:server:host=localhost net:connection:secure=false net:server:secure_port=41001 net:server:insecure_port=41000
If this gives errors (in the FWD server log, or in the stdout
/ stderr
) on auto_getch_refresh
, the build of libp2j.so
is invalid, and/or the runtime settings are incorrect.
Other errors, not related to libp2j.so
, can be ignored. Since nothing is configured, errors related to configuration are expected.
Detailed Prerequisites for Dedicated Build Steps¶
If your company uses dedicated build steps, these are the common ones, and they can all run at different machines (or have dedicated Docker images):
- Build : Build FWD, including
libp2j.so
- Convert : Convert your application
- Runtime : Run the converted application in FWD
For statically linked ncurses
, the TERMINFO
patch is only needed at the Runtime step. The NCURSES
patch is NOT required to be applied system wide, on all three build steps. It IS applied in a separate temporary folder, by the build script for statically linked ncurses
.
For dynamically linked ncurses
, the NCURSES
patch is required to be applied system wide, for all three build steps. The TERMINFO
patch is only needed at the Runtime step, but the TERMINFO
patch is a part of the NCURSES
patch build script, so it will be present, system wide, in all build steps.
Example listings of the Linux utilities¶
ldd¶
This listing shows dynamically linked ncurses
.
ldd ./server/lib/libp2j.so
./server/lib/libp2j.so: /lib/x86_64-linux-gnu/libncurses.so.6: no version information available (required by ./server/lib/libp2j.so) linux-vdso.so.1 (0x00007fff01dfc000) libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007f6a16939000) libncurses.so.6 => /lib/x86_64-linux-gnu/libncurses.so.6 (0x00007f6a168d5000) libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f6a168a3000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6a1667a000) /lib64/ld-linux-x86-64.so.2 (0x00007f6a1695a000)
nm¶
The output is stripped.
nm ./server/lib/libp2j.so
000000000000d520 B acs_result 0000000000008ba8 T addchNative 0000000000009f20 t atexit 000000000000d4c0 D attribute_result 0000000000011fa0 T auto_getch_refresh ... 00000000000076e8 T Java_com_goldencode_p2j_library_LibraryManager_dispatch 0000000000007600 T Java_com_goldencode_p2j_library_LibraryManager_findByName ... 0000000000007172 T Java_com_goldencode_p2j_ui_client_chui_driver_console_ConsoleHelper_beep 0000000000007193 T Java_com_goldencode_p2j_ui_client_chui_driver_console_ConsoleHelper_clear
© 2024 Golden Code Development Corporation. ALL RIGHTS RESERVED.