Giter Site home page Giter Site logo

Comments (10)

msteveb avatar msteveb commented on June 3, 2024 2

Oh, I see. Need at least WinXP compatibility. I pushed a small change. With this, jimsh0.exe builds. However I still see a few issues:

  • Can't run the cc wrapper around gcc (something to do with backslashes and paths)
  • stdout isn't correctly initialised with line buffering

from jimtcl.

msteveb avatar msteveb commented on June 3, 2024 1

If this is a native compile, it expects cc or gcc to be available. If cross compile, use β€”host=mingw32

from jimtcl.

msteveb avatar msteveb commented on June 3, 2024 1

OK, that's promising. Because jimsh0.c has to build with no configuration step, it has to take a few shortcuts for autoconfiguration. Looks like we do need a few more checks for your platform. Note that jimsh0.c is build by build-make-bootstrap-jim so the changes should be made there or in the source files. Please try branch bootstrap-jimsh and let me know how it goes.

from jimtcl.

msteveb avatar msteveb commented on June 3, 2024 1

I'll get to it. I just have limited access to a Windows machine that can run the SDK so when I next get back to it I'll take a look at the outstanding issues. Should be this week.

from jimtcl.

The-Markitecht avatar The-Markitecht commented on June 3, 2024 1

See also my previous branch fixing MSYS2 on Jim 0.79, at TheMarkitecht@558f556

from jimtcl.

gyrovorbis avatar gyrovorbis commented on June 3, 2024

Hello!!! Thank you! We've made more progress with our MSYS host. It's actually trying to build now, but we get the following errors (after removing the output redirection in autosetup-find-tclsh to /dev/null):

$ 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>
      |          ^~~~~~~~~~~~

These all look like trivial things to solve by adding #ifdefs for __MSYS__. I'm happy to add the code to get it to compile properly there... I see a few casts that need to be added for the clock_t types, a missing header (that I believe isn't needed on MSYS), and a missing ERRNO define...

However, after looking at the comment at the top of jimsh0.c, and checking the documentation for the boostrap, I just wanted to make sure that this is, indeed, a file that should be modified directly and that it's not autogenerated from the other source files anywhere or anything like that?

For our purposes, it looks as though this is the only file that will need to be modified, since it's the only issue with our build... Our actual target is sh-elf-gcc which can build the full libjimtcl just fine.

from jimtcl.

gyrovorbis avatar gyrovorbis commented on June 3, 2024

OK, that's promising. Because jimsh0.c has to build with no configuration step, it has to take a few shortcuts for autoconfiguration. Looks like we do need a few more checks for your platform. Note that jimsh0.c is build by build-make-bootstrap-jim so the changes should be made there or in the source files. Please try branch bootstrap-jimsh and let me know how it goes.

We have progress! That fixed the ERRNO and wait() stuff. Now, unless I'm missing something, it's just complaining about a missing GetProcessId()? Down to one linker error!

gyrov@Windoez11VM /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,z
lib"
No installed jimsh or tclsh, building local bootstrap jimsh0
./autosetup/jimsh0.c: In function 'clock_cmd_seconds':
./autosetup/jimsh0.c:6363:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6363 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_REALTIME) / 1000000);
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:699:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  699 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'clock_cmd_clicks':
./autosetup/jimsh0.c:6369:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6369 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW));
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:699:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  699 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'clock_cmd_micros':
./autosetup/jimsh0.c:6375:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6375 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_REALTIME));
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:699:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  699 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'clock_cmd_millis':
./autosetup/jimsh0.c:6381:5: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
 6381 |     Jim_SetResultInt(interp, Jim_GetTimeUsec(CLOCK_REALTIME) / 1000);
      |     ^~~~~~~~~~~~~~~~
      |     |
      |     struct __clockid__ *
./autosetup/jimsh0.c:699:46: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
  699 | JIM_EXPORT jim_wide Jim_GetTimeUsec(unsigned type);
      |                                     ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'Jim_GetTimeUsec':
./autosetup/jimsh0.c:7330:9: warning: 'gettimeofday' is deprecated [-Wdeprecated-declarations]
 7330 |         gettimeofday(&tv, NULL);
      |         ^~~~~~~~~~~~
In file included from ./autosetup/jimsh0.c:6247:
c:\dreamsdk\include\sys\time.h:106:53: note: declared here
  106 | int __cdecl __MINGW_NOTHROW __POSIX_2008_DEPRECATED gettimeofday
      |                                                     ^~~~~~~~~~~~
./autosetup/jimsh0.c: In function 'Jim_CreateInterp':
./autosetup/jimsh0.c:11312:42: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
11312 |     i->lastCollectTime = Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW);
      |                                          ^~~~~~~~~~~~~~~~~~~
      |                                          |
      |                                          struct __clockid__ *
