Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling oksh against netbsd-curses #68

Open
tuxliban opened this issue May 12, 2022 · 3 comments
Open

Compiling oksh against netbsd-curses #68

tuxliban opened this issue May 12, 2022 · 3 comments

Comments

@tuxliban
Copy link

I am trying to compile oksh by replacing ncurses with netbsd-curses, however, during the configuration process it does not detect the curses library even though it's correctly installed in /usr/lib and /usr/include.
The configuration arguments I use are --enable-curses --enable-ksh --enable-static

~/void-packages שׂ master
-> $ ./xbps-src -f pkg -C oksh
=> oksh-7.1_2: cleaning build directory...
=> oksh: removing files from destdir...
=> xbps-src: updating repositories for host (x86_64-musl)...
[*] Updating repository `https://alpha.de.repo.voidlinux.org/current/musl/x86_64-musl-repodata' ...
[*] Updating repository `https://alpha.de.repo.voidlinux.org/current/musl/nonfree/x86_64-musl-repodata' ...
[*] Updating repository `https://alpha.de.repo.voidlinux.org/current/musl/debug/x86_64-musl-repodata' ...
=> xbps-src: updating software in / masterdir...
=> xbps-src: cleaning up / masterdir...
=> oksh-7.1_2: building [gnu-configure] for x86_64-musl...
   [host] pkgconf-1.8.0_1: found (https://alpha.de.repo.voidlinux.org/current/musl)
   [target] netbsd-curses-devel-0.3.2_1: found (/host/binpkgs)
=> oksh-7.1_2: installing host dependencies: pkgconf-1.8.0_1 ...
=> oksh-7.1_2: installing target dependencies: netbsd-curses-devel-0.3.2_1 ...
=> oksh-7.1_2: running do-fetch hook: 00-distfiles ...
=> oksh-7.1_2: running do-extract hook: 00-distfiles ...
=> oksh-7.1_2: extracting distfile(s), please wait...
=> oksh-7.1_2: running do-patch hook: 00-patches ...
=> oksh-7.1_2: patching: cross.patch.
=> oksh-7.1_2: running pre-configure hook: 00-gnu-configure-asneeded ...
=> oksh-7.1_2: running pre-configure hook: 01-override-config ...
=> oksh-7.1_2: running pre-configure hook: 02-script-wrapper ...
=> oksh-7.1_2: running do_configure ...
checking for C compiler... cc
checking if the compiler can compile C99 without -std=c99... yes
checking for -w compiler flag... yes
checking for OS... Linux
checking for -flto compiler flag... not enabled
checking for __dead... no
checking for __dead2... no
checking for __attribute__((__noreturn__))... yes
checking for asprintf... yes
checking for clock_gettime in libc... yes
checking for confstr... yes
checking for curses library... not found
oksh will be built without screen clearing support
checking for issetugid... yes
checking for pledge... no
checking for reallocarray... yes
checking for setresgid... yes
checking for setresuid... yes
checking for sig_t... yes
checking for srand_deterministic... no
checking for st_mtim... yes
checking for st_mtimespec... no
checking for stravis... no
checking for strlcat... yes
checking for strlcpy... yes
checking for strtonum... no
checking for strunvis... no
checking for sys_siglist... no
checking for sys_signame... no
checking for timeradd... yes
checking for timerclear... yes
checking for timersub... yes
checking for out-of-tree build... no
creating Makefile... done
=> oksh-7.1_2: running pre-build hook: 02-script-wrapper ...
=> oksh-7.1_2: running do_build ...
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o alloc.o alloc.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o asprintf.o asprintf.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o c_ksh.o c_ksh.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o c_sh.o c_sh.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o c_test.o c_test.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o c_ulimit.o c_ulimit.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o edit.o edit.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o emacs.o emacs.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o eval.o eval.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o exec.o exec.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o expr.o expr.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o history.o history.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o io.o io.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o jobs.o jobs.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o lex.o lex.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o mail.o mail.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o main.o main.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o misc.o misc.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o path.o path.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o shf.o shf.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o syn.o syn.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o table.o table.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o trap.o trap.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o tree.o tree.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o tty.o tty.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o var.o var.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o version.o version.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o vi.o vi.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o confstr.o confstr.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o reallocarray.o reallocarray.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o siglist.o siglist.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o signame.o signame.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o strlcat.o strlcat.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o strlcpy.o strlcpy.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o strtonum.o strtonum.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o unvis.o unvis.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o vis.o vis.c
cc -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -fdebug-prefix-map=/builddir/oksh-7.1=. -DEMACS -DVI -w -D_GNU_SOURCE      -c -o issetugid.o issetugid.c
cc -Wl,-z,relro -Wl,-z,now -Wl,--as-needed  -march=native -O2 -pipe   -static -o ksh alloc.o asprintf.o c_ksh.o c_sh.o c_test.o c_ulimit.o edit.o emacs.o eval.o exec.o expr.o history.o io.o jobs.o lex.o mail.o main.o misc.o path.o shf.o syn.o table.o trap.o tree.o tty.o var.o version.o vi.o confstr.o reallocarray.o siglist.o signame.o strlcat.o strlcpy.o strtonum.o unvis.o vis.o issetugid.o  
=> oksh-7.1_2: skipping check (XBPS_CHECK_PKGS is disabled) ...
=> oksh-7.1_2: running pre-install hook: 00-libdir ...
=> oksh-7.1_2: running pre-install hook: 02-script-wrapper ...
=> oksh-7.1_2: running pre-install hook: 98-fixup-gir-path ...
=> oksh-7.1_2: running do_install ...
install -d /destdir//oksh-7.1/usr/bin
install -d /destdir//oksh-7.1/usr/share/man/man1
install -c -s -m 755 ksh /destdir//oksh-7.1/usr/bin
install-wrapper: overriding call to strip(1).
install -c -m 644 ksh.1 /destdir//oksh-7.1/usr/share/man/man1
Please add /usr/bin/ksh to /etc/shells
=> oksh-7.1_2: running post-install hook: 00-compress-info-files ...
=> oksh-7.1_2: running post-install hook: 00-fixup-gir-path ...
=> oksh-7.1_2: running post-install hook: 00-libdir ...
=> oksh-7.1_2: running post-install hook: 00-uncompress-manpages ...
=> oksh-7.1_2: running post-install hook: 01-remove-misc ...
=> oksh-7.1_2: running post-install hook: 02-remove-libtool-archives ...
=> oksh-7.1_2: running post-install hook: 02-remove-perl-files ...
=> oksh-7.1_2: running post-install hook: 02-remove-python-bytecode-files ...
=> oksh-7.1_2: running post-install hook: 03-remove-empty-dirs ...
=> WARNING: oksh-7.1_2: removed empty dir: /usr/lib
=> oksh-7.1_2: running post-install hook: 04-create-xbps-metadata-scripts ...
   Added trigger 'register-shell' for the 'INSTALL' script.
   Added trigger 'register-shell' for the 'REMOVE' script.
=> oksh-7.1_2: running post-install hook: 05-generate-gitrevs ...
=> oksh-7.1_2: running post-install hook: 06-strip-and-debug-pkgs ...
   Stripped static executable: /usr/bin/ksh
=> oksh-7.1_2: running post-install hook: 10-pkglint-devel-paths ...
=> oksh-7.1_2: running post-install hook: 11-pkglint-elf-in-usrshare ...
=> oksh-7.1_2: running post-install hook: 12-rename-python3-c-bindings ...
=> oksh-7.1_2: running post-install hook: 13-pkg-config-clean-xbps-cross-base-ref ...
=> oksh-7.1_2: running post-install hook: 14-fix-permissions ...
=> oksh-7.1_2: running post-install hook: 99-pkglint-warn-cross-cruft ...
=> oksh-7.1_2: running pre-pkg hook: 03-rewrite-python-shebang ...
=> oksh-7.1_2: running pre-pkg hook: 04-generate-runtime-deps ...
=> oksh-7.1_2: running pre-pkg hook: 05-prepare-32bit ...
=> oksh-7.1_2: running pre-pkg hook: 06-shlib-provides ...
=> oksh-7.1_2: running pre-pkg hook: 90-set-timestamps ...
=> oksh-7.1_2: setting mtimes to Mon May  9 21:47:24 UTC 2022
=> oksh-7.1_2: running pre-pkg hook: 99-pkglint-subpkgs ...
=> oksh-7.1_2: running pre-pkg hook: 99-pkglint ...
=> oksh-7.1_2: running pre-pkg hook: 999-collected-rdeps ...
=> oksh-7.1_2: running do-pkg hook: 00-gen-pkg ...
=> Creating oksh-7.1_2.x86_64-musl.xbps for repository /host/binpkgs ...
=> oksh-7.1_2: running post-pkg hook: 00-register-pkg ...
=> Registering new packages to /host/binpkgs
index: added `oksh-7.1_2' (x86_64-musl).
index: 183 packages registered.

