Project

General

Profile

Bug #3298

libp2j build links with ncurses 5.9 when the proper version is 6.0

Added by Greg Shah almost 7 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

libncurses_on_clean_U16_04.png (85.9 KB) Ovidiu Maxiniuc, 06/05/2017 02:04 PM

libncurses.a (707 KB) Greg Shah, 06/13/2017 06:27 PM

patch_ncurses6.sh Magnifier - New ncuses patch script (1.61 KB) Eugenie Lyzenko, 06/21/2017 11:43 PM

term_patches_20170622_093107.log Magnifier (225 KB) Greg Shah, 06/22/2017 09:47 AM

patch_ncurses6.sh_20170623a.zip - New ncurses patch script with permission fix (921 Bytes) Eugenie Lyzenko, 06/23/2017 06:01 PM


Related issues

Related to Build and Source Control - Bug #3219: recent Ubuntu/Linux builds use ncurses 6.0 and we don't link to it properly Closed
Related to Build and Source Control - Bug #5166: libp2j.so links to unpatched ncurses 6.2 instead of the patched ncurses 5.9 Closed

History

#1 Updated by Greg Shah almost 7 years ago

We recently determined that newly installed systems that have ncurses 6.0 should not use libncurses5-dev because it causes linking to incorrect (v5) versions of ncurses. This meant that you could patch ncurses (6.0), build P2J (linked with 5.9) and when you run the terminal client it fails because the 5.9 version is not patched. Since it is no longer possible to easily patch that version, we can't get the terminal client running on such systems.

On systems that already had a previously patched 5.9 library, it is still present after upgrade and things work. But freshly installed systems don't work.

Ovidiu: I think you found that libncurses5-dev was the problem and that it must be removed. The idea was that it wasn't needed for
building anymore. This is what we our official docs say too.

The problem is that after removing it I can't build anymore (error: term.h is missing). There is no libncurses6-dev package. Perhaps we
need to manually place the dev headers for 6.0 on the system?

#2 Updated by Greg Shah almost 7 years ago

From Ovidiu:

Yes, I found some issues at compile time but somehow I got past it (don't remember the exact cause and solution). However, since I only tested the GUI, the runtime code might have not attempt to load and execute the character/ncurses libraries at all.

#3 Updated by Greg Shah almost 7 years ago

The build just links using -lncurses. This means the default ncurses headers and library are resolving to 5.9. On recent Ubuntu systems including 16.04, ncurses 6.0 is the default and the source package that is downloaded is only ncurses 6.0. So our patching process is for 6.0 and yet we link with the unpatched 5.9. This is not a problem on a system that is old enough that the 5.9 version was patched previously, but on a fresh install it is an issue. I haven't been able to get linked without libncursesdev-5 installed, the build fails.

Eugenie: Please look into this.

#4 Updated by Ovidiu Maxiniuc almost 7 years ago

I checked the test system used for testing in April. Indeed, the libncurses5-dev package is installed. My personal notes from the time of testing list ncurses as 'OK' in the end, but there are some additional notes I added while preparing FWD development environment:

7. zip        OK
8. ERR:
    sh: 1: dpkg-source: not found
    Unpack command 'dpkg-source -x ncurses_6.0+20160213-1ubuntu1.dsc' failed.
    Check if the 'dpkg-dev' package is installed.
    E: Sub-process dpkg-source returned an error code (1)
    fixed with 
    apt-get install dpkg-dev
9. wget https://proj.goldencode.com/downloads/ncurses/ncurses_lib_getch_c_v5.7_20090512.patch instead of
   wget https://proj.goldencode.com/artifacts/ncurses_lib_getch_c_v5.7_20090512.patch
    and
   wget https://proj.goldencode.com/downloads/ncurses/ncurses_curses_h_in_20060828.patch instead of
   wget https://proj.goldencode.com/artifacts/ncurses_curses_h_in_20060828.patch
10. install
    No:    cd /lib/i386-linux-gnu/
    Used:    cd /lib/x86_64-linux-gnu/
11. 
    ln -s /lib/x86_64-linux-gnu/libncurses.so.5.9 /usr/lib/libncurses.so.5.9
12. TERMINFO    OK

Attached is a screen-shot of the listing of ncurses lib files from respective system:

Hope these help the investigations.

#5 Updated by Eugenie Lyzenko almost 7 years ago

The one more related task is #3271

Let me clarify what the problem we are solving here.

1. On my fresh installed Ubuntu_16.04 virtual machine used to test hotel ChUI application the required ncurses was installed from sources:

cd tmp
apt-get source ncurses
ls
cd ncurses-6.0+20160213
patch ncurses/base/lib_getch.c ~/fwd/ncurses_lib_getch_c_v5.7_20090512.patch
patch include/curses.h.in ~/fwd/ncurses_curses_h_in_20060828.patch
./configure --with-shared
make
su root
sudo make install

cd /lib
cd x86_64-linux-gnu
sudo cp /usr/lib/libncurses.so.6.0 .
sudo ln -s libncurses.so.6.0 libncurses.so.6

evl@kvm-v2:~/projects/hotel/deploy/lib$ ldd libp2j.so
    linux-vdso.so.1 =>  (0x00007ffebcd4c000)
    libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f2f705b2000)
    libncurses.so.6 => /lib/x86_64-linux-gnu/libncurses.so.6 (0x00007f2f70352000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2f7014a000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f2f6ff42000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2f6fb72000)
    /lib64/ld-linux-x86-64.so.2 (0x00005564ec1c6000)

This way gets patched NCURSES 6.0(with version related note below). On this system /usr/lib/libncurses.so points to /usr/lib/libncurses.so.6.

2. There are no libncurses6-dev package in Ubuntu 16.04. But both available libncurses5 and libncurses5-dev are actually having version as 6.0. This is a kind of confusing but means ncurses package version 5, revision 6.0. Previously it was ncurses package version 5, revision 5.9. And I guess nothing was changed except revision update from 5.9 to 6.0.

3. What option do we need to mention to install patched ncurses? Install libncurses5-dev or get sources and build from patched source? Why we can not install libncurses5-dev version 6.0?

Another word I need to know the failed scenario we need to fix.

#6 Updated by Eugenie Lyzenko almost 7 years ago

Another test round just passed:

1. Installing new Ubuntu 16.04 in KVM. This got me libncurses.so.5(==>libncurses.so.5.9) revision 6.0(AKA NCURSES 6.0). At this time there is no term.h file in /usr/include directory.

2. Do not install libncurses5-dev.

3. Obtain the ncurses source code as described in Wiki instruction:

cd /tmp
apt-get source ncurses

4. Patch the sources:

cd ncurses-6.0+20160213
wget https://proj.goldencode.com/downloads/ncurses/ncurses_curses_h_in_20060828.patch
wget https://proj.goldencode.com/downloads/ncurses/ncurses_lib_getch_c_v5.7_20090512.patch
patch ncurses/base/lib_getch.c ncurses_lib_getch_c_v5.7_20090512.patch
patch include/curses.h.in ncurses_curses_h_in_20060828.patch

5. Build patched ncurses6.0 package:

./configure --with-shared
make

sudo su
make install

This gives required patched library in /usr/lib:

libncurses.so==>libncurses.so.6==>libncurses.so.6.0

6. Now the FWD native library is able to be compiled and linked with patched libncurses.so.6.0.

I do not have any issue with this scenario. Is this approach acceptable to use?

#7 Updated by Eugenie Lyzenko almost 7 years ago

I just ran two hotel ChUI clients - terminal and swing. Both are working fine(meaning patched libncurses.so.6.0 is loading and functional). What the remaining issue is?

#8 Updated by Greg Shah almost 7 years ago

I do not have any issue with this scenario. Is this approach acceptable to use?

Yes, this is fine.

I guess the problem is with the patching scripts. Can you please look at them (make sure to download the latest) and fix them?

#9 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

I guess the problem is with the patching scripts. Can you please look at them (make sure to download the latest) and fix them?

So far I have tested different combinations:

  1. Running patch_ncurses.sh with or without directory options from user directory, with and without sudo
  2. Running patch_ncurses.sh with or without directory options from user directory that has no *.sh files(like ../path_to_patch/patch_ncurses.sh)
  3. Running patch_ncurses.sh with or without directory options from root directory
  4. Running manage_term_patches.sh from user directory by sudo and from /root directory(as su)

The result is the same:
The patched libncurses.so.6.0 is placed into /lib/x86_64-linux-gnu/, /usr/lib/. libncurses.so link is in /usr/lib/, FWD native is linked with /lib/x86_64-linux-gnu/libncurses.so.6.0. It is loading and functional.

So no problem has been detected for now. This is fresh x86_64 Ubuntu 16.04.

Probably the issue will come when the libncureses5-dev is installing and then removing(not actually completely)? Or another OS(32-bit Ubuntu or another flavor, like Lubuntu or another version like 16.10 or 17.04).

Or please provide me the results of the commands for the systems that has this issue:

ls /usr/lib/libncurses*
ls /usr/lib/x86_64-linux-gnu/libncurses*
ls /lib/x86_64-linux-gnu/libncurses*

#10 Updated by Eugenie Lyzenko almost 7 years ago

Well I have found one potential cause of the issue on fresh install Lubuntu 17.04. It is related to developers package configuration. Before running ncurses related patch and build scripts the package dpkg-dev must be installed(and this is mentioned in our Wiki docs):

sudo apt-get install dpkg-dev

This is mandatory step. Otherwise required ncurses sources will not be properly unpacked, patched and built. Moreover the /usr/include directory is not properly configured too. Some systems like Ubuntu 16.04 do this step automatically but some systems like Lubuntu 17.04 do not.

The manage_term_patches.sh logs the errors into the file so user even is not able to see what is going wrong in this case. This makes the situation even worse. The script is just silently finishing so to see the errors the log file must be opened and checked.

However if to install dpkg-dev the FWD native library is properly linking with patched libncurses.so.6.0.

#11 Updated by Greg Shah almost 7 years ago

dpkg-dev is already installed on my system (as is libncurses5-dev):

