Cross compiler Linux -> Windows 32/64Bit

276 views
Skip to first unread message

Itamar Lins

unread,
Jan 12, 2023, 8:55:12 AM1/12/23
to Harbour Users
Hi!
I use Linux, GCC to make Harbour programs.
How to sintaxe from build EXE from Linux to Windows environment ?

Best regards,
Itamar M. Lins Jr.

Itamar Lins

unread,
Jan 12, 2023, 12:28:25 PM1/12/23
to Harbour Users
Hi!
I get this error -> gcc: error: unrecognized command-line option ‘-mconsole’

itamar@itamar-desktop:~/fontes/testes$ hbmk2 hello.prg -cflag=-m32 -ldflag=-m32 -L~/dev/hbwin/li
b/win/mingw -comp=mingw
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'hello.prg'...
Lines 3, Functions/Procedures 1
Generating C source output to '/tmp/hbmk_p6sc1b.dir/hello.c'... Done.
gcc: error: unrecognized command-line option ‘-mconsole’
hbmk2: Erro: Executando linkeditor. 1
gcc /tmp/hbmk_p6sc1b.dir/hello.o /tmp/hbmk_p6sc1b.dir/hbmk_big33h.o -m32 -mconsole -Wl,--star
t-group -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -
lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx
-lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbmainstd -lwinmm -lkernel32 -luser32 -lgdi32 -l
advapi32 -lws2_32 -liphlpapi -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut3
2 -lmpr -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -Wl,--end-group -ohello.exe -L/usr/loca
l/lib/harbour

Best regards,
Itamar M. Lins Jr.

Eric Lendvai

unread,
Jan 15, 2023, 9:30:59 PM1/15/23
to Harbour Users
I develop on Windows and Ubuntu at the same time.
The best method to develop across both platform is to use Docker Desktop on Windows.

The following is an article for setting up Docker Desktop (free) on Windows

Than you can use the following repo as an example

Eric

Alain Aupeix

unread,
Jan 16, 2023, 3:58:00 AM1/16/23
to harbou...@googlegroups.com, Eric Lendvai
Le 16/01/2023 à 03:30, Eric Lendvai a écrit :
I develop on Windows and Ubuntu at the same time.
The best method to develop across both platform is to use Docker Desktop on Windows.

Hi Eric,

and how to build for Windows under Ubuntu (as I have no Windows machine)?

Thanks
A+
--

Alain Aupeix
Sites web : JujuLand | Pissobi-Lacassagne | Gadel
X.ubuntu 16.04 | H.arbour 3.2.0-1 (r2022-11-11 21:15) | Hw.gui 2.23-4 (r3146) | G.ramps 5.1.2


Itamar Lins

unread,
Jan 16, 2023, 12:01:43 PM1/16/23
to Harbour Users
Hi!
My main platform is Linux, I need to understand how to make Windows .exe from Linux OS.
With make install Harbour build harbour.exe and others files 100% Windows OS.

>sudo make install HB_PLATFORM=win HB_INSTALL_PREFIX=/home/itamar/dev/hbwin HB_COMPILER=mingw
...
! Building Harbour 3.2.0dev from source - https://harbour.github.io
! MAKE: make 4.3 /bin/sh install
! HB_INSTALL_PREFIX: /home/itamar/dev/hbwin
! HB_HOST_PLAT: linux (x86_64) HB_SHELL: sh
! HB_PLATFORM: win (x86)
! HB_COMPILER: mingw
! HB_HOST_BIN not specified. Automatically set to: /home/itamar/dev/hb32/bin/linux/gcc
! Component: 'zlib' found in /home/itamar/dev/hb32/src/3rd/zlib (local)
! Component: 'pcre' found in /home/itamar/dev/hb32/src/3rd/pcre (local)
! Component: 'gpm' not supported on win platform
! Component: 'slang' not found
! Component: 'curses' not found
! Component: 'x11' not found
! Component: 'wattcp/watt-32' not supported on win platform
/usr/bin/i686-w64-mingw32-gcc -I. -I../../../../../include -W -Wall -O3 -fomit-frame-pointer -march=i586 -mtune=pentiumpro -DUNIC
ODE -ohbgete.o -c ../../../hbgete.c
/usr/bin/i686-w64-mingw32-gcc -I. -I../../../../../include -W -Wall -O3 -fomit-frame-pointer -march=i586 -mtune=pentiumpro -DUNIC
ODE -ohbgete_dyn.o -DHB_DYNLIB -c ../../../hbgete.c
...
itamar@itamar-desktop:~/dev/hb32/src/common$ ls ~/dev/hbwin/bin -l
total 19564
-rwxrwxr-x 1 root root 35962 jan 12 11:20 3rdpatch.hb
-rwxrwxr-x 1 root root 25631 jan 12 11:20 check.hb
-rwxrwxr-x 1 root root 12443 jan 12 11:20 commit.hb
-rw-r--r-- 1 root root 30208 jan 12 11:20 contrib.hbr
-rwxr-xr-x 1 root root 5726009 jan 12 16:16 harbour-32.dll
-rwxr-xr-x 1 root root 1056489 jan 12 16:16 harbour.exe
-rw-rw-r-- 1 root root 27960 jan 12 11:20 harbour.ucf
-rwxr-xr-x 1 root root 179820 jan 12 11:19 hbformat.exe
-rwxr-xr-x 1 root root 121067 jan 12 16:16 hbi18n.exe
-rw-r--r-- 1 root root 118760 jan 12 11:20 hbmk2.el.hbl
-rw-r--r-- 1 root root 212 jan 12 11:20 hbmk2.en.hbl
-rw-r--r-- 1 root root 83825 jan 12 11:20 hbmk2.es_419.hbl
-rw-r--r-- 1 root root 87214 jan 12 11:20 hbmk2.es.hbl
-rwxr-xr-x 1 root root 6439028 jan 12 16:16 hbmk2.exe
-rw-r--r-- 1 root root 9707 jan 12 11:20 hbmk2.fr.hbl
-rw-r--r-- 1 root root 83433 jan 12 11:20 hbmk2.gl.hbl
-rw-r--r-- 1 root root 18885 jan 12 11:20 hbmk2.hu.hbl
-rw-r--r-- 1 root root 39623 jan 12 11:20 hbmk2.it.hbl
-rw-r--r-- 1 root root 83682 jan 12 11:20 hbmk2.pt_BR.hbl
-rwxr-xr-x 1 root root 3113816 jan 12 11:19 hbnetio.exe
-rwxr-xr-x 1 root root 457610 jan 12 16:16 hbpp.exe
-rwxr-xr-x 1 root root 1697260 jan 12 11:19 hbrun.exe
-rwxr-xr-x 1 root root 538200 jan 12 16:16 hbtest.exe


