Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sudo and vim, very strange resolvable symbol issue
#1
sudo and vim, very strange resolvable symbol issue
tl;dr - compiled sudo - visudo wasn't working/didn't like IRIX vi I guessed, so I compiled vim - ran into a really strange libXm.so/symbol issue when configured with gui-enabled/motif (whatever it autodetected), ended up saying whatever and compiled non-gui vim.   "gmake check" had some problems but I saw mrthinlysliced confirmed there are test failures so I'm not too bothered by it.  FYI it appears to overwrite IRIX vi. 

so I started with building sudo 1.8.25p1, here are my compile notes:

Code:
export CC=/usr/bin/cc
export CXX=/usr/bin/CC
export CFLAGS="-c99 -g0 -O2 -mips4"
export CXXFLAGS="-g0 -woff all -O2 -mips4"
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/ncurses -I/usr/nekoware/include"
export LDFLAGS=" -L/usr/local/lib -L/usr/local/lib32 -L/usr/nekoware/lib"

./configure --prefix=/usr/local 
gmake


--------> sgi doesn't have "MAP_ANON", but it does have "MAP_PRIVATE"
see man mmap for more details

added to beginning of arc4random.h, getentropy.c:
#ifdef __sgi
#define MAP_ANON MAP_PRIVATE
#endif

so I had/still have no idea how to setup sudo, but online guides said to use "visudo", so I ran into these unresolved symbols that appear to be coming from IRIX's vi:

Code:
-bash-4.2$ pwd
/usr/people/develop/dev/sudo/sudo-1.8.25p1
-bash-4.2$ su -
-bash-4.2# cd /usr/people/develop/dev/sudo/sudo-1.8.25p1
-bash-4.2# find . | grep visudo
./doc/visudo.cat
./doc/visudo.man.in
./doc/visudo.mdoc.in
./plugins/sudoers/regress/visudo
./plugins/sudoers/regress/visudo/test1.out.ok
./plugins/sudoers/regress/visudo/test1.sh
./plugins/sudoers/regress/visudo/test10.out.ok
./plugins/sudoers/regress/visudo/test10.sh
./plugins/sudoers/regress/visudo/test2.err.ok
./plugins/sudoers/regress/visudo/test2.out.ok
./plugins/sudoers/regress/visudo/test2.sh
./plugins/sudoers/regress/visudo/test3.err.ok
./plugins/sudoers/regress/visudo/test3.out.ok
./plugins/sudoers/regress/visudo/test3.sh
./plugins/sudoers/regress/visudo/test4.out.ok
./plugins/sudoers/regress/visudo/test4.sh
./plugins/sudoers/regress/visudo/test5.out.ok
./plugins/sudoers/regress/visudo/test5.sh
./plugins/sudoers/regress/visudo/test6.out.ok
./plugins/sudoers/regress/visudo/test6.sh
./plugins/sudoers/regress/visudo/test7.out.ok
./plugins/sudoers/regress/visudo/test7.sh
./plugins/sudoers/regress/visudo/test8.err.ok
./plugins/sudoers/regress/visudo/test8.out.ok
./plugins/sudoers/regress/visudo/test8.sh
./plugins/sudoers/regress/visudo/test9.out.ok
./plugins/sudoers/regress/visudo/test9.sh
./plugins/sudoers/visudo.c
./plugins/sudoers/.libs/visudo
./plugins/sudoers/visudo.o
./plugins/sudoers/visudo
-bash-4.2# file ./plugins/sudoers/visudo
./plugins/sudoers/visudo:        /bin/bash script text
-bash-4.2# file ./plugins/sudoers/.libs/visudo
./plugins/sudoers/.libs/visudo: ELF N32 MSB mips-4 dynamic executable (not stripped) MIPS - version 1
-bash-4.2# ldd ./plugins/sudoers/.libs/visudo
        libsudo_util.so.1  =>    /usr/people/develop/dev/sudo/sudo-1.8.25p1/lib/util/.libs/libsudo_util.so.1    
        libintl.so.9  =>         /usr/nekoware/lib/libintl.so.9 
        libiconv.so.3  =>        /usr/nekoware/lib/libiconv.so.3        
        libc.so.1  =>    /usr/lib32/libc.so.1   
        libpthread.so  =>        /usr/lib32/libpthread.so       
-bash-4.2# ./plugins/sudoers/.libs/visudo
571845:/usr/bin/vi: rld: Error: unresolvable symbol in /usr/bin/vi: _called_before
571845:/usr/bin/vi: rld: Error: unresolvable symbol in /usr/bin/vi: resetterm
571845:/usr/bin/vi: rld: Error: unresolvable symbol in /usr/bin/vi: _first_term
571845:/usr/bin/vi: rld: Fatal Error: this executable has unresolvable symbols
visudo: /etc/sudoers.tmp unchanged
-bash-4.2# 