Doing a search in the chroot jail it can be corroborated that the libraries are indeed available:

~/void-packages שׂ master
-> $ find masterdir/usr/include -name term.h -o -name *curses*
masterdir/usr/include/term.h
masterdir/usr/include/curses.h
masterdir/usr/include/ncurses.h
~/void-packages שׂ master
-> $ find masterdir/usr/lib -name *curses.a   
masterdir/usr/lib/libncurses.a
masterdir/usr/lib/libcurses.a

Is there any way for the configuration script to detect netbsd-curses?

@ibara
Copy link
Owner

ibara commented May 12, 2022

The intention of the configure script is to support this exact scenario.
I am not a void linux user. Could you tell me how to replicate your environment so I can get this fixed?

@tuxliban
Copy link
Author

tuxliban commented May 12, 2022

Could you tell me how to replicate your environment so I can get this fixed?

Using xbps-src in a foreign Linux distribution
xbps-src can be used in any recent Linux distribution matching the CPU architecture.

To use xbps-src in your Linux distribution use the following instructions. Let's start downloading the xbps static binaries:

$ wget http://alpha.de.repo.voidlinux.org/static/xbps-static-latest.<arch>-musl.tar.xz
$ mkdir ~/XBPS
$ tar xvf xbps-static-latest.<arch>-musl.tar.xz -C ~/XBPS
$ export PATH=~/XBPS/usr/bin:$PATH

