KallistiOS / kos-ports

Ported library collection for KallistiOS
Other
47 stars 31 forks source link

Error Building libjimtcl on Windows #42

Open gyrovorbis opened 6 months ago

gyrovorbis commented 6 months ago

Filing this for tracking the known issue of libjimtcl failing to build properly under Windows. I get the following error using DreamSDK:

Installing the KallistiOS Port...
libjimtcl is not currently installed.
Finished processing dependencies for libjimtcl.
Fetching libjimtcl from https://github.com/msteveb/jimtcl.git ...
Cloning into 'libjimtcl-1.0.0'...
Copying SCM checkout of libjimtcl ...
Copying KOS files...
make[1]: Entering directory `/usr/opt/toolchains/dc/kos-ports/libjimtcl/build/libjimtcl-1.0.0'
CC=kos-cc  ./configure --prefix=/opt/toolchains/dc/kos/../kos-ports/libjimtcl/inst --host=sh-elf --without-ext="aio,zlib" ; \
        make libjim.a 
No installed jimsh or tclsh, building local bootstrap jimsh0
No working C compiler found. Tried cc and gcc.
make[2]: Entering directory `/usr/opt/toolchains/dc/kos-ports/libjimtcl/build/libjimtcl-1.0.0'
make[2]: *** No rule to make target `libjim.a'.  Stop.
make[2]: Leaving directory `/usr/opt/toolchains/dc/kos-ports/libjimtcl/build/libjimtcl-1.0.0'
make[1]: *** [build-libjim] Error 2
make[1]: Leaving directory `/usr/opt/toolchains/dc/kos-ports/libjimtcl/build/libjimtcl-1.0.0'
make: *** [build-stamp] Error 2
Cleaning up build directories ...
Cleaning up dist files ...
*** Operation done with errors.

NOTE: This appears to be a general issue with libjimtcl itself not wanting to build properly under MSYS with Windows. IIRC someone mentioned that support for this was desirable upstream. Perhaps there's a little compiler-specific issue going on here which would be trivial to fix?

sizious commented 6 months ago

I guess by DreamShell you mean DreamSDK?

gyrovorbis commented 6 months ago

I guess by DreamShell you mean DreamSDK?

UGHGHGGH. Yes, of course. Sorry. Edited!

gyrovorbis commented 6 months ago

This one's going to take some work... Just got a little while to look at it, and made some progress at least...

jimtcl/autosetup/autosetup-find-tclsh line #12 seems to be the offender for not detecting the compiler properly... I think the executable name is not in the format that was expected?

I couldn't figure out a graceful way to work past it, so I just sledge-hammered it temporarily and hardcoded the compiler path there...

Unfortunately I was immediately met with a slew of other errors for missing header files which look to be Linux-related. Not positive whether they're on MSYS or not, or whether the configuration script is simply not choosing the Windows build path...

Weirdly enough, I tried under cygwin, and everything worked immediately.... I also saw something online mentioning to use the mingw64 terminal, not the MSYS terminal when using the configure scripts? Not sure whether we have an option there, or where the DreamSDK terminal comes from, but thought I'd mention that too.

gyrovorbis commented 6 months ago

Since I'm currently stumped, I opened an issue here asking for advice: https://github.com/msteveb/jimtcl/issues/287. Will keep you guys posted.

sizious commented 6 months ago

OK, removing the highlighted part (Line 12) will show us the real messages. image

This gives us:

$ CC=kos-cc  ./configure --prefix=/opt/toolchains/dc/kos/../kos-ports/libjimtcl/inst --host=sh-elf --without-ext="aio,z
lib"
No installed jimsh or tclsh, building local bootstrap jimsh0
./autosetup/jimsh0.c: In function 'stdio_reader':
./autosetup/jimsh0.c:2146:13: error: 'ETIMEDOUT' undeclared (first use in this function); did you mean 'WSAETIMEDOUT'?
 2146 |     errno = ETIMEDOUT;
      |             ^~~~~~~~~
      |             WSAETIMEDOUT
./autosetup/jimsh0.c:2146:13: note: each undeclared identifier is reported only once for each function it appears in
./autosetup/jimsh0.c: In function 'stdio_error':
./autosetup/jimsh0.c:2159:14: error: 'ETIMEDOUT' undeclared (first use in this function); did you mean 'WSAETIMEDOUT'?
 2159 |         case ETIMEDOUT:
      |              ^~~~~~~~~
      |              WSAETIMEDOUT
./autosetup/jimsh0.c: In function 'clock_cmd_seconds':
./autosetup/jimsh0.c:6366:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6366 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_REALTIME) / 1000000);
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:698:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  698 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'clock_cmd_clicks':
./autosetup/jimsh0.c:6372:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6372 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW));
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:698:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  698 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'clock_cmd_micros':
./autosetup/jimsh0.c:6378:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6378 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_REALTIME));
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:698:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  698 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'clock_cmd_millis':
./autosetup/jimsh0.c:6384:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6384 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_REALTIME) / 1000);
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:698:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  698 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: At top level:
./autosetup/jimsh0.c:6665:10: fatal error: sys/wait.h: No such file or directory
 6665 | #include <sys/wait.h>
      |          ^~~~~~~~~~~~
compilation terminated.
./autosetup/jimsh0.c: In function 'stdio_reader':
./autosetup/jimsh0.c:2146:13: error: 'ETIMEDOUT' undeclared (first use in this function); did you mean 'WSAETIMEDOUT'?
 2146 |     errno = ETIMEDOUT;
      |             ^~~~~~~~~
      |             WSAETIMEDOUT
./autosetup/jimsh0.c:2146:13: note: each undeclared identifier is reported only once for each function it appears in
./autosetup/jimsh0.c: In function 'stdio_error':
./autosetup/jimsh0.c:2159:14: error: 'ETIMEDOUT' undeclared (first use in this function); did you mean 'WSAETIMEDOUT'?
 2159 |         case ETIMEDOUT:
      |              ^~~~~~~~~
      |              WSAETIMEDOUT
./autosetup/jimsh0.c: In function 'clock_cmd_seconds':
./autosetup/jimsh0.c:6366:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6366 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_REALTIME) / 1000000);
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:698:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  698 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'clock_cmd_clicks':
./autosetup/jimsh0.c:6372:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6372 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW));
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:698:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  698 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'clock_cmd_micros':
./autosetup/jimsh0.c:6378:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6378 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_REALTIME));
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:698:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  698 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'clock_cmd_millis':
./autosetup/jimsh0.c:6384:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6384 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_REALTIME) / 1000);
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:698:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  698 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: At top level:
./autosetup/jimsh0.c:6665:10: fatal error: sys/wait.h: No such file or directory
 6665 | #include <sys/wait.h>
      |          ^~~~~~~~~~~~
compilation terminated.
No working C compiler found. Tried cc and gcc.

As you can see, a lot of things needs to be fixed.

gyrovorbis commented 6 months ago

Huh, that's very strange... now that you got further, I'll see if I can take a look at it...

I have a feeling the clock errors are just missing casts... Then surely there's a MSYS way to do wait(), I'm guessing?

gyrovorbis commented 6 months ago

Okay, I just spent some more time looking at this. Pretty sure these will be easy fixes... I just followed up on my ticket though, to ensure that modifying this file directly is the way to go (in case it's autogenerated): https://github.com/msteveb/jimtcl/issues/287. Going to wait for a response before I dive in.

maishuji commented 2 weeks ago

Seems the lib si not compiling with linux either with latest kos, I have got this output logs :

make[2]: Entering directory Cloning into 'libjimtcl-1.0.0'... Copying SCM checkout of libjimtcl ... Copying KOS files... make[1]: Entering directory '/opt/toolchains/dc/kos-ports/libjimtcl/build/libjimtcl-1.0.0' CC=kos-cc ./configure --prefix=/opt/toolchains/dc/kos/../kos-ports/libjimtcl/inst --host=sh-elf --without-ext="aio,zlib" ; \ make libjim.a No installed jimsh or tclsh, building local bootstrap jimsh0 Host System...sh-unknown-elf Build System...x86_64-pc-linux-musl C compiler... kos-cc
C++ compiler... sh-elf-c++
Build C compiler...cc Checking for stdlib.h...ok Checking for restrict...ok Checking for long long...ok Checking for sizeof int...4 Checking whether the C compiler accepts -fno-unwind-tables...yes Checking whether the C compiler accepts -fno-asynchronous-unwind-tables...yes Checking for time.h...ok Checking for sys/time.h...ok Checking for sys/socket.h...ok Checking for netinet/in.h...ok Checking for arpa/inet.h...ok Checking for netdb.h...ok Checking for strings.h...ok Checking for util.h...not found Checking for pty.h...not found Checking for sys/un.h...not found Checking for dlfcn.h...not found Checking for unistd.h...ok Checking for dirent.h...ok Checking for crt_externs.h...not found Checking for execinfo.h...not found Checking for sizeof time_t...8 Checking libs for inet_ntop...none needed Checking libs for socket...none needed Checking for ualarm...not found Checking for fork...ok Checking for system...ok Checking for select...ok Checking for execvpe...not found Checking for geteuid...not found Checking for mkstemp...ok Checking for isatty...ok Checking for regcomp...not found Checking for waitpid...not found Checking for sigaction...not found Checking for sys_signame...not found Checking for sys_siglist...not found Checking for isascii...ok Checking for syslog...not found Checking for opendir...ok Checking for readlink...ok Checking for sleep...ok Checking for usleep...ok Checking for pipe...ok Checking for getaddrinfo...ok Checking for utimes...not found Checking for shutdown...ok Checking for socketpair...not found Checking for link...ok Checking for symlink...ok Checking for fsync...not found Checking for dup...ok Checking for umask...not found Checking for localtime...ok Checking for gmtime...ok Checking for strptime...ok Checking for realpath...ok Checking for isinf...ok Checking for isnan...ok Checking for vfork...not found Checking libs for backtrace...no Checking for sysinfo...not found Checking for struct stat.st_mtimespec...not found Checking for struct stat.st_mtim...ok Checking for struct flock...ok Checking for sys/types.h...(cached) ok Checking if -D_FILE_OFFSET_BITS=64 is needed...none Checking for fstat...ok Checking for lstat...ok Checking for make...ok Checking for asciidoc...no Checking for sed...ok Checking for _NSGetEnviron...not found Checking environ declared in unistd.h...yes Checking for sys/types.h...(cached) ok Checking for sys/stat.h...(cached) ok Checking for mkdir with one arg...no Checking for S_IXUSR...ok Checking for S_IRWXG...ok Checking for S_IRWXO...ok Enabling UTF-8 Checking libs for sin...none needed Enabling math functions Enabling IPv6 Checking for pkg-config...2.1.0 Found compiler sysroot Checking for openssl ...not found Checking for libssl ...not found Checking for openssl/ssl.h...not found Checking libs for TLS_method...no Checking for termios.h...ok Enabling line editing Checking for inline support...yes Enabling references Building static library Extension aio...disabled Extension array...enabled Extension pack...enabled Extension binary...enabled Extension clock...enabled Extension ensemble...enabled Extension eventloop...enabled Extension exec...enabled Extension file...enabled Extension readdir...enabled Extension glob...enabled Extension history...enabled Extension interp...enabled Extension jsonencode...enabled Extension json...enabled Checking libs for dlopen...no Extension load...disabled (dependencies) Extension nshelper...enabled Extension namespace...enabled Extension oo...enabled Extension package...enabled Extension posix...disabled (dependencies) Extension regexp...enabled Extension signal...disabled (dependencies) Extension stdlib...enabled Extension syslog...disabled (dependencies) Extension tclcompat...enabled Extension tclprefix...enabled Extension tree...enabled Extension zlib...disabled Checking for clock_gettime...ok Checking for posix_openpt...not found Using built-in regexp Jim static extensions: array binary clock ensemble eventloop exec file glob history interp json jsonencode namespace nshelper oo pack package readdir regexp stdlib tclcompat tclprefix tree Created jim-config.h Created jimautoconf.h Created Makefile from Makefile.in Created tests/Makefile from tests/Makefile.in Created examples.api/Makefile from examples.api/Makefile.in Created build-jim-ext from build-jim-ext.in Created jimtcl.pc from jimtcl.pc.in '/opt/toolchains/dc/kos-ports/libjimtcl/build/libjimtcl-1.0.0' MKLDEXT _load-static-exts.c CC _load-static-exts.o CC jim-subcmd.o CC jim-interactive.o CC jim-format.o CC jim.o jim.c: In function 'Jim_LoopCoreCommand': jim.c:12585:16: warning: 'limit' may be used uninitialized [-Wmaybe-uninitialized] 12585 | while (((i < limit && incr > 0) || (i > limit && incr < 0)) && retval == JIM_OK) { | ^~~~~ jim.c:12558:14: note: 'limit' declared here 12558 | jim_wide limit; | ^~~~~ jim.c:12585:16: warning: 'limit' may be used uninitialized [-Wmaybe-uninitialized] 12585 | while (((i < limit && incr > 0) || (i > limit && incr < 0)) && retval == JIM_OK) { | ^~~~~ jim.c:12558:14: note: 'limit' declared here 12558 | jim_wide limit; | ^~~~~ UNIDATA _unicode_mapping.c CC utf8.o CC jimregexp.o CC jimiocompat.o CC linenoise.o linenoise.c: In function 'enableRawMode': linenoise.c:714:22: error: 'BRKINT' undeclared (first use in this function) 714 | raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); | ^~ linenoise.c:714:22: note: each undeclared identifier is reported only once for each function it appears in linenoise.c:714:31: error: 'ICRNL' undeclared (first use in this function) 714 | raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); | ^~~~~ linenoise.c:714:39: error: 'INPCK' undeclared (first use in this function) 714 | raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); | ^~~~~ linenoise.c:714:47: error: 'ISTRIP' undeclared (first use in this function) 714 | raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); | ^~ linenoise.c:714:56: error: 'IXON' undeclared (first use in this function) 714 | raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); | ^~~~ linenoise.c:718:21: error: 'CS8' undeclared (first use in this function) 718 | raw.c_cflag |= (CS8); | ^~~ linenoise.c:721:22: error: 'ECHO' undeclared (first use in this function) 721 | raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); | ^~~~ linenoise.c:721:29: error: 'ICANON' undeclared (first use in this function) 721 | raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); | ^~ linenoise.c:721:38: error: 'IEXTEN' undeclared (first use in this function) 721 | raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); | ^~ linenoise.c:721:47: error: 'ISIG' undeclared (first use in this function); did you mean 'NSIG'? 721 | raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); | ^~~~ | NSIG linenoise.c:724:14: error: 'VMIN' undeclared (first use in this function) 724 | raw.c_cc[VMIN] = 1; raw.c_cc[VTIME] = 0; / 1 byte, no timer / | ^~~~ linenoise.c:724:34: error: 'VTIME' undeclared (first use in this function); did you mean 'ETIME'? 724 | raw.c_cc[VMIN] = 1; raw.c_cc[VTIME] = 0; / 1 byte, no timer / | ^~~~~ | ETIME linenoise.c:727:9: error: implicit declaration of function 'tcsetattr'; did you mean 'tcgetattr'? [-Wimplicit-function-declaration] 727 | if (tcsetattr(current->fd,TCSADRAIN,&raw) < 0) { | ^~~~~ | tcgetattr linenoise.c:727:31: error: 'TCSADRAIN' undeclared (first use in this function) 727 | if (tcsetattr(current->fd,TCSADRAIN,&raw) < 0) { | ^~~~~ linenoise.c: In function 'disableRawMode': linenoise.c:736:42: error: 'TCSADRAIN' undeclared (first use in this function) 736 | if (rawmode && tcsetattr(current->fd,TCSADRAIN,&orig_termios) != -1) | ^~~~~ linenoise.c: In function 'linenoiseAtExit': linenoise.c:743:33: error: 'TCSADRAIN' undeclared (first use in this function) 743 | tcsetattr(STDIN_FILENO, TCSADRAIN, &orig_termios); | ^~~~~ linenoise.c: In function 'getWindowSize': linenoise.c:933:20: error: storage size of 'ws' isn't known 933 | struct winsize ws; | ^~ linenoise.c:935:30: error: 'TIOCGWINSZ' undeclared (first use in this function) 935 | if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == 0 && ws.ws_col != 0) { | ^~~~~~ linenoise.c:933:20: warning: unused variable 'ws' [-Wunused-variable] 933 | struct winsize ws; | ^~ make[2]: [Makefile:64: linenoise.o] Error 1 make[2]: Leaving directory '/opt/toolchains/dc/kos-ports/libjimtcl/build/libjimtcl-1.0.0' make[1]: [KOSMakefile.mk:11: build-libjim] Error 2 make[1]: Leaving directory '/opt/toolchains/dc/kos-ports/libjimtcl/build/libjimtcl-1.0.0' make: *** [/opt/toolchains/dc/kos/../kos-ports/scripts/build.mk:35: build-stamp] Error 2