dpkg -l dpkg-dev libncurses5-dev

esired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                      Version                           Architecture                      Description
+++-=========================================================-=================================-=================================-=======================================================================================================================
ii  dpkg-dev                                                  1.18.4ubuntu1.2                   all                               Debian package development tools
ii  libncurses5-dev:amd64                                     6.0+20160213-1ubuntu1             amd64                             developer's libraries for ncurse

Without libncurses5-dev I cannot build FWD.

ls -l /usr/lib/libncurses*

-rw-r--r-- 1 root root  724300 Jun  7 03:16 /usr/lib/libncurses.a
-rw-r--r-- 1 root root  182198 Jun  7 03:16 /usr/lib/libncurses++.a
-rw-r--r-- 1 root root 4272932 Jun  7 03:16 /usr/lib/libncurses_g.a
-rw-r--r-- 1 root root  697560 Jun  7 03:16 /usr/lib/libncurses++_g.a
lrwxrwxrwx 1 root root      15 Jun  7 03:16 /usr/lib/libncurses.so -> libncurses.so.6
lrwxrwxrwx 1 root root      17 Jun  7 03:16 /usr/lib/libncurses.so.6 -> libncurses.so.6.0
-rwxr-x--- 1 root root  411456 Jun  7 03:16 /usr/lib/libncurses.so.6.0

ls -l /usr/lib/x86_64-linux-gnu/libncurses*

-rw-r--r-- 1 root root 298812 Feb 19  2016 /usr/lib/x86_64-linux-gnu/libncurses.a
-rw-r--r-- 1 root root 171456 Feb 19  2016 /usr/lib/x86_64-linux-gnu/libncurses++.a
-rw-r--r-- 1 root root     31 Feb 19  2016 /usr/lib/x86_64-linux-gnu/libncurses.so

ls -l /lib/x86_64-linux-gnu/libncurses*

lrwxrwxrwx 1 root root     17 Jul 11  2016 /lib/x86_64-linux-gnu/libncurses.so.5 -> libncurses.so.5.9
-rw-r--r-- 1 root root 138112 Feb 19  2016 /lib/x86_64-linux-gnu/libncurses.so.5.9
lrwxrwxrwx 1 root root     17 Jun  7 03:16 /lib/x86_64-linux-gnu/libncurses.so.6 -> libncurses.so.6.0
-rwxr-xr-x 1 root root 411456 Jun  7 03:16 /lib/x86_64-linux-gnu/libncurses.so.6.0
-rwxr-x--- 1 root root 411456 Jun  7 03:16 /lib/x86_64-linux-gnu/libncurses.so.6.0.ori
lrwxrwxrwx 1 root root     18 Jul 11  2016 /lib/x86_64-linux-gnu/libncursesw.so.5 -> libncursesw.so.5.9
-rw-r--r-- 1 root root 191464 Feb 19  2016 /lib/x86_64-linux-gnu/libncursesw.so.5.9

ldd libp2j.so

        linux-vdso.so.1 =>  (0x00007fffd91f1000)
        libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fe0799a6000)
        libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007fe079784000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007fe07955a000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe079356000)
        libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fe079153000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe078d89000)
        /lib64/ld-linux-x86-64.so.2 (0x000055598cce0000)

#12 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

ls -l /lib/x86_64-linux-gnu/libncurses*

[...]

ldd libp2j.so

[...]

OK. Some interesting findings:

1. Installing libncurses5-dev adds the following libraries:

    ls -l /usr/lib/x86_64-linux-gnu/libncurses*

-rw-r--r-- 1 root root 298812 Feb 19  2016 /usr/lib/x86_64-linux-gnu/libncurses.a
-rw-r--r-- 1 root root 171456 Feb 19  2016 /usr/lib/x86_64-linux-gnu/libncurses++.a
-rw-r--r-- 1 root root     31 Feb 19  2016 /usr/lib/x86_64-linux-gnu/libncurses.so

Note the /usr/lib/x86_64-linux-gnu/libncurses.so is not a symlink(Linux bug?) as it can be expected. The include files are also become replaced with regular from libncurses5-dev package.

So the libp2.so building has warning about implicit declaration of function auto_getch_refresh(FALSE) because term.h does not have this function(not patched version is used on building). And in this case FWD is actually linking with libncurses.so.5.

2. After removing libncurses5-dev it is not possible to build FWD due to missing <term.h> because removing cleans /usr/lib/x86_64-linux-gnu/ and /usr/include/ dirs from ncurses related files.

3. But if to make patch again(like sudo patch_ncurses $PWD) the /usr/include/ is restored with required patched include files and FWD is successfully building and linking with libncurses.so.6.

4. If the libncurses5-dev is not removing and make patch again with regular package existed - the FWD is compiling good(include files refreshed) but linking with libncurses.so.5 because I guess /usr/lib/x86_64-linux-gnu/ has preference over /usr/lib/ in library search for linkage, so this will not work properly.

So the key point here is to re-do NCURSES patching after removing libncurses5-dev package. The working approach is:
  • First one must ensure there is no libncurses5-dev package in the system, remove if exists. This is important step.
  • Then do regular NCURSES patch either manual or by scripts provided.
  • Build FWD normally.

Please try and let me know if this helps or not.

#13 Updated by Eugenie Lyzenko almost 7 years ago

So far I think this is just document confusing issue. In Development Environment Setup page we instruct the user to install libncurses5-dev package and then later in Patching NCURSES section we instruct to remove the package. However patching NCURSES after removing libncurses5-dev solves the issue.

#14 Updated by Greg Shah almost 7 years ago

I've tested your approach:

1. Remove libncurse5-dev.
2. Patch NCURSES. I used our script to do this.
3. Tried to build FWD.

It fails:

