Re: [gtk-osx-users] Add ncurses librairy.

Le 15 août 2019 à 23:52, John Ralls <jralls ceridwen us> a écrit :

On Aug 15, 2019, at 1:02 PM, Pascal <p p14 orange fr> wrote:


I've got linker errors with my program which use ncurses.
Previously it link against librairies in /usr/lib from Apple developper tools.
But since Command Line Tools (HS 10.13), I got:
Undefined symbols for architecture x86_64:
"_current_item", referenced from:
   _terminal_interface__curses__menus__current in terminal_interface-curses-menus.o
"_free_item", referenced from:
   _terminal_interface__curses__menus__delete in terminal_interface-curses-menus.o
   terminal_interface__curses__menus(float, long double,...)(...) in terminal_interface-curses-menus.o
"_free_menu", referenced from:
   _terminal_interface__curses__menus__delete__2 in terminal_interface-curses-menus.o
"_top_row", referenced from:
   _terminal_interface__curses__menus__top_row in terminal_interface-curses-menus.o
  (maybe you meant: _terminal_interface__curses__menus__top_row, 
_terminal_interface__curses__menus__set_top_row )
"_unpost_menu", referenced from:
   _terminal_interface__curses__menus__post in terminal_interface-curses-menus.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

Like the lib menu is not seen for x86_64, but it seems to be ok:

$ otool -vf /usr/lib/libmenu.dylib
Fat headers
fat_magic FAT_MAGIC
nfat_arch 2
architecture x86_64
 cputype CPU_TYPE_X86_64
 cpusubtype CPU_SUBTYPE_X86_64_ALL
 capabilities 0x0
 offset 4096
 size 36064
 align 2^12 (4096)
architecture i386
 cputype CPU_TYPE_I386
 cpusubtype CPU_SUBTYPE_I386_ALL
 capabilities 0x0
 offset 40960
 size 35488
 align 2^12 (4096)

It's really a pity that some libraries coming from Apple fail :-(
I was advised to build the library from source
Though it is available with other building systems, I aim to get it via gtk-osx.
What is the best way to add it?


It's strange enough that something is still using curses in 2019, but stranger still that it uses curses 
and Gtk.

Yes it looks strange ;-)
I build a set of Ada libraries based on GTK, ncurses and many others:

Anyway, the direct answer to your question is to just add it to your local module set just like any other 
library that you need.

I've added ncurses in a moduleset:
  <repository type="tarball" name=""
 <autotools id="ncurses"
            autogenargs="--enable-pc-files --without-tests">
    <branch repo=""

But I need the Ada compiler to be on PATH, I've added it to my PATH but when I do jhbuild it isn't present 
How to transfert the Ada compiler path to jhbuild?

But first make sure that the symbols really are missing, they're present in 10.14:
$ Manjusri:/Users/john> nm /usr/lib/libmenu.5.4.dylib | grep _unpost_menu
000000000000379a T _unpost_menu
$ Manjusri:/Users/john> nm /usr/lib/libmenu.5.4.dylib | grep _current_item
00000000000024cd T _current_item
000000000000240d T _set_current_item
$ Manjusri:/Users/john> nm /usr/lib/libmenu.5.4.dylib | grep _free_item
000000000000269c T _free_item
$ Manjusri:/Users/john> nm /usr/lib/libmenu.5.4.dylib | grep _free_menu
0000000000002c2a T _free_menu
$ Manjusri:/Users/john> nm /usr/lib/libmenu.5.4.dylib | grep _top_row
0000000000002913 T _set_top_row
00000000000029da T _top_row

It's libncurses 5.4 released in 2004, meaning that Apple has probably not changed it since MacOS X 10.2 or 
so. ISTM it's more likely that you've got the wrong link order than that libmenu is missing all of its 

So mine does:
$ nm /usr/lib/libmenu.5.4.dylib | grep _current_item
00000000000023bd T _current_item
00000000000022ee T _set_current_item

Symbols are present but not seen for x86_64.
Well, I took libmenu.5.4.dylib from an old Snow Leopard macOS with linking success.
The difference between both is that the older one has PPC symbols.
Maybe Apple has stripped out PPC symbols and make it wrong I guess.

Regards, Pascal.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]