Best regards,
Itamar M. Lins Jr.



Eric Lendvai

unread,
Jan 18, 2023, 1:39:34 AM1/18/23
to Harbour Users
Hello Alain and Itamar,

To my knowledge there is no free method to have Windows on Linux.
Probably the best solution is to use VMware Workstation Pro Linux host mode. The latest VMWare will support the latest version of Windows. 
I think the Player version could also play, but I am not certain about the restrictions. Cost for the Pro is $250.
You should probably have at minimum a 16Gb machine. My main laptop has 64Gb of ram, so I can run multiple versions of Linux and Windows.
The PRO gives you snapshots, which is a fantastic feature to help you undo installs.
Also the PRO includes virtual networks, so yo can simulate local networks an run multiple clients interconnected.
If you have a Windows 8.1 license, I think you can still have it upgrade to Windows 10 for free, otherwise you are looking at another $200 for the Windows Pro version.

Another solution is to rent a Windows machine  in the cloud an pay monthly fees. You will be able to RDP into that machine.
I use https://www.ionos.com/ and rent Windows Server machine.

Docker Desktop will not run inside a Windows Client inside of VMWare or most likely any other VM software. But this should not be an issue, since your host is already Linux.

Hope this helps, Eric

Gerald Drouillard

unread,
Jan 18, 2023, 8:03:02 AM1/18/23
to harbou...@googlegroups.com
You can install the ubuntu subsystem in windows 10/11.
Or you can you msys with windows.

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/06208e0f-574d-47a7-a668-5bf153e67b37n%40googlegroups.com.

jgt

unread,
Jan 18, 2023, 9:59:52 AM1/18/23
to Harbour Users
I use LinuxMint as my host desktop system, and use VirtualBox to host Windows and Linux guests.  The host is an old I7 with 12gb ram and several SSD's.
All non Microsoft stuff is free.

Eric Lendvai

unread,
Jan 18, 2023, 11:18:02 AM1/18/23
to Harbour Users
Here is an article I created explaining the install and use of WSL (Windows Subsystem for Linux) and Docker Desktop:

fdaniele

unread,
Jan 18, 2023, 11:48:43 AM1/18/23
to Harbour Users
big Eric !!

Itamar M. Lins Jr. Lins

unread,
Jan 18, 2023, 2:49:04 PM1/18/23
to harbou...@googlegroups.com
Hi!
Linux make WINDOWS 32/64Bits executables files.
It is not problem. LAZARUS IDE make this via (FPCUPDELUXE)
gcc make from Linux 32/64Bit to Windows OS, we just don't know how to do it.
WSL for my and others is not solution, because we don't use the windows operating system anymore.

Best regards,
Itamar M. Lins Jr.



alexwi

unread,
Jan 18, 2023, 5:36:02 PM1/18/23
to Harbour Users
Itamar,

If you don't use Windows yourself, but develop for that target, I imagine that you're writing programs for others, because, as a Linux user, you can't actually the software you write.

I use Linux myself, but I have several windows computers (and virtual machines) that I use for various purposes, including developing software for clients (none of which use Linux).

Rather than bending over backwards to do this, you owe it to yourself and your clients to have a Windows computer of some kind, and there are countless ways to get a copy of windows (both legal and illegal, you pick). You can download an ISO from Microsoft that will let you "evaluate" Windows for a few months, if I'm not mistaken, or you can buy a license for an older version rather cheaply (Win10 goes for about $50), set it up in VirtualBox and be done with this.

One way to see this is as an investment. Another is to put yourself in your clients' shoes and ask yourself if you would hire a developer who's going to waste countless hours trying to find a complicated way to do something simple and who has no way to test any of it.



Alex

Itamar Lins

unread,
Jan 18, 2023, 5:47:08 PM1/18/23
to Harbour Users
Hi!
In my house we have 4 computers 1 Linux 3 Windows.
I've used windows and linux for over 30 years...
Please stick to the question, let's avoid unproductive conversations.
I develop ERP for years on windows and run it on Linux using WINE. And this ERP has been running for over 30 years on several machines with Windows 32/64 using different tools, including LetoDBf, SQLMIX, etc... So let's stick to the initial question.

Best regards,
Itamar M. Lins Jr.

alexwi

unread,
Jan 19, 2023, 3:31:51 PM1/19/23
to Harbour Users
Got it. I had no way to know this was a purely academic exercise.

Alex
Reply all
Reply to author
Forward
0 new messages