If xbps-uunshare does not work because of lack of user_namespaces(7) support, try other chroot methods.

Clone the void-packages git repository:

$ git clone https://github.com/void-linux/void-packages.git --depth=1

and xbps-src should be fully functional; just start the bootstrap process, i.e:

$ ./xbps-src binary-bootstrap

The default masterdir is created in the current working directory, i.e void-packages/masterdir.

Now you have to create the netbsd-curses package, for this you have to download the template and place it in /path/void-packages/netbsd-curses/ and then create a symbolic link from netbsd-curses to netbsd-curses-devel inside the srcpkgs directory.

Proceed to build the package:

./xbps-src pkg netbsd-curses

Now build the oksh package with the following custom template replacing the original template distributed by Void Linux.

Build the oksh package:

./xbps-src pkg -C oksh

The -C argument is used so that after the package build the build directory, dependencies and the fake root directory are not removed.

Up to this point, using the binary and wanting to clean the screen doesn't work because the netbsd-curses libraries aren't detected in the configuration process.

I hope I made myself clear as my native language isn't English.

Thank you very much for your interest in trying to find a solution to my issue.

@ibara
Copy link
Owner

ibara commented May 12, 2022

I should have been more clear. I am not a Linux user. I will use void linux to fix things, since it appears you are using void linux.

These instructions are helpful. I will try to fix this over the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants