Coder Social home page Coder Social logo

ubuntu x64 ncurses lib missing about 123elf HOT 15 CLOSED

onoraba avatar onoraba commented on June 8, 2024
ubuntu x64 ncurses lib missing

from 123elf.

Comments (15)

taviso avatar taviso commented on June 8, 2024 2

I think I've finally got it - I installed focal in a VM, and it seems to work now!

from 123elf.

stmuk avatar stmuk commented on June 8, 2024 2

I can confirm that works for me. It's nice seeing 123 greater than 80x25!

from 123elf.

taviso avatar taviso commented on June 8, 2024 1

Hmm -- I think it wants the static version, maybe it's lib32ncurses-dev?

I'll try to get better build instructions for Ubuntu this weekend, I was mostly using Fedora while hacking on this!

from 123elf.

stmuk avatar stmuk commented on June 8, 2024 1

I had to # apt install libncurses5-dev:i386 on Ubuntu 20.04.

I've not yet built the binary due to linking errors, but I got further with adding -fno-stack-protector /lib32/libc_nonshared.a to CFLAGS. The latter fixed undefined reference to __libc_csu_fini (not sure if it's the correct way of doing this) and the former undefined reference to `__stack_chk_fail_local'

I'm now stuck on

cc -m32 -ggdb3 -O0 -Wno-multichar -fno-stack-protector /lib32/libc_nonshared.a  -B. -Wl,-b,coff-i386  123.o dl_init.o main.o forceplt.o wrappers.o patch.o  -lncurses -o 123
./ld: 123.o:nrcreate.c:(.text+0xb60b4): undefined reference to `close_range'
./ld: 123.o:nrcreate.c:(.text+0xb61ce): undefined reference to `close_range'
./ld: 123.o:nrfixup.c:(.text+0xb6ca5): undefined reference to `close_range'
./ld: 123.o:nrfixup.c:(.text+0xb6e52): undefined reference to `close_range'
./ld: forceplt.o: in function `__require_ref':
(.text+0x5b): undefined reference to `close_range'
./ld: (.text+0xec): undefined reference to `fstat'
./ld: (.text+0x209): undefined reference to `mknod'
./ld: (.text+0x358): undefined reference to `stat'
./ld: wrappers.o: in function `__unix_stat':
/home/steve/sandbox/123elf/wrappers.c:134: undefined reference to `stat'
./ld: wrappers.o: in function `__unix_fstat':
/home/steve/sandbox/123elf/wrappers.c:148: undefined reference to `fstat'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: 123] Error 1

from 123elf.

taviso avatar taviso commented on June 8, 2024 1

Hmm, okay - can you try running this manually to see if it works:

cc forceplt.o -lc -m32 -ggdb3 -O0 -Wno-multichar -fno-stack-protector -B. -Wl,-b,coff-i386 -no-pie  123.o dl_init.o main.o wrappers.o patch.o  -lncurses -o 123

It must be a link order issue!

from 123elf.

onoraba avatar onoraba commented on June 8, 2024

Building binutils with --enable-tui didn't help

from 123elf.

onoraba avatar onoraba commented on June 8, 2024

maybe it's lib32ncurses-dev

thanks, after installing I get new error

$ make
cc -m32 -ggdb3 -O0 -Wno-multichar  -m32 -ggdb3 -O0 -Wno-multichar -B. -Wl,-b,coff-i386  coffsyrup.c  -lncurses -o coffsyrup
./ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib32/Scrt1.o: in function `_start':
(.text+0x1c): undefined reference to `__libc_csu_fini'
./ld: (.text+0x23): undefined reference to `__libc_csu_init'
./ld: /tmp/cckQdK5o.o: in function `main':
/home/user/123/123elf/coffsyrup.c:382: undefined reference to `__stack_chk_fail_local'
./ld: coffsyrup: hidden symbol `__stack_chk_fail_local' isn't defined
./ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [<builtin>: coffsyrup] Error 1

from 123elf.

onoraba avatar onoraba commented on June 8, 2024

yep, added -fno-stack-protector /lib32/libc_nonshared.a to CFLAGS

and stuck on

