The C::B support for OpenWatcom seems to be bit broken. The linking process works when we're using it for Console apps or Win32 GUI app, but fails if I'm creating wxWidgets project. I'm also getting similar error messages as posted in the following bug report.
Quotehttps://developer.berlios.de/bugs/?func=detailbug&bug_id=8391&group_id=5358
The problem is,
wcl386.exe does not responds to
-L flag which has been used to specify library directories. I could not get explanation in their documentation, but
-l flag is basically used to specify platform. I'm getting the following error.
Quotewcl386.exe -q -d2 -q -bt=nt -r -LC:\wxMSW-2.9.0\lib\wat_dll -LC:\watcom\lib obj\Debug\TestMain.obj obj\Debug\TestApp.obj -fe=bin\Debug\Test.exe wxmsw29ud.lib obj\Debug\resource.res
Warning! W1107: file __wcl__.lnk: line(3): undefined system name: C:\watcom\lib
Warning! W1008: cannot open wxmsw29ud.lib : No such file or directory
There are two possible solutions.
1. Provide the library with their full path name. I prefixed library with it's absolute path and it worked. See the following log.
Quotewcl386.exe -q -d2 -q -bt=nt -r -LC:\wxMSW-2.9.0\lib\wat_dll -LC:\watcom\lib obj\Debug\TestMain.obj obj\Debug\TestApp.obj -fe=bin\Debug\Test.exe ..\..\wxMSW-2.9.0\lib\wat_dll\wxmsw29ud.lib obj\Debug\resource.res
Warning! W1107: file __wcl__.lnk: line(3): undefined system name: C:\watcom\lib
Process terminated with status 0 (0 minutes, 15 seconds)
2 errors, 2 warnings
Though it shows 2 errors, but it compiles and links successfully.
2. Create a file, e.g., minimal.lbc with the following content.
Quoteoption quiet
name wat_msw\minimal.exe
option caseexact
libpath .\..\..\lib\wat_lib system nt_win ref '_WinMain@16'
file wat_msw\minimal_minimal.obj
library wxmsw28_core.lib
library wxbase28.lib
library wxtiff.lib
library wxjpeg.lib
library wxpng.lib
library wxzlib.lib
library wxregex.lib
library wxexpat.lib
library kernel32.lib
library user32.lib
library gdi32.lib
library comdlg32.lib
library winspool.lib
library winmm.lib
library shell32.lib
library comctl32.lib
library ole32.lib
library oleaut32.lib
library uuid.lib
library rpcrt4.lib
library advapi32.lib
library wsock32.lib
library odbc32.lib
option resource=wat_msw\minimal_sample.res
and then pass it to
wlink.exe as -
Quotewlink @minimal.lbc
This does the trick. Second one I got from minimal sample of wx.
Which one can be implemented quickly in C::B?
Regards,
Biplab
QuoteWhich one can be implemented quickly in C::B?
Adding the full path can already be done. Nothing to implement in this case.
The second workaround (create an external file) is not going to be implemented (like it hasn't for other compilers/linkers too).
Quote
option caseexact
libpath .\..\..\lib\wat_lib system nt_win ref '_WinMain@16'
There
has to be a way to pass this option in the command line (so both of your workarounds would become obsolete). Unfortunately I don't have OW installed here so I can't look for it...
I'm also curious
Quote from: mandrav on February 26, 2007, 05:27:29 PM
Adding the full path can already be done. Nothing to implement in this case.
Ok, I'll read the SDK.
Quote from: mandrav on February 26, 2007, 05:27:29 PM
Adding the full path can already be done. Nothing to implement in this case.
The second workaround (create an external file) is not going to be implemented (like it hasn't for other compilers/linkers too).
Quote
option caseexact
libpath .\..\..\lib\wat_lib system nt_win ref '_WinMain@16'
There has to be a way to pass this option in the command line (so both of your workarounds would become obsolete). Unfortunately I don't have OW installed here so I can't look for it...
Yesterday I tried to find some option in their official manual. I couldn't find it even after a long search. I can only say OW is Full of Different Compiler Options. ;)
@Mandrav,
I've found a Good solution to this problem. The following option will fix this issue.
/"LIBP <LibDir>"I've fixed this issue and created a patch. The patch will improve the OpenWatcom support to a great extent. I'm posting the changes in details for your information.
Major Changes:
- Removes the registry key check during auto-detection. I've found that OpenWatcom (OW) does not create any registry key.
- Lib-dir include option has been fixed. Now OW will properly search libraries in provided directory.
- Appropriate IncludeDirs , Library Dirs and Resource Include Dirs have been added. OW will Not complain about wrong lib directory.
- A Linker Library Directory Generator function has been added to supply OW with properly formatted Lib-dir include option.
- Fixed issue with parsing Warning Notes as Error Messages. Now it should properly report Warnings and Errors in Build-log.
I've tested this with a sample wxWidgets project. I'm posting the build-log.
Quote-------------- Build: Release in Test ---------------
wcl386.exe -q -c -d__WXMSW__ -d__WINDOWS__ -d_WINDOWS -dWXUSINGDLL -dUNICODE -bm -br -bw -bt=nt -zq -xr -xs -wcd=549 -wcd=656 -wcd=657 -wcd=667 -wx -ox -ot -iC:\wxMSW-2.9.0\include -iC:\wxMSW-2.9.0\contrib\include -iC:\wxMSW-2.9.0\lib\wat_dll\mswu -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Release\TestMain.obj TestMain.cpp
TestMain.cpp(83): Warning! W726: col(1) no reference to formal parameter 'event'
TestMain.cpp(80): Note! N392: col(41) definition: 'wxCommandEvent & event' in 'void TestDialog::OnQuit( wxCommandEvent & )'
TestMain.cpp(89): Warning! W726: col(1) no reference to formal parameter 'event'
TestMain.cpp(85): Note! N392: col(42) definition: 'wxCommandEvent & event' in 'void TestDialog::OnAbout( wxCommandEvent & )'
wrc.exe -q -r -fo=obj\Release\resource.res -iC:\wxMSW-2.9.0\include -iC:\wxMSW-2.9.0\lib\wat_dll\mswu -iC:\watcom\h -iC:\watcom\h\nt resource.rc
wcl386.exe -q -c -d__WXMSW__ -d__WINDOWS__ -d_WINDOWS -dWXUSINGDLL -dUNICODE -bm -br -bw -bt=nt -zq -xr -xs -wcd=549 -wcd=656 -wcd=657 -wcd=667 -wx -ox -ot -iC:\wxMSW-2.9.0\include -iC:\wxMSW-2.9.0\contrib\include -iC:\wxMSW-2.9.0\lib\wat_dll\mswu -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Release\TestApp.obj TestApp.cpp
wcl386.exe -q -l=nt -q -bt=nt -r /"LIBP C:\watcom\lib386" /"LIBP C:\watcom\lib386\nt" /"LIBP C:\wxMSW-2.9.0\lib\wat_dll" obj\Release\TestMain.obj obj\Release\TestApp.obj -fe=bin\Release\Test.exe wxmsw29u.lib obj\Release\resource.res
Process terminated with status 0 (0 minutes, 15 seconds)
0 errors, 4 warnings
I've uploaded a Patch in Berlios ([ Patch #1905 ] Bugfix and Improvements to OpenWatcom Support).
Please Note: I've added two new files in the compiler plugin (
src/plugins/compilergcc/compilerOWgenerator.cpp and
src/plugins/compilergcc/compilerOWgenerator.h) which are also included in the patch.
I've tested it in my PC and it works fine. This patch will fix a older bug posted in Berlios ([ Bug #8391 ] Linking directories with Open Watcom 1.5).
Regards,
Biplab
Sounds fine Biplab :).
also check this :
http://forums.next.codeblocks.org/index.php/topic,4876.msg38116.html#msg38116
I don't remember if I already changed it, but linker exe should be wlink.exe and not wcl386
Can you confirm ?
wcl386.exe can handle linking request, too. If you use
wlink.exe then the commands for linker has to be generated in a specific way which I have written in the first post. Though this is not very difficult, but the linker command generation has to be revamped in that case. :)
I'm putting some more test results. One for Console Application and another for Win32GUI app. Both of them compile and link perfectly with my changes. I've already posted build-log for a wxWidgets sample app.
Console Build-log:
Quote-------------- Build: Release in Test ---------------
wcl386.exe -q -c -wx -xs -ot -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Release\main.obj main.cpp
wcl386.exe -q /"LIBP C:\watcom\lib386" /"LIBP C:\watcom\lib386\nt" obj\Release\main.obj -fe=.\Test.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
Win32 GUI Build-log:
Quote-------------- Build: Debug in Test ---------------
wcl386.exe -q -c -wx -d2 -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Debug\main.obj main.cpp
main.cpp(69): Warning! W726: col(1) no reference to formal parameter 'hPrevInstance'
main.cpp(10): Note! N392: col(32) definition: 'void * hPrevInstance' in 'int stdcall WinMain( void *, void *, char *, int )'
main.cpp(69): Warning! W726: col(1) no reference to formal parameter 'lpszArgument'
main.cpp(11): Note! N392: col(28) definition: 'char * lpszArgument' in 'int stdcall WinMain( void *, void *, char *, int )'
wcl386.exe -q /"LIBP C:\watcom\lib386" /"LIBP C:\watcom\lib386\nt" obj\Debug\main.obj -fe=bin\Debug\Test.exe gdi32.lib user32.lib kernel32.lib
Process terminated with status 0 (0 minutes, 2 seconds)
0 errors, 4 warnings
I hope this can solve most of the issues with supporting OpenWatcom.
Regards,
Biplab :)
please do check and test if you can :
m_Programs.LD = wxT("wcl386.exe");
should be
m_Programs.LD = wxT("wlink.exe");
It really should be like that, but I haven't had time to check the options.
Maybe then that other option is no longer needed.
Feel free to email or PM me about it.
Always good it our compiler support improves. Thumbs up to Biplab ;-)
I think we should do it like that : link : use the linker, Those front end do all stuff are bad ideas, it's even a pure contradiction to object oriented programming and they always generate command line option conflicts ...
Quote from: killerbot on February 27, 2007, 11:25:29 AM
please do check and test if you can :
m_Programs.LD = wxT("wcl386.exe");
should be
m_Programs.LD = wxT("wlink.exe");
I didn't get you exactly. Are you asking me to change linker to
wlink.exe and then test it? :)
IMHO, that'll take us to override in the following functions.
- CompilerCommandGenerator::SetupLibrariesDirs
- CompilerCommandGenerator::SetupLinkerOptions
- CompilerCommandGenerator::SetupLinkLibraries
And also some other functions. This will take some time. :)
Thus I changed it to -
/"LIBP <Lib_Dir>The following command will also work perfectly with
wcl386.exe -
-"LIBP <Lib_Dir>" :D
yes, that was my question.
Do we really need those overrides. There are other compilers that also have a different exe for linking (MS ?) ...
If I recall there was also an issue when you wanted to add several dirs ? Those that LIBP allow multiple dirs ?
Thanks for the clarification.
Quote from: killerbot on February 27, 2007, 12:07:44 PM
Do we really need those overrides. There are other compilers that also have a different exe for linking (MS ?) ...
I believe partly its necessary. E.g.,
wlink.exe will not take
-q command rather we have to supply,
option quiet. So we need to map some of the common options to it's equivalent options in wlink.
But I also believe that it won't be difficult to switch to
wlink.exeQuote from: killerbot on February 27, 2007, 12:07:44 PM
If I recall there was also an issue when you wanted to add several dirs ? Those that LIBP allow multiple dirs ?
AFAIK, Multiple directories can be specified with multiple
LIBP or
/"LIBP <Lib_Dir1>;<Lib_Dir2>;<Lib_Dir3>". So it can take multiple directories. :)
@Killerbot & Mandrav,
Here is the latest changes. I've updated compiler plugin to use
wlink.exe instead of
wcl386.exe. I've successfully compiled Win32 GUI App, wxWidgets App. I'm attaching the build-logs. :D
Win32 GUI App:
Quote-------------- Build: Release in TestWin ---------------
wcl386.exe -q -c -wx -ot -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Release\main.obj main.cpp
main.cpp(69): Warning! W726: col(1) no reference to formal parameter 'hPrevInstance'
main.cpp(10): Note! N392: col(32) definition: 'void * hPrevInstance' in 'int stdcall WinMain( void *, void *, char *, int )'
main.cpp(69): Warning! W726: col(1) no reference to formal parameter 'lpszArgument'
main.cpp(11): Note! N392: col(28) definition: 'char * lpszArgument' in 'int stdcall WinMain( void *, void *, char *, int )'
wlink.exe option quiet system nt_win ref '_WinMain@16' LIBP C:\watcom\lib386 LIBP C:\watcom\lib386\nt file obj\Release\main.obj name bin\Release\TestWin.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 4 warnings
wxWidgets App:
Quote-------------- Build: Release in Test ---------------
wcl386.exe -q -c -d__WXMSW__ -d__WINDOWS__ -d_WINDOWS -dWXUSINGDLL -dUNICODE -bm -br -bt=nt -zq -xr -xs -wcd=549 -wcd=656 -wcd=657 -wcd=667 -wx -ot -ox -iC:\wxMSW-2.9.0\include -iC:\wxMSW-2.9.0\contrib\include -iC:\wxMSW-2.9.0\lib\wat_dll\mswu -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Release\TestMain.obj TestMain.cpp
TestMain.cpp(86): Warning! W726: col(1) no reference to formal parameter 'event'
TestMain.cpp(83): Note! N392: col(39) definition: 'wxCloseEvent & event' in 'void TestFrame::OnClose( wxCloseEvent & )'
TestMain.cpp(91): Warning! W726: col(1) no reference to formal parameter 'event'
TestMain.cpp(88): Note! N392: col(40) definition: 'wxCommandEvent & event' in 'void TestFrame::OnQuit( wxCommandEvent & )'
TestMain.cpp(97): Warning! W726: col(1) no reference to formal parameter 'event'
TestMain.cpp(93): Note! N392: col(41) definition: 'wxCommandEvent & event' in 'void TestFrame::OnAbout( wxCommandEvent & )'
wrc.exe -q -r -fo=obj\Release\resource.res -iC:\wxMSW-2.9.0\include -iC:\wxMSW-2.9.0\lib\wat_dll\mswu -iC:\watcom\h -iC:\watcom\h\nt resource.rc
wcl386.exe -q -c -d__WXMSW__ -d__WINDOWS__ -d_WINDOWS -dWXUSINGDLL -dUNICODE -bm -br -bt=nt -zq -xr -xs -wcd=549 -wcd=656 -wcd=657 -wcd=667 -wx -ot -ox -iC:\wxMSW-2.9.0\include -iC:\wxMSW-2.9.0\contrib\include -iC:\wxMSW-2.9.0\lib\wat_dll\mswu -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Release\TestApp.obj TestApp.cpp
wlink.exe option quiet system nt_win ref '_WinMain@16' LIBP C:\watcom\lib386 LIBP C:\watcom\lib386\nt LIBP C:\wxMSW-2.9.0\lib\wat_dll file obj\Release\TestMain.obj file obj\Release\TestApp.obj name bin\Release\Test.exe library wxmsw29u.lib option resource=obj\Release\resource.res
Process terminated with status 0 (0 minutes, 13 seconds)
0 errors, 6 warnings
Please remember that the changes have been applied only to
Win32 Apps.
Console apps are NOT supported yet. Currently this is hard-coded and I'll change it later.
So we can move toward supporting OpenWatcom with
wlink.exe :D
I'm leaving lab so I won't be able to make any further changes till tomorrow morning. But I'll be available for discussion.
I'm sorry I couldn't complete creating patch. So I can't post it right now.
BTW, if you want the compiled binary to test please post, I'll upload it somewhere. :)
The compiled binary will ship with latest wxWidgets wizard supporting OpenWatcom. ;)
Regards,
Biplab
Latest Update:
Now Console App, DLL App, Win32 App are supported. Only
-d2 option is supported, though there are other debug related options but they are not mapped yet.
Test Results:
Command Line App:
Quote-------------- Build: Debug in TestConsole ---------------
wcl386.exe -q -c -wx -xs -d2 -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Debug\main.obj main.cpp
wlink.exe option quiet debug watcom all LIBP C:\watcom\lib386 LIBP C:\watcom\lib386\nt file obj\Debug\main.obj name .\TestConsole.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
-------------- Build: Release in TestConsole ---------------
wcl386.exe -q -c -wx -xs -ot -ox -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Release\main.obj main.cpp
wlink.exe option quiet system nt LIBP C:\watcom\lib386 LIBP C:\watcom\lib386\nt file obj\Release\main.obj name .\TestConsole.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
Win32 App:
Quote-------------- Build: Debug in TestWin ---------------
wcl386.exe -q -c -wx -d2 -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Debug\main.obj main.cpp
main.cpp(69): Warning! W726: col(1) no reference to formal parameter 'hPrevInstance'
main.cpp(10): Note! N392: col(32) definition: 'void * hPrevInstance' in 'int stdcall WinMain( void *, void *, char *, int )'
main.cpp(69): Warning! W726: col(1) no reference to formal parameter 'lpszArgument'
main.cpp(11): Note! N392: col(28) definition: 'char * lpszArgument' in 'int stdcall WinMain( void *, void *, char *, int )'
wlink.exe option quiet debug watcom all LIBP C:\watcom\lib386 LIBP C:\watcom\lib386\nt file obj\Debug\main.obj name bin\Debug\TestWin.exe library gdi32 library user32 library kernel32
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 4 warnings
-------------- Build: Release in TestWin ---------------
wcl386.exe -q -c -wx -ot -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Release\main.obj main.cpp
main.cpp(69): Warning! W726: col(1) no reference to formal parameter 'hPrevInstance'
main.cpp(10): Note! N392: col(32) definition: 'void * hPrevInstance' in 'int stdcall WinMain( void *, void *, char *, int )'
main.cpp(69): Warning! W726: col(1) no reference to formal parameter 'lpszArgument'
main.cpp(11): Note! N392: col(28) definition: 'char * lpszArgument' in 'int stdcall WinMain( void *, void *, char *, int )'
wlink.exe option quiet system nt_win LIBP C:\watcom\lib386 LIBP C:\watcom\lib386\nt file obj\Release\main.obj name bin\Release\TestWin.exe library gdi32 library user32 library kernel32
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 4 warnings
DLL:
Quote-------------- Build: Release in TestDLL ---------------
wcl386.exe -q -c -wx -ot -iC:\watcom\h -iC:\watcom\h\nt -fo=obj\Release\main.obj main.cpp
main.cpp(37): Warning! W726: col(1) no reference to formal parameter 'hinstDLL'
main.cpp(15): Note! N392: col(31) definition: 'void * hinstDLL' in 'int stdcall DllMain( void *, unsigned long, void * )'
main.cpp(37): Warning! W726: col(1) no reference to formal parameter 'lpvReserved'
main.cpp(15): Note! N392: col(65) definition: 'void * lpvReserved' in 'int stdcall DllMain( void *, unsigned long, void * )'
wlink.exe option quiet LIBP C:\watcom\lib386 LIBP C:\watcom\lib386\nt name .\TestDLL.dll file obj\Release\main.obj system nt_dll
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 4 warnings
Debug Target is not linking properly.
There are number of compiler options to be mapped to be mapped properly.