so I figured what the heck, might as well compile vim.  I let configure do the enable-gui default.  I ran into a really strange issue during final linking.  Here are my GUI compile notes:


Code:
########### motif gui (auto)

export CC=/usr/bin/cc
export CXX=/usr/bin/CC
export CFLAGS="-c99 -g0 -O2 -mips4"
export CXXFLAGS="-g0 -woff all -O2 -mips4"
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/ncurses -I/usr/nekoware/include"
export LDFLAGS=" -L/usr/local/lib -L/usr/local/lib32 -L/usr/nekoware/lib"

./configure --prefix=/usr/local 
gmake


<snip>

  /usr/bin/cc   -L/usr/local/lib -L/usr/local/lib32 -L/usr/nekoware/lib         -o vim objects/arabic.o objects/beval.o objects/buffer.o objects/blowfish.o objects/crypt.o objects/crypt_zip.o objects/dict.o objects/diff.o objects/digraph.o objects/edit.o objects/eval.o objects/evalfunc.o objects/ex_cmds.o objects/ex_cmds2.o objects/ex_docmd.o objects/ex_eval.o objects/ex_getln.o objects/farsi.o objects/fileio.o objects/fold.o objects/getchar.o objects/hardcopy.o objects/hashtab.o  objects/if_cscope.o objects/if_xcmdsrv.o objects/list.o objects/mark.o objects/memline.o objects/menu.o objects/misc1.o objects/misc2.o objects/move.o objects/mbyte.o objects/normal.o objects/ops.o objects/option.o objects/os_unix.o objects/pathdef.o objects/popupmnu.o objects/pty.o objects/quickfix.o objects/regexp.o objects/screen.o objects/search.o objects/sha256.o objects/spell.o objects/spellfile.o objects/syntax.o objects/tag.o objects/term.o objects/terminal.o objects/ui.o objects/undo.o objects/userfunc.o objects/version.o objects/window.o objects/gui.o objects/gui_motif.o objects/gui_x11.o objects/gui_beval.o objects/gui_xmdlg.o objects/gui_xmebw.o objects/encoding.o objects/keyboard.o objects/mouse.o objects/parser.o objects/pen.o objects/termscreen.o objects/state.o objects/unicode.o objects/vterm.o          objects/netbeans.o objects/channel.o objects/xdiffi.o objects/xemit.o objects/xprepare.o objects/xutils.o objects/xhistogram.o objects/xpatience.o   objects/charset.o objects/json.o objects/main.o objects/memfile.o objects/message.o  -lXmu -lXext -lXm -lXt -lSM -lICE -lXpm -lXt -lX11 -lw -ldl  -lm -lncurses -lelf -lnsl -lsocket  -liconv -lintl           