$ make
cc -m32 -ggdb3 -O0 -Wno-multichar -fno-stack-protector /lib32/libc_nonshared.a -B. -Wl,-b,coff-i386  123.o dl_init.o main.o forceplt.o wrappers.o patch.o  -lpanel -lncurses -dynamic-linker /usr/lib32/ld-linux.so.2 -o 123
./ld: 123.o:nrcreate.c:(.text+0xb60b4): undefined reference to `close_range'
./ld: 123.o:nrcreate.c:(.text+0xb61ce): undefined reference to `close_range'
./ld: 123.o:nrfixup.c:(.text+0xb6ca5): undefined reference to `close_range'
./ld: 123.o:nrfixup.c:(.text+0xb6e52): undefined reference to `close_range'
./ld: forceplt.o: in function `__require_ref':
(.text+0x5b): undefined reference to `close_range'
./ld: (.text+0xec): undefined reference to `fstat'
./ld: (.text+0x209): undefined reference to `mknod'
./ld: (.text+0x358): undefined reference to `stat'
./ld: wrappers.o: in function `__unix_stat':
/home/user/123/123elf/wrappers.c:134: undefined reference to `stat'
./ld: wrappers.o: in function `__unix_fstat':
/home/user/123/123elf/wrappers.c:148: undefined reference to `fstat'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: 123] Error 1

from 123elf.

taviso avatar taviso commented on June 8, 2024

Oops - that looks like a bug, close_range should be a localized. Let me quickly push that change and see if that fixes it.

from 123elf.

stmuk avatar stmuk commented on June 8, 2024

That fixes close_range

from 123elf.

taviso avatar taviso commented on June 8, 2024

Hmm, I think I just need to add stat, mknod and fstat to forceplt.s -- can you see if that does anything? (Note: you might need to make clean after changing it)

Nevermind, they're already in there - very confusing! It might take me a few hours before I can get to my Ubuntu machine and repro, sorry!

from 123elf.

taviso avatar taviso commented on June 8, 2024

Okay, I think I've found the problem -- give me five minutes to commit something.

from 123elf.

taviso avatar taviso commented on June 8, 2024

It might work now -- although I'm still confused about how a few things work, can you see if it makes any progress?

from 123elf.

stmuk avatar stmuk commented on June 8, 2024

Not quite yet...

cc -lc -m32 -ggdb3 -O0 -Wno-multichar -fno-stack-protector -B. -Wl,-b,coff-i386 -no-pie  123.o dl_init.o main.o forceplt.o wrappers.o patch.o  -lncurses -o 123
./ld: 123.o: warning: the use of `tempnam' is dangerous, better use `mkstemp'
./ld: 123.o:time_comm.c:(.text+0xdf104): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
./ld: 123.o: warning: gtty is not implemented and will always fail
./ld: 123.o: warning: stty is not implemented and will always fail
./ld: 123.o:crt1.s:(.data+0x1f684): multiple definition of `sys_errlist'
./ld: 123.o:crt1.s:(.data+0x1f8c0): multiple definition of `sys_nerr'
./ld: forceplt.o: in function `__require_ref':
(.text+0xe7): undefined reference to `fstat'
./ld: (.text+0x204): undefined reference to `mknod'
./ld: (.text+0x353): undefined reference to `stat'
./ld: wrappers.o: in function `__unix_stat':
/home/steve/sandbox/123elf/wrappers.c:126: undefined reference to `stat'
./ld: wrappers.o: in function `__unix_fstat':
/home/steve/sandbox/123elf/wrappers.c:138: undefined reference to `fstat'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: 123] Error 1

from 123elf.

onoraba avatar onoraba commented on June 8, 2024

same here

cc -lc -m32 -ggdb3 -O0 -Wno-multichar -fno-stack-protector -B. -Wl,-b,coff-i386 -no-pie  123.o dl_init.o main.o forceplt.o wrappers.o patch.o  -lncurses -o 123
./ld: 123.o: warning: the use of `tempnam' is dangerous, better use `mkstemp'
./ld: 123.o:time_comm.c:(.text+0xdf104): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
./ld: 123.o: warning: gtty is not implemented and will always fail
./ld: 123.o: warning: stty is not implemented and will always fail
./ld: 123.o:crt1.s:(.data+0x1f684): multiple definition of `sys_errlist'
./ld: 123.o:crt1.s:(.data+0x1f8c0): multiple definition of `sys_nerr'
./ld: forceplt.o: in function `__require_ref':
(.text+0xe7): undefined reference to `fstat'
./ld: (.text+0x204): undefined reference to `mknod'
./ld: (.text+0x353): undefined reference to `stat'
./ld: wrappers.o: in function `__unix_stat':
/home/user/123/123elf/wrappers.c:126: undefined reference to `stat'
./ld: wrappers.o: in function `__unix_fstat':
/home/user/123/123elf/wrappers.c:138: undefined reference to `fstat'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: 123] Error 1

from 123elf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.