pmattes / x3270

Family of IBM 3270 emulators
47 stars 19 forks source link

c3270 build on Alpine linux (musl) #34

Closed mterron closed 2 years ago

mterron commented 2 years ago

Trying to build c3270 on Alpine fails on screen.c

builder@buildbox $ make
# REDACTED
make[2]: Entering directory '/home/builder/c3270/suite3270-4.1/obj/x86_64-unknown-linux-gnu/c3270'
gcc -Wall -Wsign-compare -std=c99 -pedantic -Wno-variadic-macros -MMD -MP  -I. -I../../../c3270 -I../../../Common/c3270 -I../../../Common -I../../../include -DLIBX3270DIR=\"/usr/local/etc/x3270\"  -D_POSIX_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE -g -O2   -c -o screen.o ../../../c3270/screen.c
../../../c3270/screen.c: In function 'kybd_input':
../../../c3270/screen.c:1626:2: error: unknown type name 'wint_t'; did you mean 'ino_t'?
 1626 |  wint_t wch;
      |  ^~~~~~
      |  ino_t
../../../c3270/screen.c:1635:6: warning: implicit declaration of function 'wget_wch'; did you mean 'wgetch'? [-Wimplicit-function-declaration]
 1635 |  k = wget_wch(stdscr, &wch);
      |      ^~~~~~~~
      |      wgetch

Adding #include <wchar.h> to c3270/screen.c (I presume glibc does some implicit include somewhere) builds with a couple of warnings:

builder@buildbox $ make
# REDACTED
gcc -Wno-format-truncation -Wall -Wsign-compare -std=c99 -pedantic -Wno-variadic-macros -MMD -MP  -I../../../lib/3270 -I../../../lib/3270/../include/unix -I../../../lib/3270/../include -I../../../include -DLIBX3270DIR=\"/usr/local/etc/x3270\"  -D_POSIX_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE -D_GNU_SOURCE -g -O2   -c -o childscript.o ../../../Common/childscript.c
In file included from ../../../Common/childscript.c:39:
/usr/include/sys/signal.h:1:2: warning: #warning redirecting incorrect #include <sys/signal.h> to <signal.h> [-Wcpp]
    1 | #warning redirecting incorrect #include <sys/signal.h> to <signal.h>
      |  ^~~~~~~
# REDACTED
gcc -Wall -Wsign-compare -std=c99 -pedantic -Wno-variadic-macros -MMD -MP  -I. -I../../../c3270 -I../../../Common/c3270 -I../../../Common -I../../../include -DLIBX3270DIR=\"/usr/local/etc/x3270\"  -D_POSIX_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE -g -O2   -c -o screen.o ../../../c3270/screen.c
../../../c3270/screen.c: In function 'kybd_input':
../../../c3270/screen.c:1636:6: warning: implicit declaration of function 'wget_wch'; did you mean 'wgetch'? [-Wimplicit-function-declaration]
 1636 |  k = wget_wch(stdscr, &wch);
      |      ^~~~~~~~
      |      wgetch
# REDACTED
make[2]: Leaving directory '/home/builder/c3270/suite3270-4.1/obj/x86_64-unknown-linux-gnu/c3270'
make[1]: Leaving directory '/home/builder/c3270/suite3270-4.1/c3270'

builder@buildbox $ ./obj/x86_64-unknown-linux-gnu/c3270/c3270 --help
Usage: c3270 [options] [[prefix:][LUname@]hostname[:port]]
       c3270 [options] [<session-file>].c3270
Options:
  -?
     Display command-line help
  -accepthostname [DNS:]<name>
     Host name to accept from server certificate
  -alias <name>
     Define application alias for -xrm and session file suffix
  -allbold
     Display all text in bold
  -altscreen <string>
     String to switch terminal from 80-column mode to 132-column mode
  -cadir <directory>
     TLS CA certificate database directory
  -cafile <filename>
     TLS CA certificate file
  -cbreak
     Force terminal CBREAK mode
  -certfile <filename>
     TLS client certificate file
  -certfiletype pem|asn1
     TLS client certificate file type
  -chainfile <filename>
     TLS certificate chain file
  -clear <toggle>
     Turn on <toggle>
  -codepage <name>
     Use host ECBDIC code page <name>
  -connecttimeout <seconds>
     Timeout for host connect requests
  -defaultfgbg
     Use terminal's default foreground and background colors
  -defscreen <string>
     String to switch terminal from 132-column mode to 80-column mode
  -devname <name>
     Device name (workstation ID) for RFC 4777
  -e <command> [<arg>...]
     Run <command> instead of making TELNET connection
  --help
     Display command-line help
  -hostsfile <filename>
     Use <hostname> as the ibm_hosts file
  -httpd [<addr>:]<port>
     TCP port to listen on for http requests
  -keyfile <filename>
     Get TLS private key from <filename>
  -keyfiletype pem|asn1
     TLS private key file type
  -keymap <name>[,<name>...]
     Keyboard map name(s)
  -keypasswd file:<filename>|string:<text>
     TLS private key password
  -minversion <version>
     Fail unless at this version or greater
  -model [327{8,9}-]<n>
     Emulate a 3278 or 3279 model <n>
  -mono
     Do not use terminal color capabilities
  -noprompt
     Alias for -secure
  -noverifycert
     Disable TLS host certificate validation
  -nvt
     Begin in NVT mode
  -oversize <cols>x<rows>
     Larger screen dimensions
  -port <port>
     Default TELNET port
  -printerlu <luname>
     Automatically start a pr3287 printer session to <luname>
  -proxy <type>:<host>[:<port>]
     Proxy type and server
  -reconnect
     Reconnect to host as soon as it disconnects
  -rv
     Switch to black-on-white mode
  -scriptport [<addr>:]<port>
     TCP port to listen on for script commands
  -scriptportonce
     Accept one script connection, then exit
  -secure
     Restrict potentially-destructive user actions
  -set <toggle>
     Turn on <toggle>
  -sl <lines>
     Number of lines to save for scrolling
  -socket
     Create socket for script control
  -tn <name>
     Send <name> as TELNET terminal name
  -trace
     Enable tracing
  -tracefile <file>
     Write traces to <file>
  -tracefilesize <n>[KM]
     Limit trace file to <n> bytes
  -user <name>
     User name for RFC 4777
  -utf8
     Force local codeset to be UTF-8
  -v
     Display build options and character sets
  -verifycert
     Enable TLS host certificate validation (set by default)
  --version
     Display build options and character sets
  -xrm 'c3270.<resource>: <value>'
     Set <resource> to <value>
  --
     Terminate argument list
pmattes commented 2 years ago

I will get this fixed ASAP.

pmattes commented 2 years ago

Code is fixed in 4.2 (master).

It was fun playing with Alpine -- nice lightweight distro.