ld32: WARNING 84 : /usr/lib32/libw.so is not used for resolving any symbol.
ld32: WARNING 84 : /usr/lib32/libdl.so is not used for resolving any symbol.
ld32: WARNING 84 : /usr/lib32/libelf.a is not used for resolving any symbol.
ld32: WARNING 84 : /usr/lib32/libsocket.so is not used for resolving any symbol.
ld32: ERROR   33 : Unresolved text symbol "XmeRenderTableGetDefaultFont" -- 1st referenced by objects/gui_motif.o.
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "XmeDrawShadows" -- 1st referenced by objects/gui_xmebw.o.
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "XmeDrawHighlight" -- 1st referenced by objects/gui_xmebw.o.
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "XmeClearBorder" -- 1st referenced by objects/gui_xmebw.o.
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: INFO    152: Output file removed because of error.
gmake[1]: *** [vim] Error 2
gmake[1]: Leaving directory `/usr/people/develop/dev/vim/vim-master/src'
gmake: *** [first] Error 2
-bash-4.2$

so I figured it was a -Lpath issue or I had to link the libraries right after the specific mentioned object files - but I just couldn't get it to work, so I decided to hunt for the specific symbols in all my libs:

Code:
-bash-4.2$ nm -Bo /lib/*.so* > /tmp/symbols
-bash-4.2$ nm -Bo /lib32/*.so*  >> /tmp/symbols
-bash-4.2$ nm -Bo /usr/lib/*.so* >> /tmp/symbols
-bash-4.2$ nm -Bo /usr/lib32/*.so* >> /tmp/symbols
-bash-4.2$ nm -Bo /usr/local/lib/*.so*  >> /tmp/symbols
-bash-4.2$ nm -Bo /usr/local/lib32/*.so* >> /tmp/symbols
-bash-4.2$ nm -Bo /usr/nekoware/lib/*.so* >> /tmp/symbols

-bash-4.2$ mv /tmp/symbols ./symbols.so.all.txt

-bash-4.2$ grep XmeRenderTableGetDefaultFont symbols.so.all.txt
/usr/lib32/libSgm.so.2: 023af9f0 U XmeRenderTableGetDefaultFont
/usr/lib32/libXm.so.2: 00000000 U .text.XmeRenderTableGetDefaultFont
/usr/lib32/libXm.so.2: 018fd530 T XmeRenderTableGetDefaultFont
-bash-4.2$

-bash-4.2$ ls -la /usr/lib32/libXm.so*
lrwxr-xr-x 1 root sys      19 Jun  8 19:12 /usr/lib32/libXm.so -> ../lib32/libXm.so.1
-r--r--r-- 1 root sys 3126652 Apr 30 04:30 /usr/lib32/libXm.so.1
-r--r--r-- 1 root sys 4268716 Mar 15  2018 /usr/lib32/libXm.so.2


ok, so If I can understand what's going on here, "U" means undefined and I ingnore those - "T" is what I want to find, I have an "older" libXm.so.2 that's not being used, but it's the only lib I have that has the required symbol that vim gui is looking for...  and I was doing something on 6/8 that linked libXm.so.1 to /usr/lib32/libXm.so and that's what my system is using...  I took a look at what I might have possibly been doing 6/8 @ 19:12 via:

Code:
-bash-4.2# /usr/nekoware/bin/find / -newermt "2018-06-08 19:11:00" -not -newermt "2018-06-08 19:13:00"

and I dunno, looks like I was installing a ton of stuff - maya, adobe, etc etc.  I think that was when I did a reinstall, installed like almost my entire software library to the o2 and cloned my drive to a SSD. 

I'm sort of assuming not to fuck with it?  If I unlink /usr/lib32/libXm.so and link it to /usr/lib32/libXm.so.2 I'm assuming I could break who knows what, and if I Temporarily  link it to /usr/lib32/libXm.so.2 just to finish the compile and link back to /usr/lib32/libXm.so.1, I would have a vim gui binary that wouldn't  work.  Anyone have any ideas? Am I somehow using the inferior version of /usr/lib32/libXm.so?  is so.2 > so.1?  
(I dunno why these letters are getting smaller and smaller...)

My only guess is that I installed something older (like say Maya 1.0), it installed and linked an older library.  I can't think of what else might be the cause, but I'm not too sure.

I ended up just doing:


Code:
./configure --prefix=/usr/local --enable-gui=no

I didn't count on "gmake install" actually overwriting /usr/bin/vi (and it soft linked it to ex...), but whatevs - I'll copy it over from my Tezro, I actually like vim better.

BTW here are the test errors I had with "gmake check"


Code:
======================= gmake check

Test results:


From test_diffmode.vim:
Found errors in Test_diff_screen():
function RunTheTest[40]..Test_diff_screen[102]..VerifyInternal[4]..VerifyScreenDump line 18: See dump file difference: call term_dumpdiff("Test_diff_19.dump.failed", "dumps/Test_diff_19.dump")

From test_iminsert.vim:
Found errors in Test_iminsert2():
function RunTheTest[40]..Test_iminsert2 line 10: Expected 1 but got 0

From test_search.vim:
Found errors in Test_incsearch_substitute_dump():
function RunTheTest[40]..Test_incsearch_substitute_dump[40]..VerifyScreenDump line 18: See dump file difference: call term_dumpdiff("Test_incsearch_substitute_03.dump.failed", "dumps/Test_incsearch_substitute_03.dump")

From test_terminal.vim:
Found errors in Test_terminal_composing_unicode():
First run:
function RunTheTest[40]..Test_terminal_composing_unicode line 38: Pattern 'echo がィ£™げご' does not match '$ echo がィ£™げ�゙'
function RunTheTest[40]..Test_terminal_composing_unicode line 39: Expected 'がィ£™げご' but got 'がィ£™げ�゙'
function RunTheTest[40]..Test_terminal_composing_unicode line 45: Expected 'ご' but got '�゙'
Second run:
function RunTheTest[40]..Test_terminal_composing_unicode line 38: Pattern 'echo がィ£™げご' does not match '$ echo がィ£™げ�゙'
function RunTheTest[40]..Test_terminal_composing_unicode line 39: Expected 'がィ£™げご' but got 'がィ£™げ�゙'
function RunTheTest[40]..Test_terminal_composing_unicode line 45: Expected 'ご' but got '�゙'
Found errors in Test_terminal_noblock():
First run:
Caught exception in Test_terminal_noblock(): WaitFor() timed out after 10000 msec @ function RunTheTest[40]..Test_terminal_noblock[18]..WaitFor, line 4
Second run:
Caught exception in Test_terminal_noblock(): WaitFor() timed out after 10000 msec @ function RunTheTest[40]..Test_terminal_noblock[18]..WaitFor, line 4

From test_alot_utf8.vim:
Found errors in Test_read_fifo_utf8():
function RunTheTest[40]..Test_read_fifo_utf8 line 24: Expected ['テスョ, '€Àă̓Ӄ٧] but got []

From test_alot.vim:
Found errors in Test_filetype_detection():
function RunTheTest[40]..Test_filetype_detection[2]..CheckItems line 9: with file name: /etc/init/file.conf: Expected 'upstart' but got ''
function RunTheTest[40]..Test_filetype_detection[2]..CheckItems line 9: with file name: /etc/init/file.override: Expected 'upstart' but got ''
Found errors in Test_libcall_libcallnr():
Caught exception in Test_libcall_libcallnr(): Vim(call):dlerror = "584174:../vim: rld: Fatal Error: Cannot Successfully map soname '' under any of the filenames /usr/nekoware/lib/:/usr/local/lib/:/usr/local/lib32/:/usr/lib32/:/usr/lib32/internal/:/lib32/:/opt/lib32/: " @ function RunTheTest[40]..Test_libcall_libcallnr, line 30
Found errors in Test_suspend():
function RunTheTest[40]..Test_suspend[24]..WaitForAssert[2]..<SNR>10_WaitForCommon[11]..<lambda>10093 line 1: Pattern '$ $' does not match '  1 foo'
function RunTheTest[40]..Test_suspend[24]..WaitForAssert[2]..<SNR>10_WaitForCommon[11]..<lambda>10095 line 1: Pattern '$ $' does not match '  1 foo'
function RunTheTest[40]..Test_suspend[24]..WaitForAssert[2]..<SNR>10_WaitForCommon[11]..<lambda>10097 line 1: Pattern '$ $' does not match '  1 foo'
function RunTheTest[40]..Test_suspend[24]..WaitForAssert[2]..<SNR>10_WaitForCommon[11]..<lambda>10099 line 1: Pattern '$ $' does not match '  1 foo'
function RunTheTest[40]..Test_suspend[24]..WaitForAssert[2]..<SNR>10_WaitForCommon[11]..<lambda>10101 line 1: Pattern '$ $' does not match '  1 foo'
function RunTheTest[40]..Test_suspend[38]..WaitForAssert[2]..<SNR>10_WaitForCommon[11]..<lambda>10103 line 1: Pattern '$ $' does not match '  1 foo'
TEST FAILURE
gmake[2]: *** [report] Error 1
gmake[2]: Leaving directory `/usr/people/develop/dev/vim/vim-master/src/testdir'
gmake[1]: *** [scripttests] Error 2
gmake[1]: Leaving directory `/usr/people/develop/dev/vim/vim-master/src'
gmake: *** [test] Error 2
-bash-4.2$ 
gijoe77 Offline
Tezro

Posts: 354
Threads: 23
Joined: Jun 2018
Find Reply
09-27-2018, 11:59 PM
#2
RE: sudo and vim, very strange resolvable symbol issue
http://forums.irix.cc/thread-16-post-1935.html#pid1935 For sudo check my flags here.
I'm the manager
Besides irix.cc, I run these sites:
projectkitsune.com
kazuo.io

Tezro
Octane2
Indigo2 IMPACT
Indigo2
3x O2
3x Indy

Raion Offline
Administrator
*******

Posts: 270
Threads: 46
Joined: Nov 2017
Discord: Umbra#0893
Website Find Reply
09-28-2018, 12:07 AM
#3
RE: sudo and vim, very strange resolvable symbol issue
ok cool, thanks

edit:
i went with these options "--enable-static-sudoers --enable-static --disable-shared --disable-root-sudo"
I don't have a root password so I'm not worried about the security timeouts Smile I'll have to do some digging on how to actually set this thing up hah. I'll have to get around to copying the IRIX vi back to see if building sudo statically fixes that strange vi symbols error
(This post was last modified: 09-28-2018, 01:29 AM by gijoe77.)
gijoe77 Offline
Tezro

Posts: 354
Threads: 23
Joined: Jun 2018
Find Reply
09-28-2018, 12:18 AM


Forum Jump:


Users browsing this thread: 1 Guest(s)