From 8444695a3016cd0b796d84b52974526d07ddf917 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 18 Dec 2024 09:45:27 +0100 Subject: [PATCH 1/4] scripts/Windows/README.adoc: update markup at start of doc Signed-off-by: Jim Klimov --- scripts/Windows/README.adoc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/scripts/Windows/README.adoc b/scripts/Windows/README.adoc index a3ad9e67a0..3b9ced1349 100644 --- a/scripts/Windows/README.adoc +++ b/scripts/Windows/README.adoc @@ -8,7 +8,7 @@ NUT is now also available for the Microsoft Windows platform. This methodology (and Windows support in general) are currently experimental, so pull requests are welcome to tie up some loose ends (add more prerequisites, -test and fix programs, re-enable some code just commented away by `ifdef`s...) +test and fix programs, re-enable some code just commented away by `ifdef`'s...) NOTE: It is possible to prepare a Windows machine with tools and prerequisites for building NUT natively, as detailed in `docs/config-prereqs.txt` and easily @@ -84,22 +84,28 @@ If you use script `./build-mingw-nut.sh` mentioned below, you may skip setting these environment variables when building NUT. You would however need to use them once (per `ARCH`) to provide the prerequisites below if built from source. -When using the compilation approach, use the following HOST_FLAG, BUILD_FLAG -and CC, CFLAGS, LDFLAGS and PREFIX: +When using the compilation approach, you would typically use the following +`ARCH`, `HOST_FLAG` and `BUILD_FLAG`, as well as `CC`, `CFLAGS`, `LDFLAGS` +and `PREFIX` values: - prefer either to ------ :; export ARCH="x86_64-w64-mingw32" ------ ++ or ------ :; export ARCH="i686-w64-mingw32" ------ -(it can help to open two terminals and copy one ARCH into each - and then the lines below into both of them; be sure to use separate - directory trees for the unpacked build workspaces) - -- for either-ARCH build environment further set: ++ +(it can help to open two terminals and copy one `ARCH` into each + and then the other lines below into both of them; be sure to use + separate directory trees for the unpacked build workspaces, while + you can use the same source tarball download directory for both -- just + do not paste the commands simultaneously to avoid downloading in parallel; + the `wget -c` used below would skip downloads that are already completed) + +- for either-`ARCH` build environment further set: ------ :; export HOST_FLAG="--host=$ARCH" :; PREFIX="/usr/$ARCH" From cc9446f34bb6b4b2246f083346e80b77ffd8cf15 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 18 Dec 2024 09:48:57 +0100 Subject: [PATCH 2/4] scripts/Windows/README.adoc: add a note about not-running builds as root Signed-off-by: Jim Klimov --- scripts/Windows/README.adoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/Windows/README.adoc b/scripts/Windows/README.adoc index 3b9ced1349..76b957b93f 100644 --- a/scripts/Windows/README.adoc +++ b/scripts/Windows/README.adoc @@ -173,6 +173,9 @@ below, it would be like: ================================================================================ +NOTE: Instructions below use `sudo` to specify operations you may need to run +with privilege elevation (assuming installation into a `PREFIX=/usr/$ARCH`); +the majority of operations can be done (recommended) as an unprivileged user. pthread library ^^^^^^^^^^^^^^^ From 4371b32f4ddd6c9aeea7d1a485355e626d23ae39 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 18 Dec 2024 09:49:43 +0100 Subject: [PATCH 3/4] scripts/Windows/README.adoc: pthreads: built directly by `make`, should not use $BUILD_FLAG Signed-off-by: Jim Klimov --- scripts/Windows/README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Windows/README.adoc b/scripts/Windows/README.adoc index 76b957b93f..7878ecf78b 100644 --- a/scripts/Windows/README.adoc +++ b/scripts/Windows/README.adoc @@ -203,7 +203,7 @@ You can also compile it (where that is still needed) using: :; cd "$WSDIR" :; tar xzf "$DLDIR"/pthreads-w32-2-8-0-release.tar.gz :; cd pthreads-w32-2-8-0-release/ - :; make -f GNUmakefile "CROSS=$ARCH-" $BUILD_FLAG GC-inlined + :; make -f GNUmakefile "CROSS=$ARCH-" GC-inlined :; sudo cp *.dll ${PREFIX}/pthreads/lib/ :; sudo cp *.a ${PREFIX}/lib/ :; sudo cp pthread.h sched.h semaphore.h ${PREFIX}/pthreads/include From d8331bc7d66bbd964d66a85d69f4bef8e0cf2ae4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 18 Dec 2024 09:58:57 +0100 Subject: [PATCH 4/4] scripts/Windows/README.adoc: pthreads: comment on issues with "timespec" [#2724] Signed-off-by: Jim Klimov --- docs/nut.dict | 3 ++- scripts/Windows/README.adoc | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/nut.dict b/docs/nut.dict index d73bc4e533..d1c29bc515 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3269 utf-8 +personal_ws-1.1 en 3270 utf-8 AAC AAS ABI @@ -2992,6 +2992,7 @@ th timeframe timehead timername +timespec timestamp timeticks timeval diff --git a/scripts/Windows/README.adoc b/scripts/Windows/README.adoc index 7878ecf78b..a1da002cc1 100644 --- a/scripts/Windows/README.adoc +++ b/scripts/Windows/README.adoc @@ -204,6 +204,24 @@ You can also compile it (where that is still needed) using: :; tar xzf "$DLDIR"/pthreads-w32-2-8-0-release.tar.gz :; cd pthreads-w32-2-8-0-release/ :; make -f GNUmakefile "CROSS=$ARCH-" GC-inlined + +[NOTE] +====== +If it complains about +`pthread.h:307:8: error: redefinition of 'struct timespec'` +please edit `config.h` to add a `HAVE_STRUCT_TIMESPEC` definition +and re-run `make`, e.g.: + + :; echo '#define HAVE_STRUCT_TIMESPEC 1' >> config.h + :; make -f GNUmakefile "CROSS=$ARCH-" GC-inlined + +There may also be some warnings from newer compilers about +`cast to pointer from integer of different size` -- these are +presumed inconsequential. You can try a not-"inlined" build instead. +====== + +Finally, install the resulting files into locations under `PREFIX`: + :; sudo cp *.dll ${PREFIX}/pthreads/lib/ :; sudo cp *.a ${PREFIX}/lib/ :; sudo cp pthread.h sched.h semaphore.h ${PREFIX}/pthreads/include