Author Topic: building openssh  (Read 5829 times)

Edmund Wong

  • Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
    • View Profile
building openssh
« on: December 21, 2022, 09:19:57 am »
I took some pointers from the stickied "Newbie guide to porting software?" thread and am trying to build openssh (straight from the openssh project).

This is my os2_env.txt:

export CFLAGS="-O2 -g -march=pentium4 -mtune=generic"
export CXXFLAGS="-O2 -g -march=pentium4 -mtune=generic"
export CC=gcc
export CXX=g++
export CPP=cpp
export CXXCPP=cpp
export LD=wl
export AR=emxomfld
export exeext=.exe
export SH=c:/USR/BIN/SH.EXE
export SHELL=c:/usr/bin/sh.exe
export CONFIG_SHELL=/@unixroot/usr/bin/sh
export POSIX_SHELL=c:/usr/bin/sh.exe
export PREFERABLY_POSIX_SHELL=c:/usr/bin/sh.exe

I installed gawk, autoconf, make automake packages
Then I did the following:

1) opened Command Window
2) ran "sh.exe"
3) cd openssh
4) autoconf
5) sh ./configure

It ran configure for a bit then choked at the following:

checking for sh... (cached) /@unixroot/usr/bin/bash.exe
checking for bash... c:/USR/BIN/SH.EXE
checking for ksh... (cached) c:/USR/BIN/SH.EXE
checking for sh... (cached) c:/USR/BIN/SH.EXE
checking for groff... /@unixroot/usr/bin/groff.exe
checking for nroff... /@unixroot/usr/bin/nroff
checking for mandoc... no
checking for pkg-config... /@unixroot/usr/bin/pkg-config.exe
checking for groupadd... groupadd
checking for useradd... useradd
checking for pkgmk... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for passwd... no
checking for inline... inline
checking whether LLONG_MAX is declared... yes
checking whether LONG_LONG_MAX is declared... yes
checking whether SYSTR_POLICY_KILL is declared... no
checking whether RLIMIT_NPROC is declared... yes
checking whether PR_SET_NO_NEW_PRIVS is declared... no
checking whether OpenSSL will be used for cryptography... yes
checking if gcc supports -Werror... yes
./configure: 5763: ./configure: Syntax error: word unexpected (expecting ")")


In configure:5763, I have:
   OSSH_CHECK_CFLAG_COMPILE(-pipe)
   OSSH_CHECK_CFLAG_COMPILE(-Wunknown-warning-option)
   OSSH_CHECK_CFLAG_COMPILE(-Wno-error=format-truncation)
   OSSH_CHECK_CFLAG_COMPILE(-Qunused-arguments)


(I am assuming that it's talking about this line.   It's been some time since I've looked at a configure script.

I do know about the bitwise openssh-os2 repo and I did clone off that; but the configuration breaks off
at the same place.

Any help appreciated.

Edmund
2) autoconf

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5095
  • Karma: +117/-1
    • View Profile
Re: building openssh
« Reply #1 on: December 21, 2022, 04:36:13 pm »
Use this as a os2_env.sh
Code: [Select]
export 'LDFLAGS=-Zomf -Zmap -Zbin-files -Zhigh-mem'
export 'LIBS=-lcx'
Hopefully I got the quoting right, I usually just add them to the configure line. You can use your CFLAGS and CXXFLAGS, the rest should not be needed or already set in config.sys assuming yo rebooted after installing all the development stuff, GCC, libc-devel, libcx-devel, gcc-wlink, gcc-wrc, kbuild-make, (maybe kbuild), os2-base, os2-base-fhs, os2-base-unixtools-path and might as well install the toolkit, os2tk*
libcx is a libc extensions library, contains mmap(), getaddressinfo() and friends.
Make sure you reboot after installing all that to update things like the PATH, need to find *nix versions of some programs first.
You might want to download the source RPM and look at what configure arguments were passed.
Source RPMs are here, http://rpm.netlabs.org/release/00/i386/SRPMS/ with exp where you'd expect.
Problem is that libc is missing a bunch of terminal stuff making things hard.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5095
  • Karma: +117/-1
    • View Profile
Re: building openssh
« Reply #2 on: December 21, 2022, 05:00:07 pm »
About the flags,
-Zmap produces a map file for debugging purposes, optional.
-Zbin-files tries to open all files, pipes etc in binary mode. Really the source should be modified to open everything in binary mode otherwise get the LF to CRLF conversion.
-Zhigh-mem tries to put the heap in memory above the 1GB barrier. OS/2 defaults to only 1GB of address space for 16 bit compatibility, with half of that given to the kernel. Lower shared memory in particular is a scarce resource as DLLs take a good portion so use the upper couple of GB of address space when possible.
-Zomf, our GCC was forked over 20 years back. It, or rather AS, outputs aout object files. It is possible to create binaries etc with the aout object files and our ancient LD but usually the aout object files are converted into native OMF by the toolchain using emxomf and then linking with the system linker, currently Open Watcom's wlink. Sometimes need 'LD=emxomfld"
It is possible to also use -Zomf in CFLAGS, then you do need the AR=emxomfar and ranlib=echo for static libs. Traditionally, aout object files end in .o and OMF end in .obj.
I'm sure there is more I'm forgetting.