./autosetup/jimsh0.c:7316:35: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
 7316 | jim_wide Jim_GetTimeUsec(unsigned type)
      |                          ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'Jim_TimeCoreCommand':
./autosetup/jimsh0.c:19420:29: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
19420 |     start = Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW);
      |                             ^~~~~~~~~~~~~~~~~~~
      |                             |
      |                             struct __clockid__ *
./autosetup/jimsh0.c:7316:35: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
 7316 | jim_wide Jim_GetTimeUsec(unsigned type)
      |                          ~~~~~~~~~^~~~
./autosetup/jimsh0.c:19429:31: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
19429 |     elapsed = Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW) - start;
      |                               ^~~~~~~~~~~~~~~~~~~
      |                               |
      |                               struct __clockid__ *
./autosetup/jimsh0.c:7316:35: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
 7316 | jim_wide Jim_GetTimeUsec(unsigned type)
      |                          ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'Jim_TimeRateCoreCommand':
./autosetup/jimsh0.c:19465:29: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
19465 |     start = Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW);
      |                             ^~~~~~~~~~~~~~~~~~~
      |                             |
      |                             struct __clockid__ *
./autosetup/jimsh0.c:7316:35: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
 7316 | jim_wide Jim_GetTimeUsec(unsigned type)
      |                          ~~~~~~~~~^~~~
./autosetup/jimsh0.c:19469:33: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
19469 |         delta = Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW) - start;
      |                                 ^~~~~~~~~~~~~~~~~~~
      |                                 |
      |                                 struct __clockid__ *
./autosetup/jimsh0.c:7316:35: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
 7316 | jim_wide Jim_GetTimeUsec(unsigned type)
      |                          ~~~~~~~~~^~~~
./autosetup/jimsh0.c:19477:29: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
19477 |     start = Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW);
      |                             ^~~~~~~~~~~~~~~~~~~
      |                             |
      |                             struct __clockid__ *
./autosetup/jimsh0.c:7316:35: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
 7316 | jim_wide Jim_GetTimeUsec(unsigned type)
      |                          ~~~~~~~~~^~~~
./autosetup/jimsh0.c:19481:36: warning: passing argument 1 of 'Jim_GetTimeUsec' makes integer from pointer without a cast [-Wint-conversion]
19481 |         overhead = Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW) - start;
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    |
      |                                    struct __clockid__ *
./autosetup/jimsh0.c:7316:35: note: expected 'unsigned int' but argument is of type 'struct __clockid__ *'
 7316 | jim_wide Jim_GetTimeUsec(unsigned type)
      |                          ~~~~~~~~~^~~~
./autosetup/jimsh0.c: In function 'JimProcessPid':
./autosetup/jimsh0.c:23513:12: warning: implicit declaration of function 'GetProcessId'; did you mean 'GetProcessHeap'? [-Wimplicit-function-declaration]
23513 |     return GetProcessId(pid);
      |            ^~~~~~~~~~~~
      |            GetProcessHeap
c:/dreamsdk/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\gyrov\AppData\Local\Temp\ccLAVTXy.o:jimsh0.c:(.text+0x29fe6): undefined reference to `GetProcessId'
c:/dreamsdk/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\gyrov\AppData\Local\Temp\ccLAVTXy.o:jimsh0.c:(.text+0x2a0c7): undefined reference to `GetProcessId'

I have confirmed that we have getpid() from MINSYS in <unistd.h>, btw.

from jimtcl.

msteveb avatar msteveb commented on June 3, 2024

Hmmm, still seem strange to me. GetProcessId() should be included in processthreadsapi.h, which is included by winbase.h
Why isn't that included for you (gcc -E can help here)?

Also I would be concerned about CLOCK_REALTIME being defined, but not an int. Are you somehow picking up some cygwin things?

from jimtcl.

gyrovorbis avatar gyrovorbis commented on June 3, 2024

Just wanted to follow up with you here. I was able to get as far as you said on your updated branch, definitely got jimsh0.exe built (whooo!!!), but then the build seemed to fail on some compiler subsequent checks.

Is there anything you need us to check or try out on our end? Thanks for helping to support us, btw. We really appreciate it!

from jimtcl.

msteveb avatar msteveb commented on June 3, 2024

I did have a bit more of a look at this. Not being able to detect isatty() reliably is annoying. I took a look at how git does it and it is complicated. And the exec issue is messy. In the case I found it was trying to exec a shell script, but that's not a standard windows thing. That is an msys2 thing. So I think there needs to a build for msys2 separate from mingw, but how you detect the difference and what to do about it, I don't know. I don't have reliable access to a Windows platform so I'm inclined to leave all this to someone who does and can test reliably across mingw, msys2 and cygwin.

from jimtcl.

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.