bug-ncurses
[Top][All Lists]
Advanced

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

Re: Weird link issue


From: Thomas Dickey
Subject: Re: Weird link issue
Date: Sat, 5 Aug 2023 07:10:37 -0400

On Fri, Aug 04, 2023 at 07:28:06PM -0400, rsbecker@nexbridge.com wrote:
> On Friday, August 4, 2023 3:42 PM, Thomas Dickey wrote:
> >On Fri, Aug 04, 2023 at 12:38:06PM -0400, rsbecker@nexbridge.com wrote:
> >> I am trying to build ncurses on HPE NonStop. When configuring with or
> >> without -enable-widec, I get a link error on blue:
> >>
> >> **** ERROR **** [1210]:
> >>    ../obj_s/blue.o: In function `printcard':
> >>    ../obj_s/blue.o(.text+0x5fe): unresolved reference to attron.
> >> **** ERROR **** [1210]:
> >>    ../obj_s/blue.o(.text+0x667): unresolved reference to attroff.
> >>
> >> Is this a configuration or Makefile issue?
> >
> >perhaps the former.
> >
> >The makefile (unless something in the environment confuses it) would have
> the -I and
> >-L options first in the command-line, to persuade the compiler and linker
> to use the
> >in-tree sources/objects.
> >
> >However, if you're configuring shared libraries, for some platforms those
> options
> >aren't enough.  I haven't done anything with HPE NonStop, but recall some
> versions of
> >HP-UX having shared libraries effectively building into the library the
> install-
> >directory's path (and ignoring easy workarounds such as environment
> variables).
> >
> >So... your build might be trying to link against the system's curses
> library (which
> >might have some different symbol such as "_attron").
> 
> The configuration I am using is (slight change to get to what I really
> intend, which is --enable-widec:
> 
> CFLAGS="-c99" CPPFLAGS="-Winline -Wnowarn=317,734" LDFLAGS="-lrld"
> conf_script_floss_cc --enable-widec --with-shared
> 
> So lots of default stuff coming in, probably. The error below is independent
> of --with-shared (happens with or without). I was able to build on an older
> version of the operating system, but not anything recent. The shared flag on
> the platform needs to be -Wshared, which is not standard, but I don't know
> how to get that included in the configuration. When the configuration runs,

probably by adding it to the LDFLAGS environment variable.

(the configure script fills in a dozen or so cases where I was able to get
information, but doesn't remove anything from LDFLAGS).

> I get the following:
> 
> ** Configuration summary for NCURSES 6.4 20230311:
> 
>        extended funcs: yes
>        xterm terminfo: xterm-new
> 
>         bin directory: /usr/local/bin
>         lib directory: /usr/local/lib
>     include directory: /usr/local/include/ncursesw
>         man directory: /usr/local/share/man
>    terminfo directory: /usr/local/share/terminfo
> 
> ** Include-directory is not in a standard location
> 
> Not sure why the include directory is saying that. In any event, when using
> the above config, the link error is slightly different, occurring in the .so
> link:
> 
> xld command line:
>    /usr/bin/xld -o ../lib/libncursesw.so -shared ../obj_s/hardscroll.o
>    ../obj_s/hashmap.o ../obj_s/lib_addch.o ../obj_s/lib_addstr.o
>    ../obj_s/lib_beep.o ../obj_s/lib_bkgd.o ../obj_s/lib_box.o
>    ../obj_s/lib_chgat.o ../obj_s/lib_clear.o ../obj_s/lib_clearok.o
>    ../obj_s/lib_clrbot.o ../obj_s/lib_clreol.o ../obj_s/lib_color.o
>    ../obj_s/lib_colorset.o ../obj_s/lib_delch.o ../obj_s/lib_delwin.o
>    ../obj_s/lib_echo.o ../obj_s/lib_endwin.o ../obj_s/lib_erase.o
>    ../obj_s/lib_flash.o ../obj_s/lib_gen.o ../obj_s/lib_getch.o

I'd take a look at the symbols for lib_gen.o
and lib_gen.c, which is generated by filtering the result of running
curses.h through the compiler's preprocessor.

The script which does the work is ncurses/base/MKlib_gen.sh,
and for debugging it, I'd replace the assignment "PID=$$" by "PID=PID",
and comment-out the trap commands.  That would leave some useful files
for analysis (ncurses/*_PID.*).

lib_gen.c contains linkable functions for the function-like macros
defined in curses.h; generating it in this way is (usually) a better
solution than, say, producing both from some third file.

>    ../obj_s/lib_getstr.o ../obj_s/lib_hline.o ../obj_s/lib_immedok.o
>    ../obj_s/lib_inchstr.o ../obj_s/lib_initscr.o ../obj_s/lib_insch.o
>    ../obj_s/lib_insdel.o ../obj_s/lib_insnstr.o ../obj_s/lib_instr.o
>    ../obj_s/lib_isendwin.o ../obj_s/lib_leaveok.o ../obj_s/lib_mouse.o
>    ../obj_s/lib_move.o ../obj_s/lib_mvcur.o ../obj_s/lib_mvwin.o
>    ../obj_s/lib_newterm.o ../obj_s/lib_newwin.o ../obj_s/lib_nl.o
>    ../obj_s/lib_overlay.o ../obj_s/lib_pad.o ../obj_s/lib_printw.o
>    ../obj_s/lib_redrawln.o ../obj_s/lib_refresh.o ../obj_s/lib_restart.o
>    ../obj_s/lib_scanw.o ../obj_s/lib_screen.o ../obj_s/lib_scroll.o
>    ../obj_s/lib_scrollok.o ../obj_s/lib_scrreg.o ../obj_s/lib_set_term.o
>    ../obj_s/lib_slk.o ../obj_s/lib_slkatr_set.o ../obj_s/lib_slkatrof.o
>    ../obj_s/lib_slkatron.o ../obj_s/lib_slkatrset.o ../obj_s/lib_slkattr.o
>    ../obj_s/lib_slkclear.o ../obj_s/lib_slkcolor.o ../obj_s/lib_slkinit.o
>    ../obj_s/lib_slklab.o ../obj_s/lib_slkrefr.o ../obj_s/lib_slkset.o
>    ../obj_s/lib_slktouch.o ../obj_s/lib_touch.o ../obj_s/lib_tstp.o
>    ../obj_s/lib_ungetch.o ../obj_s/lib_vidattr.o ../obj_s/lib_vline.o
>    ../obj_s/lib_wattroff.o ../obj_s/lib_wattron.o ../obj_s/lib_winch.o
>    ../obj_s/lib_window.o ../obj_s/nc_panel.o ../obj_s/safe_sprintf.o
>    ../obj_s/tty_update.o ../obj_s/varargs.o ../obj_s/vsscanf.o
>    ../obj_s/lib_freeall.o ../obj_s/charable.o ../obj_s/lib_add_wch.o
>    ../obj_s/lib_box_set.o ../obj_s/lib_cchar.o ../obj_s/lib_erasewchar.o
>    ../obj_s/lib_get_wch.o ../obj_s/lib_get_wstr.o ../obj_s/lib_hline_set.o
>    ../obj_s/lib_in_wch.o ../obj_s/lib_in_wchnstr.o ../obj_s/lib_ins_wch.o
>    ../obj_s/lib_inwstr.o ../obj_s/lib_key_name.o ../obj_s/lib_pecho_wchar.o
>    ../obj_s/lib_slk_wset.o ../obj_s/lib_unget_wch.o ../obj_s/lib_vid_attr.o
>    ../obj_s/lib_vline_set.o ../obj_s/lib_wacs.o ../obj_s/lib_wunctrl.o
>    ../obj_s/expanded.o ../obj_s/legacy_coding.o ../obj_s/lib_dft_fgbg.o
>    ../obj_s/lib_print.o ../obj_s/new_pair.o ../obj_s/resizeterm.o
>    ../obj_s/use_screen.o ../obj_s/use_window.o ../obj_s/wresize.o
>    ../obj_s/access.o ../obj_s/add_tries.o ../obj_s/alloc_ttype.o
>    ../obj_s/codes.o ../obj_s/comp_captab.o ../obj_s/comp_error.o
>    ../obj_s/comp_hash.o ../obj_s/comp_userdefs.o ../obj_s/db_iterator.o
>    ../obj_s/doalloc.o ../obj_s/entries.o ../obj_s/fallback.o
>    ../obj_s/free_ttype.o ../obj_s/getenv_num.o ../obj_s/home_terminfo.o
>    ../obj_s/init_keytry.o ../obj_s/lib_acs.o ../obj_s/lib_baudrate.o
>    ../obj_s/lib_cur_term.o ../obj_s/lib_data.o ../obj_s/lib_has_cap.o
>    ../obj_s/lib_kernel.o ../obj_s/lib_keyname.o ../obj_s/lib_longname.o
>    ../obj_s/lib_napms.o ../obj_s/lib_options.o ../obj_s/lib_raw.o
>    ../obj_s/lib_setup.o ../obj_s/lib_termcap.o ../obj_s/lib_termname.o
>    ../obj_s/lib_tgoto.o ../obj_s/lib_ti.o ../obj_s/lib_tparm.o
>    ../obj_s/lib_tputs.o ../obj_s/lib_trace.o ../obj_s/lib_ttyflags.o
>    ../obj_s/lib_twait.o ../obj_s/name_match.o ../obj_s/names.o
>    ../obj_s/obsolete.o ../obj_s/read_entry.o ../obj_s/read_termcap.o
>    ../obj_s/strings.o ../obj_s/tries.o ../obj_s/trim_sgr0.o
> ../obj_s/unctrl.o
>    ../obj_s/visbuf.o ../obj_s/alloc_entry.o ../obj_s/captoinfo.o
>    ../obj_s/comp_expand.o ../obj_s/comp_parse.o ../obj_s/comp_scan.o
>    ../obj_s/parse_entry.o ../obj_s/write_entry.o ../obj_s/define_key.o
>    ../obj_s/hashed_db.o ../obj_s/key_defined.o ../obj_s/keybound.o
>    ../obj_s/keyok.o ../obj_s/version.o -L../lib -L/usr/local/lib -lfloss
>    -lutil -lrld -optional_lib -L /G/system/sys02 -lcre -lcrtl -lossk -lossf
>    -lsec -li18n -licnv -losse -linet -lossh -lossc -no_optional_lib
>    -allow_duplicate_procs -export_all

Given the lib_gen.c file from the build and the *PID* files from producing it,
I might see where the problem is.

(it might be, for instance, a problem running the C preprocessor)
 
> **** ERROR **** [1210]:
>    ../obj_s/lib_slkrefr.o: In function `slk_intern_refresh':
>    ../obj_s/lib_slkrefr.o(.text+0x3e3): unresolved reference to wattrset.
> 
> No output file created.
> 
> wattrset is defined in ncurses, as far as I can tell. This is rather
> confusing. The platform itself comes with ncurses, which may be problematic,
> but that build does not support wide characters, which is the only reason I
> am trying to build this.
> 
> Regards,
> Randall
> 

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]