Hi Arjen,

here is a kind of "minimalistic" toolchain file, I used successfully for 
cross-compiling from Cygwin to native Windows:

set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc)

To enable bindings to other languages like C++ and Fortran, the respective 
cross-compilers might be also set.

Hope this helps,
Kay-Uwe


Von: Arjen Markus <arjen.mar...@deltares.nl>
Gesendet: Freitag, 14. Mai 2021 10:28
An: Kirstein, Kay-Uwe <kayuwe.kirst...@uster.com>; 
plplot-general@lists.sourceforge.net
Betreff: RE: Cross-compiling in Cygwin

Hi Kay-Uwe,

I have updated the links in this wiki page. Do you have an eample of that 
toolchain file, so that we can update the page further?

Regards,

Arjen

From: Kirstein, Kay-Uwe <kayuwe.kirst...@uster.com>
Sent: 12 May 2021 17:13
To: Arjen Markus <arjen.mar...@deltares.nl>; 
plplot-general@lists.sourceforge.net
Subject: AW: Cross-compiling in Cygwin

Hi Arjen,

in the meantime I found out that cross-compiling mode of cmake was not 
correctly enabled. It looks like one explicitly need a toolchain file with 
CMAKE_SYSTEM_NAME set. After doing so, cross-compiling PLplot works like a 
charm!
Maybe, one could add an example toolchain file in the wiki 
(https://sourceforge.net/p/plplot/wiki/Building_PLplot_with_a_cross-compiler/<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fp%2Fplplot%2Fwiki%2FBuilding_PLplot_with_a_cross-compiler%2F&data=04%7C01%7C%7Cc6976dd4d6614fd9d3e708d91558748b%7C15f3fe0ed7124981bc7cfe949af215bb%7C0%7C1%7C637564291932298631%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TESGDWCPYUtC657YND7FdP8blWu6D%2FladWX6JiwR2FU%3D&reserved=0>)
 as the link to the cmake docs seems to be outdated.

Sorry for bothering!

Best regards,
Kay-Uwe

Von: Kirstein, Kay-Uwe
Gesendet: Mittwoch, 12. Mai 2021 15:39
An: Arjen Markus <arjen.mar...@deltares.nl<mailto:arjen.mar...@deltares.nl>>; 
plplot-general@lists.sourceforge.net<mailto:plplot-general@lists.sourceforge.net>
Betreff: AW: Cross-compiling in Cygwin

Hi Arjen,

thanks for your fast answer. Using a cross-compiling scheme was my first 
natural choice as the MinGW-w64 toolchain I am using is located in my Cygwin 
environment and the generated PLplot libs should be also located there (there 
is a different sys-root for native Windows stuff, not relying on Cygwin.dll).
The MinGW-tools themselves rely on the Linux-style path names, but any 
executable generated by them, e.g., tai-utc-gen.exe expect Windows-style path 
names.

Anyway, I will try to perform a native Windows build outside of Cygwin, but I 
might need another version of the MinGW-w64 toolchain as you are pointing out.

Best regards,
Kay-Uwe


Von: Arjen Markus <arjen.mar...@deltares.nl<mailto:arjen.mar...@deltares.nl>>
Gesendet: Mittwoch, 12. Mai 2021 08:40
An: Kirstein, Kay-Uwe 
<kayuwe.kirst...@uster.com<mailto:kayuwe.kirst...@uster.com>>; 
plplot-general@lists.sourceforge.net<mailto:plplot-general@lists.sourceforge.net>
Betreff: RE: Cross-compiling in Cygwin

Hi Kay-Uwe,

I have never tried this cross-compilation, but your observation about the paths 
not being recognized does ring a bell. MinGW-w64/MSYS2 (to call it by its most 
descriptive name) comes with two environments, one very Linux-like, and 
therefore compatible with Cygwin in its style of path identification and one 
that is more Windows-like and therefore uses a Windows-style of path 
identification. (Don't pin me down though on the details - they always confuse 
me)

That said, I do not have a solution/workaround for the problem. But do you 
really need to cross-compile?

Regards,

Arjen

From: Kirstein, Kay-Uwe 
<kayuwe.kirst...@uster.com<mailto:kayuwe.kirst...@uster.com>>
Sent: 12 May 2021 08:06
To: 
plplot-general@lists.sourceforge.net<mailto:plplot-general@lists.sourceforge.net>
Subject: [Plplot-general] Cross-compiling in Cygwin

Hello,

I am trying to build PLplot on Windows. As I have a Cygwin environment and want 
to build for (native) Mingw, used the cross-compiling scheme as described on 
the Wiki 
(https://sourceforge.net/p/plplot/wiki/Building_PLplot_with_a_cross-compiler/<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fp%2Fplplot%2Fwiki%2FBuilding_PLplot_with_a_cross-compiler%2F&data=04%7C01%7C%7Cc6976dd4d6614fd9d3e708d91558748b%7C15f3fe0ed7124981bc7cfe949af215bb%7C0%7C1%7C637564291932308584%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uAzt5cKlme6CJNWGzqGygJV%2BgfXnJuu8Pl4eSE5B8Rk%3D&reserved=0>)
 and mailing list 
(https://sourceforge.net/p/plplot/mailman/plplot-general/thread/alpine.DEB.2.11.1710051507310.4357%40enira.zlyna.ubzr/#msg36065593<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fp%2Fplplot%2Fmailman%2Fplplot-general%2Fthread%2Falpine.DEB.2.11.1710051507310.4357%2540enira.zlyna.ubzr%2F%23msg36065593&data=04%7C01%7C%7Cc6976dd4d6614fd9d3e708d91558748b%7C15f3fe0ed7124981bc7cfe949af215bb%7C0%7C1%7C637564291932308584%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=OjvsPjlnPD4zUqeBc0qw%2FHXo7loomKFUHGuJVsFm8zc%3D&reserved=0>).

So I started with a Cygwin build:

mkdir build_cygwin
cd build_cygwin
cmake -DCMAKE_C_COMPILER=gcc ../PLplot

make all

which works fine. Then a made a new build folder for the Mingw build:

mkdir build_mingw
cd build_mingw
cmake -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc 
-DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32/sys-root/mingw 
-DCMAKE_NATIVE_BINARY_DIR=../build_cygwin ../PLplot

make all

It fails with the following message:

[  8%] Generating tai-utc.h
Cannot open first file as readable
make[2]: *** [lib/qsastime/CMakeFiles/tai-utc.h_built.dir/build.make:74: 
lib/qsastime/tai-utc.h] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:869: 
lib/qsastime/CMakeFiles/tai-utc.h_built.dir/all] Fehler 2
make: *** [Makefile:156: all] Fehler 2

It looks like that tai-utc-gen.exe, which is now build with Mingw toolchain 
cannot deal with the given Cygwin-style path parameter. In cross-compiling 
mode, I would have expected that the either the needed header files are copied 
from the native build or the generator executables are taken from there. When I 
manually copy the generated header files (./lib/qsatime/tai-utc.h 
./lib/qsatime/deltaT.h and ./include/plhershey-unicode.h) from build_cygwin to 
build_mingw, the build continues successfully.

An interesting observation is that during configure of the Mingw build, cmake 
reports an unused variable CMAKE_NATIVE_BINARY_DIR. I played around with 
setting CMAKE_CROSSCOMPILING=TRUE or moving CMAKE_C_COMPILER= 
x86_64-w64-mingw32-gcc to a toolchain file, which is called via 
CMAKE_TOOLCHAIN_FILE=toolchain.cmake with no difference.

Am I missing something here? Any help is greatly appreciated.

Best regards,
Kay-Uwe Kirstein




DISCLAIMER: This message is intended exclusively for the addressee(s) and may 
contain confidential and privileged information. If you are not the intended 
recipient please notify the sender immediately and destroy this message. 
Unauthorized use, disclosure or copying of this message is strictly prohibited. 
The foundation 'Stichting Deltares', which has its seat at Delft, The 
Netherlands, Commercial Registration Number 41146461, is not liable in any way 
whatsoever for consequences and/or damages resulting from the improper, 
incomplete and untimely dispatch, receipt and/or content of this e-mail.
DISCLAIMER: This message is intended exclusively for the addressee(s) and may 
contain confidential and privileged information. If you are not the intended 
recipient please notify the sender immediately and destroy this message. 
Unauthorized use, disclosure or copying of this message is strictly prohibited. 
The foundation 'Stichting Deltares', which has its seat at Delft, The 
Netherlands, Commercial Registration Number 41146461, is not liable in any way 
whatsoever for consequences and/or damages resulting from the improper, 
incomplete and untimely dispatch, receipt and/or content of this e-mail.
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to