[ant:exec] gcc -o libp2j.so process.o filesys.o memory.o terminal.o library.o init.o signals.o shell.o init_linux.o process_linux.o filesys_linux.o terminal_linux.o library_linux.o signals_linux.o shell_linux.o -static-libgcc -shared -lffi -lncurses -ldl -lutil
[ant:exec] makefile:247: recipe for target 'libp2j.so' failed
[ant:exec] /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libncurses.a(lib_beep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
[ant:exec] /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libncurses.a: error adding symbols: Bad value
[ant:exec] collect2: error: ld returned 1 exit status
[ant:exec] make: *** [libp2j.so] Error 1
:ant-native FAILED

#15 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

I've tested your approach:

1. Remove libncurses5-dev.
2. Patch NCURSES. I used our script to do this.
3. Tried to build FWD.

It fails:

[...]

Please provide the compilation command from your system that building *.o modules for libp2j.so, (process.o, filesys.o, memory.o, terminal.o, ...)

Does the compiler use -fpic option?

Is this system Lubuntu 16.04, 64-bit, correct?

#16 Updated by Greg Shah almost 7 years ago

The full output:

 gcc -c /home/ges/projects/1514a/src/native/process.c -o process.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys.c -o filesys.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/memory.c -o memory.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal.c -o terminal.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library.c -o library.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init.c -o init.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals.c -o signals.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell.c -o shell.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init_linux.c -o init_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process_linux.c -o process_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys_linux.c -o filesys_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal_linux.c -o terminal_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library_linux.c -o library_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals_linux.c -o signals_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell_linux.c -o shell_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -o libp2j.so process.o filesys.o memory.o terminal.o library.o init.o signals.o shell.o init_linux.o process_linux.o filesys_linux.o terminal_linux.o library_linux.o signals_linux.o shell_linux.o -static-libgcc -shared -lffi -lncurses -ldl -lutil
[ant:exec] makefile:247: recipe for target 'libp2j.so' failed
[ant:exec] /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libncurses.a(lib_beep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
[ant:exec] /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libncurses.a: error adding symbols: Bad value
[ant:exec] collect2: error: ld returned 1 exit status
[ant:exec] make: *** [libp2j.so] Error 1
:ant-native FAILED

Does the compiler use -fpic option?

Yes.

Is this system Lubuntu 16.04, 64-bit, correct?

Actually, this is a recently installed Kubuntu 16.04, 64-bit system. I've seen this same behavior on a freshly installed Ubuntu Server 16.04 system too.

#17 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

The full output:

[...]

Does the compiler use -fpic option?

Yes.

Is this system Lubuntu 16.04, 64-bit, correct?

Actually, this is a recently installed Kubuntu 16.04, 64-bit system. I've seen this same behavior on a freshly installed Ubuntu Server 16.04 system too.

What version: 16.04, 16.04.1 or 16.04.2? There are some diffs there may be.

Please provide result for ls -l /usr/lib/libncurses.a.

#18 Updated by Greg Shah almost 7 years ago

What version: 16.04, 16.04.1 or 16.04.2? There are some diffs there may be.

Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-79-generic x86_64)

Please provide result for ls -l /usr/lib/libncurses.a.

-rw-r--r-- 1 root root 724300 Jun 12 12:17 /usr/lib/libncurses.a

#19 Updated by Eugenie Lyzenko almost 7 years ago

Can you please get the ncurses sources, execute ./configure --with shared and publish the config.log file.

#20 Updated by Greg Shah almost 7 years ago

Do you care if I patch those sources or not?

#21 Updated by Greg Shah almost 7 years ago

I'm assuming that I don't need to patch since I'm not building. Here is the configure output:

checking for egrep... grep -E
Configuring NCURSES 6.0 ABI 6 (Mon Jun 12 16:55:38 EDT 2017)
checking for package version... 6.0
checking for package patch date... 20160213
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
Configuring for linux-gnu
checking for prefix... /usr
checking for gnatgcc... no
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for executable suffix... 
checking for object suffix... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking version of gcc... 5.4.0
checking for gcc option to accept ANSI C... none needed
checking $CC variable... ok
checking how to run the C preprocessor... gcc -E
checking whether gcc needs -traditional... no
checking whether gcc understands -c and -o together... yes
checking for ldconfig... /sbin/ldconfig
checking if you want to ensure bool is consistent with C++... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking if g++ works... yes
checking for g++... /usr/bin/g++
checking version of /usr/bin/g++... 5.4.0
checking if you want to build C++ binding and demo... yes
checking if you want to build with Ada95... yes
checking if you want to install terminal database... yes
checking if you want to install manpages... yes
checking if you want to build programs such as tic... yes
checking if you want to build test-programs... yes
checking if you wish to install curses.h... yes
checking for mawk... mawk
checking for egrep... (cached) grep -E
checking for a BSD compatible install... /usr/bin/install -c
checking for tdlint... no
checking for lint... no
checking for alint... no
checking for splint... no
checking for lclint... no
checking whether ln -s works... yes
checking if ln -s -f options work... yes
checking for long file names... yes
checking if you want to use pkg-config... yes
checking for pkg-config... none
configure: WARNING: pkg-config is not installed
checking for pkg-config library directory... checking if we should install .pc files... no
checking if we should assume mixed-case filenames... auto
checking if filesystem supports mixed-case filenames... yes
checking whether make sets ${MAKE}... yes
checking for exctags... no
checking for ctags... no
checking for exetags... no
checking for etags... no
checking for ctags... no
checking for etags... no
checking for makeflags variable... 
checking for ranlib... ranlib
checking for ld... ld
checking for ar... ar
checking for nm... nm
checking for ar... (cached) ar
checking for options to update archives... -curvU
checking if you have specified an install-prefix... 
checking if libtool -version-number should be used... yes
checking if you want to build libraries with libtool... no
checking if you want to build shared libraries... yes
checking if you want to build static libraries... yes
checking if you want to build debug libraries... yes
checking if you want to build profiling libraries... no
checking if you want to build C++ shared libraries... no
checking for specified models...  shared normal debug
checking for default model... shared
checking if you want to have a library-prefix... auto
checking for PATH separator... :
checking if you want to build a separate terminfo library... no
checking if you want to build a separate tic library... no
checking if you want to link with the GPM mouse library... maybe
checking for gpm.h... no
checking for default loader flags... 
checking if rpath option should be used... no
checking if shared libraries should be relinked during install... yes
checking for an rpath option... -Wl,-rpath,
checking if release/abi version should be used for shared libs... auto
checking which gcc option to use... -fPIC
checking if versioned-symbols file should be used... no
checking if you want to disable library suffixes... no
checking if rpath-hack should be disabled... no
checking for updated LDFLAGS... maybe
checking for ldd... ldd
checking if you wish to append extra suffix to header/library paths... 
checking if you wish to install ncurses overwriting curses... yes
checking if external terminfo-database is used... yes
checking which terminfo source-file will be installed... ${top_srcdir}/misc/terminfo.src
checking whether to use hashed database instead of directory/tree... no
checking for list of fallback descriptions... 
checking if you want modern xterm or antique... xterm-new
checking if xterm backspace sends BS or DEL... BS
checking for list of terminfo directories... /usr/share/terminfo
checking for default terminfo directory... /usr/share/terminfo
checking if big-core option selected... yes
checking if big-strings option selected... yes
checking if you want termcap-fallback support... no
checking if ~/.terminfo is wanted... yes
checking if you want to use restricted environment when running as root... yes
checking for remove... yes
checking for unlink... yes
checking if link/symlink functions work...  link symlink
checking if tic should use symbolic links... no
checking if tic should use hard links... yes
checking if you want broken-linker support code... no
checking if tputs should process BSD-style prefix padding... no
checking if we must define _GNU_SOURCE... yes
checking if _XOPEN_SOURCE really is set... yes
checking if SIGWINCH is defined... yes
checking for nl_langinfo and CODESET... yes
checking if you want wide-character code... no
checking whether to enable _LP64 definition in curses.h... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for _LARGE_FILES value needed for large files... no
checking for _LARGEFILE_SOURCE value needed for large files... no
checking for fseeko... yes
checking whether to use struct dirent64... no
checking if you want tparm not to use X/Open fixed-parameter list... yes
checking for type of bool... auto
checking for alternate terminal capabilities file... Caps
checking for type of chtype... uint32_t
checking for type of ospeed... short
checking for type of mmask_t... uint32_t
checking for size CCHARW_MAX... 5
checking for type of tparm args... intptr_t
checking if RCS identifiers should be compiled-in... no
checking format of man-pages...  gzip
checking for manpage renaming... /home/ges/ncurses/ncurses-6.0+20160213/man/man_db.renames
checking if manpage aliases will be installed... yes
checking if manpage symlinks should be used... yes
checking for manpage tbl... no
checking if you want to build with function extensions... yes
checking if you want to build with SCREEN extensions... yes
checking if you want to build with terminal-driver... no
checking for extended use of const keyword... yes
checking if you want to use extended colors... yes
configure: WARNING: This option applies only to wide-character library
checking if you want to use extended mouse encoding... yes
checking if you want to use extended putwin/screendump... yes
checking if you want $NCURSES_NO_PADDING code... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for signed char... yes
checking size of signed char... 1
checking if you want to use signed Boolean array in term.h... no
checking if you want SIGWINCH handler... yes
checking if you want user-definable terminal capabilities like termcap... yes
checking if you want all development code... no
checking if you want hard-tabs code... no
checking if you want limited support for xmc... no
checking if you do not want to assume colors are white-on-black... yes
checking if you want hashmap scrolling-optimization code... yes
checking if you want colorfgbg code... no
checking if you want interop bindings... yes
checking if you want to link with the pthread library... no
checking if you want reentrant code... no
checking if you want experimental safe-sprintf code... no
checking if you want wgetch-events code... no
checking if you want to see long compiling messages... yes
checking if you want to see compiler warnings... 
configure: checking for gcc __attribute__ directives...
... scanf
... printf
... unused
... noreturn
checking if you want to work around bogus compiler/loader warnings... no
checking if you want to enable runtime assertions... no
checking if you want to use dmalloc for testing... no
checking if you want to use dbmalloc for testing... no
checking if you want to use valgrind for testing... no
checking if you want to perform memory-leak testing... no
checking whether to add trace feature to all models... no
checking if we want to use GNAT projects... yes
checking for gettimeofday... yes
checking if -lm needed for math functions... yes
checking for ANSI C header files... (cached) yes
checking for dirent.h that defines DIR... yes
checking for opendir in -ldir... no
checking whether time.h and sys/time.h may both be included... yes
checking for regcomp... yes
checking for regular-expression headers... regex.h
checking for fcntl.h... yes
checking for getopt.h... yes
checking for limits.h... yes
checking for locale.h... yes
checking for math.h... yes
checking for poll.h... yes
checking for sys/bsdtypes.h... no
checking for sys/ioctl.h... yes
checking for sys/param.h... yes
checking for sys/poll.h... yes
checking for sys/select.h... yes
checking for sys/time.h... yes
checking for sys/times.h... yes
checking for ttyent.h... yes
checking for unistd.h... (cached) yes
checking for wctype.h... yes
checking for unistd.h... (cached) yes
checking for getopt.h... (cached) yes
checking for header declaring getopt variables... unistd.h
checking if sys/time.h works with sys/select.h... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking if gcc supports options to tune inlining... yes
checking for signal global datatype... volatile sig_atomic_t
checking if unsigned literals are legal... yes
checking if external errno is declared... yes
checking if external errno exists... no
checking if data-only library module links... yes
checking for getcwd... yes
checking for getegid... yes
checking for geteuid... yes
checking for getopt... yes
checking for getttynam... yes
checking for issetugid... no
checking for poll... yes
checking for putenv... yes
checking for remove... (cached) yes
checking for select... yes
checking for setbuf... yes
checking for setbuffer... yes
checking for setenv... yes
checking for setvbuf... yes
checking for sigaction... yes
checking for sigvec... no
checking for strdup... yes
checking for strstr... yes
checking for tcgetpgrp... yes
checking for times... yes
checking for vsnprintf... yes
checking for isascii... yes
checking whether sigaction needs _POSIX_SOURCE... no
checking if nanosleep really works... yes
checking for termio.h... yes
checking for termios.h... yes
checking for unistd.h... (cached) yes
checking whether termios.h needs _POSIX_SOURCE... no
checking for tcgetattr... yes
checking for vsscanf function or workaround... vsscanf
checking for working mkstemp... yes
checking whether setvbuf arguments are reversed... no
checking for intptr_t... yes
checking for ssize_t... yes
checking for type sigaction_t... no
checking declaration of size-change... yes
checking for memmove... yes
checking if poll really works... yes
checking for va_copy... yes
checking for __va_copy... yes
checking for pid_t... yes
checking for unistd.h... (cached) yes
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... (cached) yes
checking for working vfork... (cached) yes
checking for openpty in -lutil... yes
checking for openpty header... pty.h
checking if we should include stdbool.h... yes
checking for builtin bool type... no
checking if we already have C++ library... yes
checking whether /usr/bin/g++ understands -c and -o together... yes
checking how to run the C++ preprocessor... /usr/bin/g++ -E
checking for typeinfo... yes
checking for iostream... yes
checking if iostream uses std-namespace... yes
checking if we should include stdbool.h... (cached) yes
checking for builtin bool type... yes
checking for size of bool... unsigned char
checking for special defines needed for etip.h...  
checking if /usr/bin/g++ accepts parameter initialization... no
checking if /usr/bin/g++ accepts static_cast... yes
checking for gnatmake... no
checking for library subsets... ticlib+termlib+ext_tinfo+base+ext_funcs
checking default library suffix... 
checking default library-dependency suffix... .so
checking default object directory... obj_s
checking c++ library-dependency suffix... .a
checking where we will install curses.h... ${prefix}/include
checking for src modules... ncurses progs panel menu form
checking for tic... /usr/bin/tic
checking for defines to add to ncurses6-config script...  -D_GNU_SOURCE
package: ncurses
configure: creating ./config.status
config.status: creating include/MKterm.h.awk
config.status: creating include/curses.head
config.status: creating include/ncurses_dll.h
config.status: creating include/termcap.h
config.status: creating include/unctrl.h
config.status: creating man/Makefile
config.status: creating include/Makefile
config.status: creating ncurses/Makefile
config.status: creating progs/Makefile
config.status: creating panel/Makefile
config.status: creating menu/Makefile
config.status: creating form/Makefile
config.status: creating test/Makefile
config.status: creating misc/Makefile
config.status: creating c++/Makefile
config.status: creating misc/run_tic.sh
config.status: creating misc/ncurses-config
config.status: creating man/ncurses6-config.1
config.status: creating Makefile
config.status: creating include/ncurses_cfg.h
Appending rules for shared model (ncurses: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for normal model (ncurses: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for debug model (ncurses: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for shared model (progs: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for normal model (progs: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for debug model (progs: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for shared model (panel: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for normal model (panel: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for debug model (panel: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for shared model (menu: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for normal model (menu: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for debug model (menu: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for shared model (form: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for normal model (form: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for debug model (form: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for shared model (test: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for normal model (test: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for debug model (test: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for shared model (c++: ticlib+termlib+ext_tinfo+base+ext_funcs)
Appending rules for debug model (c++: ticlib+termlib+ext_tinfo+base+ext_funcs)
creating headers.sh

** Configuration summary for NCURSES 6.0 20160213:

       extended funcs: yes
       xterm terminfo: xterm-new

        bin directory: /usr/bin
        lib directory: /usr/lib
    include directory: /usr/include
        man directory: /usr/share/man
   terminfo directory: /usr/share/terminfo

#22 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Do you care if I patch those sources or not?

I understand the patching with scripts clean up the sources at the end. But I assumed the libncurses.a was compiled with incompatible mode(that's why you are not able to link with) and I need to see possible options that can cause this.

#23 Updated by Eugenie Lyzenko almost 7 years ago

The only difference with mine output is missing pkg-config package on your system. This might be important I guess. Can you please install it, re-patch ncurses and build FWD again. And let me know if this helps.

#24 Updated by Greg Shah almost 7 years ago

I installed pkg-config but there is no difference.

[ant:echo] 
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/process.c -o process.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/filesys.c -o filesys.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/memory.c -o memory.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/terminal.c -o terminal.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/library.c -o library.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/init.c -o init.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/signals.c -o signals.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/shell.c -o shell.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/init_linux.c -o init_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/process_linux.c -o process_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/filesys_linux.c -o filesys_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/terminal_linux.c -o terminal_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/library_linux.c -o library_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/signals_linux.c -o signals_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/p2j/src/native/shell_linux.c -o shell_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/p2j/src/native -Wall -fpic
[ant:exec] gcc -o libp2j.so process.o filesys.o memory.o terminal.o library.o init.o signals.o shell.o init_linux.o process_linux.o filesys_linux.o terminal_linux.o library_linux.o signals_linux.o shell_linux.o -static-libgcc -shared -lffi -lncurses -ldl -lutil
[ant:exec] makefile:254: recipe for target 'libp2j.so' failed
[ant:exec] /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libncurses.a(lib_beep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
[ant:exec] /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libncurses.a: error adding symbols: Bad value
[ant:exec] collect2: error: ld returned 1 exit status
[ant:exec] make: *** [libp2j.so] Error 1
:ant-native FAILED

#25 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Do you care if I patch those sources or not?

For my previous assumption it was not important because ./configure does not look if the source is patched.

I just have completed set up new Kubuntu 16.04.2 system(with installing and then removing libncurses5-dev). And strange but I have FWD build OK. The ncurses was patched with patch_ncurses.sh script. The files libncurses.a have both the same size.

However something is certainly different. May be the issue is in gcc. Can you publish the result of gcc -v here?

May be something I usually install on clean system makes my system different. For example I like Midnight Commander(mc) file manager and it is the first thing I get into fresh system. OK, will test Ubuntu server 16.04.2 with only text mode environment to see if I can reproduce the issue.

#26 Updated by Eugenie Lyzenko almost 7 years ago

One more idea is the patched NCURSES did not compiled with -fPIC for some reasons.

#27 Updated by Greg Shah almost 7 years ago

gcc -v output:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)

#28 Updated by Greg Shah almost 7 years ago

Eugenie Lyzenko wrote:

One more idea is the patched NCURSES did not compiled with -fPIC for some reasons.

https://stackoverflow.com/questions/1340402/how-can-i-tell-with-something-like-objdump-if-an-object-file-has-been-built-wi

readelf --relocs /usr/lib/libncurses.so.6 | egrep '(GOT|PLT|JU?MP_SLOT)' results in no output.

I'm not sure if this is definitive, but it suggests your idea may be correct.

#29 Updated by Greg Shah almost 7 years ago

On the other hand, there are many of the R_X86_64_RELATIVE relocations, which would be seen with -fpic. So perhaps this isn't an issue.

#30 Updated by Eugenie Lyzenko almost 7 years ago

Well, I have Ubuntu 16.04.2 Server setup text mode with 4.4.0-79 generic kernel(no extra packages, only system base). Installed and removed libncurses5-dev. Tried to patch ncurses with both scripts: manage_term_patches.sh and patch_ncurses.sh. The FWD building is OK.

What I'm really surprised is the fact based on your ncurses config the libncurses.so.6.0(lib_beep.o) library should be compiled with:

checking which gcc option to use... -fPIC

Correct? The libp2j.so modules are also compiling with -fpic, right.

May be using -fPIC does not guarantee the module will be compile this way, or option was refused for some reasons? This can be is for example the system arch is powerpc or sparc or something unlike AMD64. But I think this is not a true for your machine. May be gcc package was corrupted by some way?

#31 Updated by Eugenie Lyzenko almost 7 years ago

Greg,

Can you publish here your libncurses.a. I want to test one theory on my side.

#32 Updated by Greg Shah almost 7 years ago

#33 Updated by Greg Shah almost 7 years ago

Does your system have a /usr/lib/libncurses.so.5.9?

#34 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Does your system have a /usr/lib/libncurses.so.5.9?

Some of systems have(which was upgraded from old Ubuntu), new systems do not have it there. But this does not change the FWD building result.

#35 Updated by Greg Shah almost 7 years ago

Or one in /lib/x86_64-linux-gnu/libncurses.so.5.9?

#36 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Or one in /lib/x86_64-linux-gnu/libncurses.so.5.9?

Yes, I have it in all systems.

And FWD is building OK with libncurses.a you have provided. So looks like patched ncurses is OK itself.

I think something is different in gcc package(or one of the component).

#37 Updated by Eugenie Lyzenko almost 7 years ago

Also may be you have another version of the libncurses.a somewhere else(/usr/local/lib) or somewhere it can be taken to link before one exists in /usr/lib? Or LD_LIBRARY_PATH variable set?

Is this system started from 16.04, correct?

#38 Updated by Greg Shah almost 7 years ago

Also may be you have another version of the libncurses.a somewhere else(/usr/local/lib) or somewhere it can be taken to link before one exists in /usr/lib?

No, only that one exists.

Or LD_LIBRARY_PATH variable set?

It is not set.

Is this system started from 16.04, correct?

I'm not sure. It may have been upgraded once.

The system that was freshly installed is demosrv01 (Ubuntu Server 16.04), but I can only do limited testing there since it is being actively used by a customer. On that system, I had to copy an already patched libncurses.so.5.9 before it would build FWD. That system still has libncurses5-dev installed.

#39 Updated by Greg Shah almost 7 years ago

https://askubuntu.com/questions/769558/how-to-tell-if-current-version-was-upgraded-or-a-fresh-install

This note suggests that if /var/log/dist-upgrade/ is empty, then it is a fresh install. The Kubuntu system I'm testing has an empty directory. If the note is correct, it was a fresh install.

#40 Updated by Eugenie Lyzenko almost 7 years ago

Some progress here. I can reproduce the error message you noted. It is strange but to see it I had to remove libncurses.so->libncurses.so.6->libncurses.so.6.0 for the /usr/lib directory where libncurses.a is located. Can you check if the libs are in place?

It can happen for example if ncurses was compiled without --with-shared option or if *.so libraries was installed not in the same directory as *.a file(even if the ncurses was build with -fPIC on).

#41 Updated by Greg Shah almost 7 years ago

Those links are there:

-rw-r--r-- 1 root root  724300 Jun 14 04:35 /usr/lib/libncurses.a
-rw-r--r-- 1 root root  182198 Jun 14 04:35 /usr/lib/libncurses++.a
-rw-r--r-- 1 root root 4272932 Jun 14 04:35 /usr/lib/libncurses_g.a
-rw-r--r-- 1 root root  697560 Jun 14 04:35 /usr/lib/libncurses++_g.a
lrwxrwxrwx 1 root root      15 Jun 14 04:35 /usr/lib/libncurses.so -> libncurses.so.6
lrwxrwxrwx 1 root root      17 Jun 14 04:35 /usr/lib/libncurses.so.6 -> libncurses.so.6.0
-rwxr-xr-x 1 root root  411456 Jun 14 04:35 /usr/lib/libncurses.so.6.0

The other ncurses libraries on the system:

lrwxrwxrwx 1 root root     17 Jul 11  2016 /lib/x86_64-linux-gnu/libncurses.so.5 -> libncurses.so.5.9
-rw-r--r-- 1 root root 138112 Feb 19  2016 /lib/x86_64-linux-gnu/libncurses.so.5.9
lrwxrwxrwx 1 root root     17 Jun 14 04:35 /lib/x86_64-linux-gnu/libncurses.so.6 -> libncurses.so.6.0
-rwxr-xr-x 1 root root 411456 Jun 14 04:35 /lib/x86_64-linux-gnu/libncurses.so.6.0
-rwxr-x--- 1 root root 411456 Jun 14 04:35 /lib/x86_64-linux-gnu/libncurses.so.6.0.ori
lrwxrwxrwx 1 root root     18 Jul 11  2016 /lib/x86_64-linux-gnu/libncursesw.so.5 -> libncursesw.so.5.9
-rw-r--r-- 1 root root 191464 Feb 19  2016 /lib/x86_64-linux-gnu/libncursesw.so.5.9

All the expected (and updated) headers are in /usr/include/ including the one that was patched:

find /usr/include/ -type f -name "*.h" | xargs grep auto_getch_refresh
/usr/include/curses.h:extern NCURSES_EXPORT(void) auto_getch_refresh (bool);

#42 Updated by Greg Shah almost 7 years ago

OK, some headway:

I removed the following files:

lrwxrwxrwx 1 root root     17 Jul 11  2016 /lib/x86_64-linux-gnu/libncurses.so.5 -> libncurses.so.5.9
-rw-r--r-- 1 root root 138112 Feb 19  2016 /lib/x86_64-linux-gnu/libncurses.so.5.9
lrwxrwxrwx 1 root root     18 Jul 11  2016 /lib/x86_64-linux-gnu/libncursesw.so.5 -> libncursesw.so.5.9
-rw-r--r-- 1 root root 191464 Feb 19  2016 /lib/x86_64-linux-gnu/libncursesw.so.5.9

After this, libp2j.so builds, it properly links with the libncurses.so.6 and it runs in the ChUI native client.

It seems like the presence of this unpatched ncurses 5.9 is the core problem. Somehow, it affects the linking of libp2j.so (though the error condition is pretty unhelpful).

I'm going to remove the ncurses 5.9 files from the Ubuntu Server system and see if that resolves the issue there.

#43 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

OK, some headway:

I removed the following files:

[...]

After this, libp2j.so builds, it properly links with the libncurses.so.6 and it runs in the ChUI native client.

It seems like the presence of this unpatched ncurses 5.9 is the core problem. Somehow, it affects the linking of libp2j.so (though the error condition is pretty unhelpful).

It is strange, I have the same libraries in /usr/lib/ and /lib/x86_64-linux-gnu/ when building FWD is OK. Agree, the root cause is the directory order the gcc looks libraries for linking.

#44 Updated by Greg Shah almost 7 years ago

It is strange, I have the same libraries in /usr/lib/ and /lib/x86_64-linux-gnu/ when building FWD is OK.

2 questions:

1. Is the ncurses 5.9 library already patched? (I guess, the answer is yes)
2. What is the output of ldd build/lib/libp2j.so?

#45 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

It is strange, I have the same libraries in /usr/lib/ and /lib/x86_64-linux-gnu/ when building FWD is OK.

2 questions:

1. Is the ncurses 5.9 library already patched? (I guess, the answer is yes)

No, the ncurses 5.9 is not patched.

Moreover it is possible to link with not patched ncurses(with warning for missing auto_getch_refresh function). Such build will not work of course but the FWD building is OK.

2. What is the output of ldd build/lib/libp2j.so?

linux-vdso.so.1 =>  (0x00007fff18001000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f6cbaf37000)
libncurses.so.6 => /lib/x86_64-linux-gnu/libncurses.so.6 (0x00007f6cbacd7000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6cbaacf000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f6cba8c7000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6cba4f7000)
/lib64/ld-linux-x86-64.so.2 (0x000055bf27d65000)

#46 Updated by Greg Shah almost 7 years ago

Removing the ncurses 5.9 and then also removing the libncurses5-dev also solves the build problem on the Ubuntu Server 16.04 box.

The concerning thing is that that file is supposed to be there. It is included in the same package that installs ncurses 6.0:

> sudo apt-file search libncurses.so.5.9
...
libncurses5: /lib/x86_64-linux-gnu/libncurses.so.5.9
...

My concern is that if it is supposed to be there, some installed applications may not work without the 5.9 code. I also wonder if running apt-get might put those files back in place later, causing the build to break again.

So my solution of removing the files is probably not the correct solution. Do you have any ideas on why it is a problem on some systems and not all systems?

#47 Updated by Eugenie Lyzenko almost 7 years ago

Still thinking and experimenting for ncurses linking. I'm also worry about requirement to manually remove libncurses5. If the system will be updated on regular basis with re-installing ncurses - this library may appear again(with possible broken FWD build).

I'm inclining to the conclusion the reason is the library search order. For example if I remove libncurses.so.6* from /lib/x86_64-linux-gnu/ the libp2j.so is linking with /usr/lib/libncurses.so.6 instead of /lib/x86_64-linux-gnu/libncurses.so.6 as in my listing above, which is pretty exotic because libncurses.a is in /usr/lib/ so the location of the libncurses.a has no meaning for what *.so library is linking with.

What if you reinstall libncurses5 package? Is it too destructive to make this test on working system?

May be we will have to patch and install both 5.9 and 6.0 libraries if modern Linux distros want to keep both installations for compatibility(again internally this is the same ncurses5 package I guess but revisioned by different numbers).

#48 Updated by Greg Shah almost 7 years ago

What if you reinstall libncurses5 package? Is it too destructive to make this test on working system?

I don't think this can be done without breaking the system.

May be we will have to patch and install both 5.9 and 6.0 libraries if modern Linux distros want to keep both installations for compatibility(again internally this is the same ncurses5 package I guess but revisioned by different numbers).

The source package for 5.9 is no longer available in the repos.

Other ideas:

1. Force the search order.
2. Explicitly link to the 6.0 instead of the 5.9.

#49 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

May be we will have to patch and install both 5.9 and 6.0 libraries if modern Linux distros want to keep both installations for compatibility(again internally this is the same ncurses5 package I guess but revisioned by different numbers).

The source package for 5.9 is no longer available in the repos.

Other ideas:

1. Force the search order.
2. Explicitly link to the 6.0 instead of the 5.9.

Greg, I have another idea to test:

- Return ncurses 5.9 back to have the failure back.
- Change makefile for libp2j.so compilation from:
override LDFLAGS+=-lncurses -ldl -lutil
to
override LDFLAGS+=-L/usr/lib -lncurses -ldl -lutil
- Rebuild FWD

This should force the lib search first in /usr/lib. On my system this links libp2j.so with /usr/lib/libncurses.so.6

I think we need to avoid explicit definition for 6.0 in makefile. Just because this excludes possibility to build/run FWD on system older than Ubuntu 16.04 like level.

#50 Updated by Eugenie Lyzenko almost 7 years ago

I just realized the scenario I offered is a kind of option 1 in note 48.

And I have just tried to simulate the failure removing libncurses.so.6 for /usr/lib. Then changed library search path to override LDFLAGS+=-L/lib/x86_64-linux-gnu -lncurses -ldl -lutil, where another copy of the libncurses.so.6 exists and build became OK with linking to /lib/x86_64-linux-gnu/libncurses.so.6. So I think this should work in general for all systems.

#51 Updated by Eugenie Lyzenko almost 7 years ago

Also looks like the /etc/ld.so.conf content(with alphabetical ordering include files) has priority over /usr/lib where the ncurses built from sources install itself. And the file /etc/ld.so.conf can be different on many different systems, we can not control it. So I guess the best is to provide explicit library order in FWD makefile.

#52 Updated by Greg Shah almost 7 years ago

Unfortunately, the use of -L/usr/lib did not help.

[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process.c -o process.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys.c -o filesys.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/memory.c -o memory.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal.c -o terminal.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library.c -o library.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init.c -o init.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals.c -o signals.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell.c -o shell.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init_linux.c -o init_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process_linux.c -o process_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys_linux.c -o filesys_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal_linux.c -o terminal_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library_linux.c -o library_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals_linux.c -o signals_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell_linux.c -o shell_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -o libp2j.so process.o filesys.o memory.o terminal.o library.o init.o signals.o shell.o init_linux.o process_linux.o filesys_linux.o terminal_linux.o library_linux.o signals_linux.o shell_linux.o -static-libgcc -shared -lffi -L/usr/lib -lncurses -ldl -lutil
[ant:exec] makefile:250: recipe for target 'libp2j.so' failed
[ant:exec] /usr/bin/ld: /usr/lib/libncurses.a(lib_beep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
[ant:exec] /usr/lib/libncurses.a: error adding symbols: Bad value
[ant:exec] collect2: error: ld returned 1 exit status
[ant:exec] make: *** [libp2j.so] Error 1
:ant-native FAILED

#53 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Unfortunately, the use of -L/usr/lib did not help.

[...]

Can you test -L/lib/x86_64-linux-gnu value instead?

#54 Updated by Eugenie Lyzenko almost 7 years ago

One more question: what is the content of the /etc/ld.so.conf.d directory on problematic machine? This can possibly explain the library link search order.

#55 Updated by Greg Shah almost 7 years ago

Eugenie Lyzenko wrote:

Greg Shah wrote:

Unfortunately, the use of -L/usr/lib did not help.

[...]

Can you test -L/lib/x86_64-linux-gnu value instead?

It fails.

[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process.c -o process.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys.c -o filesys.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/memory.c -o memory.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal.c -o terminal.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library.c -o library.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init.c -o init.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals.c -o signals.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell.c -o shell.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init_linux.c -o init_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process_linux.c -o process_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys_linux.c -o filesys_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal_linux.c -o terminal_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library_linux.c -o library_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals_linux.c -o signals_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell_linux.c -o shell_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -o libp2j.so process.o filesys.o memory.o terminal.o library.o init.o signals.o shell.o init_linux.o process_linux.o filesys_linux.o terminal_linux.o library_linux.o signals_linux.o shell_linux.o -static-libgcc -shared -lffi -L/lib/x86_64-linux-gnu -lncurses -ldl -lutil
[ant:exec] makefile:250: recipe for target 'libp2j.so' failed
[ant:exec] /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libncurses.a(lib_beep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
[ant:exec] /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libncurses.a: error adding symbols: Bad value
[ant:exec] collect2: error: ld returned 1 exit status
[ant:exec] make: *** [libp2j.so] Error 1
:ant-native FAILED

#56 Updated by Greg Shah almost 7 years ago

ls -l /etc/ld.so.conf.d/
total 12
-rw-rw-r-- 1 root root 38 Nov 24  2014 fakeroot-x86_64-linux-gnu.conf
-rw-r--r-- 1 root root 44 Jan 27  2016 libc.conf
-rw-r--r-- 1 root root 68 Apr 14  2016 x86_64-linux-gnu.conf
lrwxrwxrwx 1 root root 43 Jul 11  2016 x86_64-linux-gnu_EGL.conf -> /etc/alternatives/x86_64-linux-gnu_egl_conf
lrwxrwxrwx 1 root root 42 Jul 11  2016 x86_64-linux-gnu_GL.conf -> /etc/alternatives/x86_64-linux-gnu_gl_conf

#57 Updated by Greg Shah almost 7 years ago

The contents:

cat /etc/ld.so.conf.d/*
/usr/lib/x86_64-linux-gnu/libfakeroot
# libc default configuration
/usr/local/lib
# Multiarch support
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/mesa-egl
/usr/lib/x86_64-linux-gnu/mesa

#58 Updated by Eugenie Lyzenko almost 7 years ago

Can you test one more scenario:

1. Move the following from /usr/lib to /usr/local/lib:

libcurses.a
libcurses.so
libncurses.a
libncurses.so
libncurses.so.6
libncurses.so.6.0

2. Clean -L link option
3. Build

and
2a. Use -L/usr/local/lib
3a. Build

The idea here is we probably need to change patched ncurses libs install directory to avoid interference with old versions.

#59 Updated by Greg Shah almost 7 years ago

It still fails:

[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process.c -o process.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys.c -o filesys.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/memory.c -o memory.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal.c -o terminal.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library.c -o library.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init.c -o init.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals.c -o signals.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell.c -o shell.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init_linux.c -o init_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process_linux.c -o process_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys_linux.c -o filesys_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal_linux.c -o terminal_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library_linux.c -o library_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals_linux.c -o signals_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell_linux.c -o shell_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -o libp2j.so process.o filesys.o memory.o terminal.o library.o init.o signals.o shell.o init_linux.o process_linux.o filesys_linux.o terminal_linux.o library_linux.o signals_linux.o shell_linux.o -static-libgcc -shared -lffi -L/usr/local/lib -lncurses -ldl -lutil
[ant:exec] makefile:250: recipe for target 'libp2j.so' failed
[ant:exec] /usr/bin/ld: /usr/local/lib/libncurses.a(lib_beep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
[ant:exec] /usr/local/lib/libncurses.a: error adding symbols: Bad value
[ant:exec] collect2: error: ld returned 1 exit status
[ant:exec] make: *** [libp2j.so] Error 1
:ant-native FAILED

#60 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

It still fails:

[...]

Please do another test:
1. Change line from
override LDFLAGS+=-lncurses -ldl -lutil
to
override LDFLAGS+=-lcurses -ldl -lutil
in makefile and try to build.

Another question. What is ld -V output on this system?

#61 Updated by Greg Shah almost 7 years ago

What is ld -V output on this system?

 ld -V
GNU ld (GNU Binutils for Ubuntu) 2.26.1
  Supported emulations:
   elf_x86_64
   elf32_x86_64
   elf_i386
   elf_iamcu
   i386linux
   elf_l1om
   elf_k1om
   i386pep
   i386pe

#62 Updated by Greg Shah almost 7 years ago

Using -lcurses still fails:

[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process.c -o process.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys.c -o filesys.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/memory.c -o memory.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal.c -o terminal.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library.c -o library.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init.c -o init.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals.c -o signals.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell.c -o shell.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init_linux.c -o init_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process_linux.c -o process_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys_linux.c -o filesys_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal_linux.c -o terminal_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library_linux.c -o library_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals_linux.c -o signals_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell_linux.c -o shell_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -o libp2j.so process.o filesys.o memory.o terminal.o library.o init.o signals.o shell.o init_linux.o process_linux.o filesys_linux.o terminal_linux.o library_linux.o signals_linux.o shell_linux.o -static-libgcc -shared -lffi -lcurses -ldl -lutil
[ant:exec] makefile:250: recipe for target 'libp2j.so' failed
[ant:exec] /usr/bin/ld: //usr/local/lib/libcurses.a(lib_beep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
[ant:exec] //usr/local/lib/libcurses.a: error adding symbols: Bad value
[ant:exec] collect2: error: ld returned 1 exit status
[ant:exec] make: *** [libp2j.so] Error 1
:ant-native FAILED

#63 Updated by Eugenie Lyzenko almost 7 years ago

I have one point that can look a bit strange.

What if we suggest: for some reasons the linker really takes libncurses.a instead of proper libncurses.so on linking considering -lncurses option. This can explain the error message at least. The reason can be the .so library is not possible to be read by user performs building. Or if to suggest strange thing the -shared link option does not work. What if to change the compiler option from -fpic to -fPIC?

What is happening if to remove libncurses.a from /usr/lib?

#64 Updated by Greg Shah almost 7 years ago

What is happening if to remove libncurses.a from /usr/lib?

It fails differently:

[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process.c -o process.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys.c -o filesys.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/memory.c -o memory.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal.c -o terminal.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library.c -o library.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init.c -o init.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals.c -o signals.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell.c -o shell.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init_linux.c -o init_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process_linux.c -o process_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys_linux.c -o filesys_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal_linux.c -o terminal_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library_linux.c -o library_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals_linux.c -o signals_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell_linux.c -o shell_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -o libp2j.so process.o filesys.o memory.o terminal.o library.o init.o signals.o shell.o init_linux.o process_linux.o filesys_linux.o terminal_linux.o library_linux.o signals_linux.o shell_linux.o -static-libgcc -shared -lffi -lncurses -ldl -lutil
[ant:exec] makefile:250: recipe for target 'libp2j.so' failed
[ant:exec] /usr/bin/ld: cannot find -lncurses
[ant:exec] collect2: error: ld returned 1 exit status
[ant:exec] make: *** [libp2j.so] Error 1
:ant-native FAILED

#65 Updated by Greg Shah almost 7 years ago

What is happening if to remove libncurses.a from /usr/lib?

I'm not sure why we would be dependent on the static library instead of the shared library...

What happens on your system?

#66 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

What is happening if to remove libncurses.a from /usr/lib?

I'm not sure why we would be dependent on the static library instead of the shared library...

Yes, we are not dependent on static library.

What happens on your system?

Nothing changes(expected). The building is OK. Because linker uses libncurses.so not libncurses.a. So for some reasons your system takes libncurses.a instead. What if you try to remove -static-libgcc option from linking command? Or move -shared option ahead of -static-libgcc?

#67 Updated by Greg Shah almost 7 years ago

What if to change the compiler option from -fpic to -fPIC?

If you are asking in regard to the option for libp2j.so objects, it makes no difference. I don't know if it would have an affect if specified in the ncurses build. But I don't think that is the issue here.

The core issue seems to be that when the libncurses.so.5.9 is present on this system, the linker (ld) somehow thinks we should be statically linking and it tries to link with libncurses.a, which fails. If libncurses.so.5.9 is removed, then we link with the patched shared library libncurses.so.6.0 and everything is OK.

#68 Updated by Greg Shah almost 7 years ago

What if you try to remove -static-libgcc option from linking command?

No difference. It fails the same way.

Or move -shared option ahead of -static-libgcc?

No difference. It fails the same way.

#69 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

What if to change the compiler option from -fpic to -fPIC?

If you are asking in regard to the option for libp2j.so objects, it makes no difference. I don't know if it would have an affect if specified in the ncurses build. But I don't think that is the issue here.

OK.

The core issue seems to be that when the libncurses.so.5.9 is present on this system, the linker (ld) somehow thinks we should be statically linking and it tries to link with libncurses.a, which fails. If libncurses.so.5.9 is removed, then we link with the patched shared library libncurses.so.6.0 and everything is OK.

I see. I'm trying to imagine how this can be explained.

What about output of the command: ldconfig -p | grep "curses"? This is the current ld cache state.

#70 Updated by Eugenie Lyzenko almost 7 years ago

Just for record. I have ncurses 5.9 version in all locations where 6.0 exists and building is fine. That's why I'm offering some exotic experiments.

#71 Updated by Eugenie Lyzenko almost 7 years ago

Looks like finally I have got some more progress here.

1. Installing yet another fresh 16.04 system I have found the ncurses from the box is libncurses5 release 6.0. The target library libncurses.so.5.9 has actual version 6.0. There is no 5.9 version on the system. That's why there is no 5.9 source packages available for Ubuntu, only 6.0.

2. On the other hand our patched library must be a substitution for current version, not an addition. So we need to keep current version number. Another word we should not produce libncurses.so.6.0 library.

3. The new patch script attached here(patch_ncurses6.sh) makes required actions. It builds libncusres.so.5.9 library from 6.0 sources. Can you please try to use it instead of regular script to build patched ncurses.

4. After new patched ncurses will be installed please remove libncurses.so.6* because it seems wrong to have this library.

5. And now I think it will be OK to build FWD on new systems. Please let me know the result.

I'm inclining to conclusion it is a kind of ncurses bug. Not in code but in version management. May be today we have a case of version migration in a middle cycle. May be we need to have more deep fixes/patches for ncurses. For now I need to know if new patch script is working or not.

#72 Updated by Greg Shah almost 7 years ago

What about output of the command: ldconfig -p | grep "curses"?

        libncursesw.so.5 (libc6,x86-64) => /lib/x86_64-linux-gnu/libncursesw.so.5
        libncurses.so.6 (libc6,x86-64) => /lib/x86_64-linux-gnu/libncurses.so.6
        libncurses.so.6 (libc6,x86-64) => /usr/lib/libncurses.so.6
        libncurses.so.5 (libc6,x86-64) => /lib/x86_64-linux-gnu/libncurses.so.5
        libncurses.so (libc6,x86-64) => /usr/lib/libncurses.so

/usr/lib/libncurses.so is a symlink to libncurses.so.6

#73 Updated by Greg Shah almost 7 years ago

1. Installing yet another fresh 16.04 system I have found the ncurses from the box is libncurses5 release 6.0. The target library libncurses.so.5.9 has actual version 6.0. There is no 5.9 version on the system. That's why there is no 5.9 source packages available for Ubuntu, only 6.0.

So on this freshly installed system, there was no libncurses.so.6.0, only a libncurses.so.5.9?

#74 Updated by Greg Shah almost 7 years ago

I did the following:

1. I ran sudo ./patch_ncurses6.sh /root. It seemed to succeed.

2. I cleared the ldd cache.

sudo rm /etc/ld.so.cache
sudo ldconfig

3. Deleted the .6* versions.

sudo rm /usr/lib/libncurses.so.6*
sudo rm /lib/x86_64-linux-gnu/libncurses.so.6*

4. Rebooted to ensure that the currently loaded ncurses would be the 5.9 version.

5. The status of the system now:

sudo ldconfig -p | grep "curses" 
        libncursesw.so.5 (libc6,x86-64) => /lib/x86_64-linux-gnu/libncursesw.so.5
        libncurses.so.5 (libc6,x86-64) => /lib/x86_64-linux-gnu/libncurses.so.5
        libncurses.so.5 (libc6,x86-64) => /usr/lib/libncurses.so.5
        libncurses.so (libc6,x86-64) => /usr/lib/libncurses.so

sudo find / -type f -name "libncurses.so*" 
/usr/lib/libncurses.so.5.9
/lib/x86_64-linux-gnu/libncurses.so.5.9.ori
/lib/x86_64-linux-gnu/libncurses.so.5.9

ls -l /usr/lib/libncurses*
-rw-r--r-- 1 root root  700464 Jun 22 08:40 /usr/lib/libncurses.a
-rw-r--r-- 1 root root  182198 Jun 22 08:40 /usr/lib/libncurses++.a
-rw-r--r-- 1 root root 4030308 Jun 22 08:40 /usr/lib/libncurses_g.a
-rw-r--r-- 1 root root  697024 Jun 22 08:40 /usr/lib/libncurses++_g.a
lrwxrwxrwx 1 root root      15 Jun 22 08:40 /usr/lib/libncurses.so -> libncurses.so.5
lrwxrwxrwx 1 root root      17 Jun 22 08:40 /usr/lib/libncurses.so.5 -> libncurses.so.5.9
-rwxr-x--- 1 root root  380920 Jun 22 08:40 /usr/lib/libncurses.so.5.9

ls -l /lib/x86_64-linux-gnu/libncurses*
lrwxrwxrwx 1 root root     21 Jun 22 08:48 /lib/x86_64-linux-gnu/libncurses.so.5 -> libncurses.so.5.9.ori
-rw-r--r-- 1 root root 380920 Jun 22 08:40 /lib/x86_64-linux-gnu/libncurses.so.5.9
-rw-r----- 1 root root 138112 Jun 22 08:40 /lib/x86_64-linux-gnu/libncurses.so.5.9.ori
lrwxrwxrwx 1 root root     18 Jun 20 17:47 /lib/x86_64-linux-gnu/libncursesw.so.5 -> libncursesw.so.5.9
-rw-r--r-- 1 root root 191464 Feb 19  2016 /lib/x86_64-linux-gnu/libncursesw.so.5.9

ls -l /usr/lib/libcurses*
lrwxrwxrwx 1 root root 12 Jun 22 08:40 /usr/lib/libcurses.a -> libncurses.a
lrwxrwxrwx 1 root root 17 Jun 22 08:40 /usr/lib/libcurses.so -> libncurses.so.5.9

Other than the fact that the libncursesw.* is not patched (we don't use it), there is nothing that appears wrong here.

6. Built FWD:

[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process.c -o process.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys.c -o filesys.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/memory.c -o memory.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal.c -o terminal.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library.c -o library.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init.c -o init.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals.c -o signals.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell.c -o shell.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/init_linux.c -o init_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/process_linux.c -o process_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/filesys_linux.c -o filesys_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/terminal_linux.c -o terminal_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/library_linux.c -o library_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/signals_linux.c -o signals_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -c /home/ges/projects/1514a/src/native/shell_linux.c -o shell_linux.o -DWORD_SIZE_64 -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/home/ges/projects/1514a/src/native -Wall -fpic
[ant:exec] gcc -o libp2j.so process.o filesys.o memory.o terminal.o library.o init.o signals.o shell.o init_linux.o process_linux.o filesys_linux.o terminal_linux.o library_linux.o signals_linux.o shell_linux.o -static-libgcc -shared -lffi -lncurses -ldl -lutil
[ant:exec] makefile:247: recipe for target 'libp2j.so' failed
[ant:exec] /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libncurses.a(lib_beep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
[ant:exec] /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libncurses.a: error adding symbols: Bad value
[ant:exec] collect2: error: ld returned 1 exit status
[ant:exec] make: *** [libp2j.so] Error 1
:ant-native FAILED

Your theory makes perfect sense. It explains quite a bit. And it is true that the ncurses v6 ABI is not compatible with the v5 ABI.

But for whatever reason, there is still an issue here.

#75 Updated by Greg Shah almost 7 years ago

Looking in the ncurses build log file we can see these things:

1. Both shared and static libs are being built during patching.
2. -fPIC is used for all objects being used in the libncurses.so.5.9.
3. -fPIC is NOT used for all objects being used in the libncurses.a. This is usually OK in a static lib.

Key question: in this failing case why are we linking with libncurses.a instead of libncurses.so?

When my builds succeed (on other systems), ldd libp2j.so reports that we are linked with the .so.

#76 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

1. Installing yet another fresh 16.04 system I have found the ncurses from the box is libncurses5 release 6.0. The target library libncurses.so.5.9 has actual version 6.0. There is no 5.9 version on the system. That's why there is no 5.9 source packages available for Ubuntu, only 6.0.

So on this freshly installed system, there was no libncurses.so.6.0, only a libncurses.so.5.9?

Yes, exactly. The 6.0 number is the result of the custom build for patched ncurses from sources.

#77 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Looking in the ncurses build log file we can see these things:

1. Both shared and static libs are being built during patching.
2. -fPIC is used for all objects being used in the libncurses.so.5.9.
3. -fPIC is NOT used for all objects being used in the libncurses.a. This is usually OK in a static lib.

Key question: in this failing case why are we linking with libncurses.a instead of libncurses.so?

Yes, agreed. My assumption somehow the gcc link command ignores -shared flag here. Previously I had the issue with native library build that caused by wrong format for makefile. For example the current content is:

...
<TAB>
$(eval $(compile))

$(SONAME): $(OBJS)
<TAB>$(LINKCMD) $(LDFLAGS)
...

It sounds as full crazy but the <TAB> char is very important here. If to substitute <TAB>$(LINKCMD) $(LDFLAGS) with spaces: $(LINKCMD) $(LDFLAGS) the building may stop working. Can you check if there is a <TAB> chars in makefile on problematic system.

#78 Updated by Greg Shah almost 7 years ago

My assumption somehow the gcc link command ignores -shared flag here.

I thought that using -shared on the gcc command line is to force gcc to know that the libp2j output it is creating will be a shared object .so. I didn't think it had anything to do with the way that we link to external modules.

It sounds as full crazy but the <TAB> char is very important here.

The tab is there. I am using an unmodified version of our makefile.

#79 Updated by Greg Shah almost 7 years ago

I found the problem:

ls -l /usr/lib/libncurses*
-rw-r--r-- 1 root root  700464 Jun 22 08:40 /usr/lib/libncurses.a
-rw-r--r-- 1 root root  182198 Jun 22 08:40 /usr/lib/libncurses++.a
-rw-r--r-- 1 root root 4030308 Jun 22 08:40 /usr/lib/libncurses_g.a
-rw-r--r-- 1 root root  697024 Jun 22 08:40 /usr/lib/libncurses++_g.a
lrwxrwxrwx 1 root root      15 Jun 22 08:40 /usr/lib/libncurses.so -> libncurses.so.5
lrwxrwxrwx 1 root root      17 Jun 22 08:40 /usr/lib/libncurses.so.5 -> libncurses.so.5.9
-rwxr-x--- 1 root root  380920 Jun 22 08:40 /usr/lib/libncurses.so.5.9  <------ PERMISSIONS ARE WRONG!!!!

I executed sudo chmod o+rx /usr/lib/libncurses.so.5.9 and the build works now. The linker tried to use libncurses.so.5.9, got a read error, then silently switched to using libncurses.a.

Last questions to answer:

1. Why were the permissions wrong in the first place?
2. Is it safe to change the patch_ncurses.sh to add the --with-rel-version=6.0 --with-abi-version=5?

#80 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

I found the problem:

[...]

I executed sudo chmod o+rx /usr/lib/libncurses.so.5.9 and the build works now. The linker tried to use libncurses.so.5.9, got a read error, then silently switched to using libncurses.a.

This is really great!

Last questions to answer:

1. Why were the permissions wrong in the first place?

The ncurses install approach is not simple copy generated lib to target dir. The makefile instructs the gcc to build one more copy from *.o objects in target directory instead.

So may be the user rights affect the final permissions of the installed library.

I can offer to add something like sudo chmod o+rx /usr/lib/libncurses.so.5.9 into patch_ncusres.sh script to make sure the *.so libraries will have correct permissions.

2. Is it safe to change the patch_ncurses.sh to add the --with-rel-version=6.0 --with-abi-version=5?

This is the good question. At least because the new patched 5.9 library has different size than pevious 6.0.

I have just tested the hotel ChUI application and it works with patched ncurses 5.9(built from 6.0 sources).

So I think it is safe. But as option we can leave and use libncurses.so.6 as well(fixing the permissions issue). I guess both patched and unpatched can co-exist in a system(although it will be a bit confusing point).

#81 Updated by Eugenie Lyzenko almost 7 years ago

One more question. What is the result of the command: ls -l /usr | grep "lib". My system shows:

drwxr-xr-x 159 root root 12288 Jun 15 03:20 lib

#82 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

I found the problem:

[...]

I executed sudo chmod o+rx /usr/lib/libncurses.so.5.9 and the build works now. The linker tried to use libncurses.so.5.9, got a read error, then silently switched to using libncurses.a.

Last questions to answer:

1. Why were the permissions wrong in the first place?

In your note 41 the library has correct permissions. What was the difference with last build? Specifying /root as location for object files? May be building inherits permissions from location of the *.o objects? What if you executing sudo patch_ncurses6.sh $PWD within some other directory of your /home location?

Some considerations about patched ncurses compatibility with the rest of the system tools that can potentially use ncurses.

1. The version installed on the fresh system is exactly the same as used while getting sources(6.0+20160213).
2. I think may be there is a reason to keep number 5 in library name alive(the old application keeps linkage to so.5 for example).

So we have possible two approaches:
1. Replace system's ncurses 5.9 compiling with option --with-rel-version=6.0 --with-abi-version=5 to complete replace regular ncurses library.
2. Make our own library either with unchanged patch_ncurses.sh having 6.0 version or making one release step ahead with option --with-rel-version=6.1 having 6.1 version(because we improve the sources).

I would choose option 2 because in this case we always know our FWD library will choose correct patched version and other system applications could continue use old 5.9 version from the box without risk of incompatibility with our patched library.

As I have tested for FWD it is not important which way to go - FWD will work in both options.

What do you think?

#83 Updated by Eugenie Lyzenko almost 7 years ago

Looking for question 1 answering I need additional data from problematic system. Can you test to run
sudo ./patch_ncurses6.sh $PWD
inside some directory on your home. I need to see if the permissions are OK in this case.

BTW, I tested sudo ./patch_ncurses6.sh /root and permissions are OK.

#84 Updated by Greg Shah almost 7 years ago

ls -l /usr | grep "lib"

drwxr-xr-x 125 root root 20480 Jun 22 09:32 lib

#85 Updated by Greg Shah almost 7 years ago

When built from cd && sudo /root/patch_ncurses.sh /root:

-rwxr-x--- 1 root root  380920 Jun 23 04:55 /usr/lib/libncurses.so.5.9

When built from root (sudo su) then cd && patch_ncurses.sh /root:

-rwxr-x--- 1 root root 380920 Jun 23 05:00 /usr/lib/libncurses.so.5.9

The result is the same. I think this is consistent on this box. The reason is probably related to the UMASK that is set here. I have the following set in /etc/login.defs:

# GCD 20121128 turn off world access, let group have full rights
# UMASK        022
UMASK     007

This is one of our standard workstation and standard server "hardening" features.

I can offer to add something like sudo chmod o+rx /usr/lib/libncurses.so.5.9 into patch_ncusres.sh script to make sure the *.so libraries will have correct permissions.

Yes, this is needed.

#86 Updated by Greg Shah almost 7 years ago

2. I think may be there is a reason to keep number 5 in library name alive(the old application keeps linkage to so.5 for example).

Yes. I think the platform maintainers left it there for a reason.

2. Make our own library either with unchanged patch_ncurses.sh having 6.0 version or making one release step ahead with option --with-rel-version=6.1 having 6.1 version(because we improve the sources).

I would choose option 2 because in this case we always know our FWD library will choose correct patched version and other system applications could continue use old 5.9 version from the box without risk of incompatibility with our patched library.

This seems confusing. Just as we have been confused about the version number, putting a version 6.0 (or 6.1) is something that will not properly explain what is happening to a user. And having multiple versions leaves the potential for linking problems, runtime problems etc...

1. Replace system's ncurses 5.9 compiling with option --with-rel-version=6.0 --with-abi-version=5 to complete replace regular ncurses library.

This seems like the right way to go.

Can you check to see how the original package is built in the Ubuntu repos? If they use the same approach, then this is safe.

#87 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

When built from cd && sudo /root/patch_ncurses.sh /root:

[...]

When built from root (sudo su) then cd && patch_ncurses.sh /root:

[...]

The result is the same. I think this is consistent on this box. The reason is probably related to the UMASK that is set here. I have the following set in /etc/login.defs:

[...]

This is one of our standard workstation and standard server "hardening" features.

Yes, confirm. The changes for UMASK triggers the issue to become visible on my VM Ubuntu 16.04 server system.

#88 Updated by Eugenie Lyzenko almost 7 years ago

I have got the way Ubuntu build ncurses. The complete config command:

configure --prefix=/usr --build=x86_64-linux-gnu --with-abi-version=5 --with-shared --mandir=/usr/share/man --with-manpage-format=normal --without-profile --without-debug --disable-rpath --enable-echo --enable-const --enable-pc-files --with-pkg-config-libdir=/usr/lib/x86_64-linux-gnu/pkgconfig --without-ada --without-tests --without-progs --with-gpm --enable-symlinks --disable-lp64 --with-chtype='long' --with-mmask-t='long' --disable-termcap --with-default-terminfo-dir=/etc/terminfo --with-terminfo-dirs="/etc/terminfo:/lib/terminfo:/usr/share/terminfo" --with-ticlib=tic --with-termlib=tinfo --with-versioned-syms --with-xterm-kbs=del --with-progs --with-install-prefix=/var/cache/apt-build/build/ncurses-6.0+20160213/debian/tmp --enable-overwrite --libdir=/usr/lib/x86_64-linux-gnu

So as you can see we can safely use --with-abi-version=5 option and it is enough(no additional release option) to build 5.9 library. I have included new patch_ncurses6.sh script with new config value and fixup for *.so final libraries. Please test new version on your system. If it works OK with you config too - we have got the solution.

#89 Updated by Eugenie Lyzenko almost 7 years ago

I guess we can merge the changes from ncurses_patch6.sh into ncurses_patch.sh. The changes should work for 5.9 version sources and this way we can have unified patch for all versions.

#90 Updated by Greg Shah almost 7 years ago

Yes, I'll take care of it.

Good job!

#91 Updated by Greg Shah over 6 years ago

  • Related to Bug #3219: recent Ubuntu/Linux builds use ncurses 6.0 and we don't link to it properly added

#92 Updated by Greg Shah over 6 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

I've updated the FWD docs (see Patching NCURSES) to explain this issue and to include the updated patch_ncurses.sh which resolves this problem.

#93 Updated by Constantin Asofiei over 4 years ago

Using a copy of our FWD virtual machine vdi, I'm having an ncurses issue. I've ran /root/patch_ncurses.sh, rebuilt FWD, and the FWD client still gets me this:

java: symbol lookup error: /home/fwd/deploy/lib/libp2j.so: undefined symbol: auto_getch_refresh

The library has this:

fwd@fwd-dev:~/p2j/build/lib$ ldd libp2j.so 
        linux-vdso.so.1 =>  (0x00007ffd7db4e000)
        libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f54c8c75000)
        libncurses.so.6 => /lib/x86_64-linux-gnu/libncurses.so.6 (0x00007f54c8a1a000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f54c8816000)
        libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f54c8612000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f54c8248000)
        /lib64/ld-linux-x86-64.so.2 (0x0000564beaae2000)

and the ncurses libs shows this:
fwd@fwd-dev:~$ ls -al /lib/x86_64-linux-gnu/libncurses*
lrwxrwxrwx 1 root root     17 Apr 12  2017 /lib/x86_64-linux-gnu/libncurses.so.5 -> libncurses.so.5.9
-rw-r--r-- 1 root root 138112 Feb 19  2016 /lib/x86_64-linux-gnu/libncurses.so.5.9
lrwxrwxrwx 1 root root     17 Sep 25 12:07 /lib/x86_64-linux-gnu/libncurses.so.6 -> libncurses.so.6.0
-rwxr-xr-x 1 root root 411464 Sep 25 12:07 /lib/x86_64-linux-gnu/libncurses.so.6.0
-rwxr-xr-x 1 root root 411464 Sep 25 12:07 /lib/x86_64-linux-gnu/libncurses.so.6.0.ori
lrwxrwxrwx 1 root root     18 Apr 12  2017 /lib/x86_64-linux-gnu/libncursesw.so.5 -> libncursesw.so.5.9
-rw-r--r-- 1 root root 191464 Feb 19  2016 /lib/x86_64-linux-gnu/libncursesw.so.5.9
fwd@fwd-dev:~$ ls -al /usr/lib/libncurses*
-rw-r--r-- 1 root root  724476 Sep 25 12:07 /usr/lib/libncurses.a
-rw-r--r-- 1 root root  182198 Sep 25 12:07 /usr/lib/libncurses++.a
-rw-r--r-- 1 root root 4273068 Sep 25 12:07 /usr/lib/libncurses_g.a
-rw-r--r-- 1 root root  697568 Sep 25 12:07 /usr/lib/libncurses++_g.a
lrwxrwxrwx 1 root root      15 Sep 25 12:07 /usr/lib/libncurses.so -> libncurses.so.6
lrwxrwxrwx 1 root root      17 Sep 25 12:07 /usr/lib/libncurses.so.6 -> libncurses.so.6.0
-rwxr-xr-x 1 root root  411464 Sep 25 12:07 /usr/lib/libncurses.so.6.0

Anyone has any idea what's wrong?

#94 Updated by Eugenie Lyzenko over 4 years ago

Constantin Asofiei wrote:

Using a copy of our FWD virtual machine vdi, I'm having an ncurses issue. I've ran /root/patch_ncurses.sh, rebuilt FWD, and the FWD client still gets me this:
[...]

The library has this:
[...]
and the ncurses libs shows this:
[...]

Anyone has any idea what's wrong?

The link /usr/lib/ncurses.so points to unpatched library /lib/x86_64-linux-gnu/libncurses.so.5.9. Edit the link to be pointed to /lib/x86_64-linux-gnu/libncurses.so.6.0 and compilation should work.

#95 Updated by Constantin Asofiei over 4 years ago

Eugenie Lyzenko wrote:

The link /usr/lib/ncurses.so points to unpatched library /lib/x86_64-linux-gnu/libncurses.so.5.9. Edit the link to be pointed to /lib/x86_64-linux-gnu/libncurses.so.6.0 and compilation should work.

Argh, there is a problem when the date of the deploy/lib files is 'in the past', deploy.prepare was not copying the proper libp2j.so... it's working now.

#96 Updated by Greg Shah about 3 years ago

  • Related to Bug #5166: libp2j.so links to unpatched ncurses 6.2 instead of the patched ncurses 5.9 added

Also available in: Atom PDF