cross compiling from wsl ubuntu to windows

301 views
Skip to first unread message

hbenrico

unread,
Jun 28, 2023, 6:21:26 PM6/28/23
to Harbour Users
Hi all, 

I am trying to cross-compile the following simple program:

function main()
    local a:=1
    ? "a",a
return NIL

I have installed mingw-w64 package

and I am getting those errors:

mcom@X1:~/tmp$ hbmk2 -plat=win -comp=mingw64 prova.prg
Harbour 3.2.0dev (r2305191429)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'prova.prg'...
Lines 7, Functions/Procedures 1
Generating C source output to '/tmp/hbmk_c2uje0.dir/prova.c'... Done.
gcc: error: unrecognized command-line option ‘-mconsole’
hbmk2: Error: Running linker. 1
gcc /tmp/hbmk_c2uje0.dir/prova.o /tmp/hbmk_c2uje0.dir/hbmk_f60xzh.o    -mconsole -Wl,--start-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 -ladvapi32 -lws2_32 -liphlpapi -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib   -Wl,--end-group -oprova.exe  -L/home/mcom/comp/hb32/lib

please, where am i wrong? 
many thanks in advance

Enrico




Maurizio la Cecilia

unread,
Jun 29, 2023, 2:25:55 AM6/29/23
to harbou...@googlegroups.com
Hi Enrico,
can you try changing line 4466 of hbmk2.prg from:
                  AAdd( hbmk[ _HBMK_aOPTL ], "-mconsole" )
to:
                  AAdd( hbmk[ _HBMK_aOPTL ], "-std" )
and recompiling hbmk2.exe?

AFAICS -mconsole is deprecated since 2013-01-23 17:14 UTC+0100 Viktor Szakats (vszakats.net/harbour)

Best regards.
--
Maurizio
--
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/0b497047-f9f4-470c-88c8-dfe68a4083efn%40googlegroups.com.


hbenrico

unread,
Jun 29, 2023, 5:02:58 AM6/29/23
to Harbour Users
Hi Maurizio!

thank you so much, I am going to try it

Enrico

hbenrico

unread,
Jun 29, 2023, 5:23:04 AM6/29/23
to Harbour Users
Hello Maurizio

with "-std" flag, the error is quite similar

mcom@X1:~/tmp$ hbmk2 -plat=win -comp=mingw64 prova.prg
Harbour 3.2.0dev (r2305191429)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'prova.prg'...
Lines 7, Functions/Procedures 1
Generating C source output to '/tmp/hbmk_5r6muy.dir/prova.c'... Done.
gcc: error: unrecognized command-line option ‘-std’

hbmk2: Error: Running linker. 1
gcc /tmp/hbmk_5r6muy.dir/prova.o /tmp/hbmk_5r6muy.dir/hbmk_tdmvi4.o    -std -Wl,--start-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 -ladvapi32 -lws2_32 -liphlpapi -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib   -Wl,--end-group -oprova.exe  -L/home/mcom/comp/hb32/lib

so I tried to comment out the entire line num 4466

mcom@X1:~/tmp$ hbmk2 -plat=win -comp=mingw64 prova.prg
Harbour 3.2.0dev (r2305191429)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'prova.prg'...
Lines 7, Functions/Procedures 1
Generating C source output to '/tmp/hbmk_mqenwa.dir/prova.c'... Done.
/usr/bin/ld: cannot find -lgtwin: No such file or directory
/usr/bin/ld: cannot find -lgtwvt: No such file or directory
/usr/bin/ld: cannot find -lgtgui: No such file or directory
/usr/bin/ld: cannot find -lhbmainstd: No such file or directory
/usr/bin/ld: cannot find -lwinmm: No such file or directory
/usr/bin/ld: cannot find -lkernel32: No such file or directory
/usr/bin/ld: cannot find -luser32: No such file or directory
/usr/bin/ld: cannot find -lgdi32: No such file or directory
/usr/bin/ld: cannot find -ladvapi32: No such file or directory
/usr/bin/ld: cannot find -lws2_32: No such file or directory
/usr/bin/ld: cannot find -liphlpapi: No such file or directory
/usr/bin/ld: cannot find -lwinspool: No such file or directory
/usr/bin/ld: cannot find -lcomctl32: No such file or directory
/usr/bin/ld: cannot find -lcomdlg32: No such file or directory
/usr/bin/ld: cannot find -lshell32: No such file or directory
/usr/bin/ld: cannot find -luuid: No such file or directory
/usr/bin/ld: cannot find -lole32: No such file or directory
/usr/bin/ld: cannot find -loleaut32: No such file or directory
/usr/bin/ld: cannot find -lmpr: No such file or directory
/usr/bin/ld: cannot find -lmapi32: No such file or directory
/usr/bin/ld: cannot find -limm32: No such file or directory
/usr/bin/ld: cannot find -lmsimg32: No such file or directory
/usr/bin/ld: cannot find -lwininet: No such file or directory
collect2: error: ld returned 1 exit status

hbmk2: Error: Running linker. 1
gcc /tmp/hbmk_mqenwa.dir/prova.o /tmp/hbmk_mqenwa.dir/hbmk_ik59za.o    -Wl,--start-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 -ladvapi32 -lws2_32 -liphlpapi -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib   -Wl,--end-group -oprova.exe  -L/home/mcom/comp/hb32/lib

it can't find libraries, but this is another story... :) I afraid I can't solve it 
thank you again
Enrico
Il giorno giovedì 29 giugno 2023 alle 08:25:55 UTC+2 Maurizio la Cecilia ha scritto:

Eric Lendvai

unread,
Jun 30, 2023, 2:08:05 AM6/30/23
to Harbour Users

hbenrico

unread,
Jun 30, 2023, 6:21:25 AM6/30/23
to Harbour Users
Hello Eric,
ok, sure I will
thank you so much for that information
Enrico

Reply all
Reply to author
Forward
0 new messages