Page 1 of 2

How to compile a Linux project under Windows

Posted: Tue Nov 19, 2013 5:37 pm
by matbru
Hello,

I have developped a GUI app (simple wxFrame) under Linux.

The Project directory is on a NTFS partition that is both read/writable under Linux and Windows 7 (my computer has a dual boot).

I have installed CodeLite 5.3 on both OS.

Under Linux, the application compiles and runs without problem.

Under Windows, I cannot compile the Project:
mingw32-make.exe[1]: *** No rule to make target `/data/codelite/GonflageGUI/gui.cpp', needed by `Debug/gui.o'. Stop.
I am puzzled that the make process uses the pathname of my Linux ('/data/codelite/GonflageGUI/') even though the .mk file has been automatically rewritten to adapt to Windows system (

Code: Select all

ProjectPath            := "D:\codelite\GonflageGUI"
)

Re: How to compile a Linux project under Windows

Posted: Tue Nov 19, 2013 6:30 pm
by eranif
Where does the .project and .workspace ? are they also on the same drive?

Eran

Re: How to compile a Linux project under Windows

Posted: Wed Nov 20, 2013 6:02 pm
by Jarod42
Do you use the same 'configuration' ? (or do you have DEBUG_UNIX, DEBUG_WINDOWS, ...)
Have you try to rebuild ?
I suspect that dependencies (.d files) still reference with unix path.

Re: How to compile a Linux project under Windows

Posted: Mon Nov 25, 2013 9:09 pm
by matbru
eranif wrote:Where does the .project and .workspace ? are they also on the same drive?

Eran
Hi Eran,

The .project is on the same folder (on the common partition).

I have two .workspace files: one on my Linux ~/.codelite/ folder (in a Linux-only partition).

But when I use Codelite on Windows the .workspace that is used is on the same shared NTFS drive.
Is that wrong?
Jarod42 wrote:Do you use the same 'configuration' ? (or do you have DEBUG_UNIX, DEBUG_WINDOWS, ...)
Hi Jarod42,
I use the same configuration: I have not edited the project setting under Windows, if this is what you mean.
Nonetheless, CodeLite has been smart enough to automatically update the ProjectPath in the .mk file (as I mentioned in my initial post).
Jarod42 wrote:Have you try to rebuild ?
I suspect that dependencies (.d files) still reference with unix path.
Yes, cleaning and rebuilding has no effect: I get the same error.

Re: How to compile a Linux project under Windows

Posted: Tue Nov 26, 2013 11:29 am
by eranif
All your files ( source files + workspace + project ) _must_ exist on the same drive. If they are not - it will not work


Eran

Re: How to compile a Linux project under Windows

Posted: Tue Nov 26, 2013 4:47 pm
by matbru
Hello,

From my Linux, I have created a new workspace in a folder on the common drive (/data/codelite/NewWorkspace = D:\codelite\NewWorkspace).
I have imported my project into that workspace (all files were already located on the common folder in D:\codelite\GonflageGUI).

I have compiled and run the project with no problem.

When I reboot and launch CodeLite on Windows 7, I get the same error on compiling the project, even though I used my project through the new workspace which file is indeed on the common drive.
C:\Windows\system32\cmd.exe /c "mingw32-make.exe -j 4 -e -f Makefile"
"----------Building project:[ GonflageGUI - Debug ]----------"
wx-config Warning: Multiple compiled configurations of wxWidgets have been detected.
Using first detected version by default.

Please use the --wxcfg flag (as in wx-config --wxcfg=gcc_dll/mswud)
or set the environment variable WXCFG (as in WXCFG=gcc_dll/mswud)
to specify which configuration exactly you want to use.
mingw32-make.exe[1]: Entering directory `D:/codelite/GonflageGUI'
mingw32-make.exe[1]: *** No rule to make target `/data/codelite/GonflageGUI/gui.cpp', needed by `Debug/gui.o'. Stop.
mingw32-make.exe[1]: *** Waiting for unfinished jobs....
mingw32-make.exe: *** [All] Error 2
mingw32-make.exe[1]: Leaving directory `D:/codelite/GonflageGUI'
Makefile:4: recipe for target `All' failed
0 errors, 0 warnings
The workspace file is D:\codelite\NewWorkspace\NewWorkspace.workspace
The project file is D:\codelite\GonflageGUI\GonflageGUI.project
And all the source files are in D:\codelite\GonflageGUI

