To LibNix or not to Libnix or how do I get this c#ap to link
  • Moderator
    Kronos
    Posts: 2237 from 2003/2/24
    O.k. so I'm trying to port some shell/ncurses based code and ended up having lots of "undefined reference" to swprintf() and other function defined in LibNix.


    Allways thought not useing -noixemul would resort to linking with libnix, but also added -lc to the commandline.

    Nothing helps sofar....
  • »10.04.17 - 12:51
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    Your full gcc invocation pasted here might help... Also, if you're using ncurses, libnix seems kind of odd.
  • »10.04.17 - 13:14
    Profile Visit Website
  • Moderator
    Kronos
    Posts: 2237 from 2003/2/24
    Well when I hit "documentation" on these functions in FlowStudio I end up in LibNix, so thats why I thought I'd need that:

    Linking is done this way:
    Code:
    ppc-morphos-gcc-4 -lc  block.o buffer.o cmds.o cmds_command.o cmds_edit.o cmds_insert.o cmds_normal.o cmds_visual.o color.o conf.o dep_graph.o exec.o file.o filter.o format.o freeze.o gram.o help.o hide_show.o history.o input.o interp.o lex.o lua.o main.o maps.o marks.o pipe.o range.o shift.o sort.o trigger.o tui.o undo.o vmtbl.o wcswidth.o xls.o xlsx.o xmalloc.o yank.o utils/dictionary.o utils/extra.o utils/string.o -o scim -lncurses


    "wcswidth.o" is a file I added that defines all missing references (so I could see what else I'm missing).

    Needless to say the resulting binary is an instant hit.....
  • »10.04.17 - 13:41
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    Try with GCC5. No idea why you'd need -lc really.
  • »10.04.17 - 16:01
    Profile Visit Website
  • Moderator
    Kronos
    Posts: 2237 from 2003/2/24
    Quote:

    jacadcaps wrote:
    Try with GCC5.


    Same result.

    Quote:

    No idea why you'd need -lc really.



    Code:
    LIBRARY
    Standard C Library (libc, -lc)


    So I thought I may need that (all combinations of gcc4/5 with or without -lc have been tried).

    Must admit I never fully understood all that libnix, ixemul and noixemul to the full extend as I've sofar allwys written code that compiles with -noixemul.
    On the long run that is also the plan here, but I'd rather have a working binary as a starting point.
  • »10.04.17 - 16:10
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 2971 from 2003/3/5
    From: Canada
    I'm not 100% our widechar support is complete - maybe you've simply hit a function that isn't supplied. In that case you have to provide it yourself.
  • »10.04.17 - 16:51
    Profile Visit Website
  • Moderator
    Kronos
    Posts: 2237 from 2003/2/24
    Currently I "provide" swprintf,wcwidth,wcswidth and DynLoadBase.

    Haven't really investigated the DynLoadBase case.

    Widechar had been recently added to the original source so I might just checkout an older version (suboptimal).

    Edith:
    wcswidth() can only be found in LibNIX.guide, swprintf() is also found in 2 versions of wchar.h so yeah seems it's incomplete.

    [ Edited by Kronos 10.04.2017 - 18:08 ]
  • »10.04.17 - 17:01
    Profile