All of them located on the same drive.

Thanks for your help.

Re: How to compile a Linux project under Windows

Posted: Tue Nov 26, 2013 4:54 pm
by eranif
What happens when you delete the Makfile located under the workspace folder?
Eran

Re: How to compile a Linux project under Windows

Posted: Tue Nov 26, 2013 5:26 pm
by matbru
Hello,

Under Cygwin, using a command:
find . -type f | xargs grep '/data/'

I realized that I had main.o.d and gui.o.d files that contained references to my Unix pathnames.
I do not understand what happened (not) to these files when I cleaned and rebuilt (I will redo the test next time I boot under Linux).

Having removed these files seems to allow me to go further.

Yet, I have new errors when I try to compile.

Code: Select all

C:\Windows\system32\cmd.exe /c "mingw32-make.exe -j 4 -e -f  Makefile"
"----------Building project:[ GonflageGUI - Release ]----------"
wx-config Warning: Multiple compiled configurations of wxWidgets have been detected.
Using first detected version by default.

Please use the --wxcfg flag (as in wx-config --wxcfg=gcc_dll/mswud)
or set the environment variable WXCFG (as in WXCFG=gcc_dll/mswud)
to specify which configuration exactly you want to use.
mingw32-make.exe[1]: Entering directory `D:/codelite/GonflageGUI'
g++: error: /MT: No such file or directory
g++: error: /DWIN32: No such file or directory
g++: error: /D__NO_VC_CRTDBG__: No such file or directory
g++: error: /D__WXMSW__: No such file or directory
g++: error: /D_UNICODE: No such file or directory
g++: error: /DwxUSE_GRAPHICS_CONTEXT=1: No such file or directory
g++: error: /IC:/SourceCode/Libraries/wxWidgets2.8/lib/vc_lib/mswu: Invalid argument
g++: error: /IC:/SourceCode/Libraries/wxWidgets2.8/include: Invalid argument
g++: error: /D_WINDOWS: No such file or directory
g++: error: /GR: No such file or directory
g++: error: /EHsc: No such file or directory
g++: error: /MT: No such file or directory
g++: error: /DWIN32: No such file or directory
g++: error: /D__NO_VC_CRTDBG__: No such file or directory
g++: error: /D__WXMSW__: No such file or directory
g++: error: /D_UNICODE: No such file or directory
g++: error: /DwxUSE_GRAPHICS_CONTEXT=1: No such file or directory
g++: error: /IC:/SourceCode/Libraries/wxWidgets2.8/lib/vc_lib/mswu: Invalid argument
g++: error: /IC:/SourceCode/Libraries/wxWidgets2.8/include: Invalid argument
g++: error: /D_WINDOWS: No such file or directory
g++: error: /GR: No such file or directory
g++: error: /EHsc: No such file or directory
mingw32-make.exe[1]: *** [Release/main.o.d] Error 1
mingw32-make.exe[1]: *** Waiting for unfinished jobs....
mingw32-make.exe[1]: *** [Release/gui.o.d] Error 1
GonflageGUI.mk:104: recipe for target `Release/main.o.d' failed
GonflageGUI.mk:96: recipe for target `Release/gui.o.d' failed
mingw32-make.exe[1]: Leaving directory `D:/codelite/GonflageGUI'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target `All' failed
0 errors, 0 warnings
I guess it has to see with a confusion between '/' and '-' but I do not know how to fix this.

Thanks.

Re: How to compile a Linux project under Windows

Posted: Tue Nov 26, 2013 5:50 pm
by eranif
You need to create different configurations for Linux and windows.
Mainly create different intermediate folders.
GCC places the dependencies files in those folders.
Eran

Re: How to compile a Linux project under Windows

Posted: Thu Dec 12, 2013 3:39 am
by stahta01

Code: Select all

g++: error: /MT: No such file or directory
g++: error: /DWIN32: No such file or directory
g++: error: /D__NO_VC_CRTDBG__: No such file or directory
g++: error: /D__WXMSW__: No such file or directory
The above implies that something thinks its using MSVC options.
I would guess wx-config is the cause I suggest doing the suggest fix of defining WXCFG as suggested.
I would test in on the command line to verify that wx-config --cflags returns the correct flags for gcc instead for MSVC.

NOTE: I am once more trying out CodeLite to see if it works for me; I am a absolute beginners on CodeLite.
But, I have used wx-config many times.

Tim S.