Page 1 of 1

Resource compilation under Linux problem.

Posted: Tue Jan 27, 2009 2:57 pm
by Sergey
Hello all.
I'm trying to compile resource file under Linux (Linux-hosted cross-compilation). Without resource file my project builds perfect. But when I connect resource file I take the message:
make: *** No rule to build target `Win32Release/resource.o'. Stopped. (in Russian).
But file resource.rc perfectly compiles from command shell.

Build Settings:
Resource Compiler: i586-mingw32msvc-windres
File Types: rc --- Resource --- $(RcCompilerName) -i "$(FileFullPath)" $(RcCmpOptions) $(ObjectSwitch)$(IntermediateDirectory)/$(FileFullName)$(ObjectSuffix) $(RcIncludePath)

Project Settings, Resource tab:
Compiler Options: $(shell wx-config --prefix=/usr/i586-mingw32msvc --host=i586-mingw32msvc)
Additional Search Path: /usr/i586-mingw32msvc/include/wx-2.8

So, I need help with problem. As I understand CodeLite don't recognize mesher.rc as resource file.

Sergey.

Re: Resource compilation under Linux problem.

Posted: Tue Jan 27, 2009 3:34 pm
by eranif
You are correct, I for some reason made an assumption that the resource compiler & Linux can not co-exist ...

I see this line in builder_gnumake.cpp, 547:

Code: Select all

} else if (ft.kind == Compiler::CmpFileKindResource && bldConf->IsResCompilerRequired() && OS_WINDOWS ) {
Which means, that a rule for the resource compiler will be added to the makefile only when the above condition is met.

I will fix this in SVN trunk.

A workaround:
use the 'Custom Makefile Steps' and fill in the page project settings -> custom makefile steps
Fill the page like this:

Dependencies:

Code: Select all

$(IntermediateDirectory)/resource.o
Rule action:

Code: Select all

resource.rc:
<TAB>$(RcCompilerName) -i "$(FileFullPath)" $(RcCmpOptions) $(ObjectSwitch)$(IntermediateDirectory)/resource.o $(RcIncludePath) 
the above will add a makefile rule to compile your resource file once the resource.rc is modified

Eran

Re: Resource compilation under Linux problem.

Posted: Tue Jan 27, 2009 11:28 pm
by Sergey
Hello Eran.
Now resource.rc are compiled and and generated resource.o but resource.o doesn't take put in linkage. CodeLite show next link line:
i586-mingw32msvc-g++ -o ./Win32Release/Mesher.exe ./Win32Release/evaluation.o ./Win32Release/parserevaluation.o ./Win32Release/binary.o ./Win32Release/parser.o ./Win32Release/tree.o ./Win32Release/unary.o ./Win32Release/variable.o ./Win32Release/mesher_app.o ./Win32Release/mesher_frame.o ./Win32Release/prefs.o ./Win32Release/wxnumbertextctrl.o ./Win32Release/meshpicture.o ./Win32Release/trackball.o ./Win32Release/gui_calcfunction.o ./Win32Release/calcfunctiondialog.o ./Win32Release/mesh2d.o ./Win32Release/mesh2dadaptive.o ./Win32Release/mesh2duniform.o ./Win32Release/mesh2dzones.o ./Win32Release/point2d.o ./Win32Release/vector2d.o ./Win32Release/mesh3d.o ./Win32Release/mesh3duniform.o ./Win32Release/point3d.o ./Win32Release/vector3d.o ./Win32Release/mesh.o ./Win32Release/mesh_utils.o "-L/usr/i586-mingw32msvc/lib/" -lwx_mswu_gl-2.8-i586-mingw32msvc -lwx_mswu_stc-2.8-i586-mingw32msvc -lopengl32 -lglu32 -O2 -mthreads -Wl,--subsystem,windows -mwindows /usr/i586-mingw32msvc/lib/libwx_mswu-2.8-i586-mingw32msvc.a -lwxregexu-2.8-i586-mingw32msvc -lwxexpat-2.8-i586-mingw32msvc -lwxtiff-2.8-i586-mingw32msvc -lwxjpeg-2.8-i586-mingw32msvc -lwxpng-2.8-i586-mingw32msvc -lwxzlib-2.8-i586-mingw32msvc -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32

In the make file I see next line:

Code: Select all

##
## Main Build Tragets 
##
all: $(OutputFile)

$(OutputFile): makeDirStep PrePreBuild $(Objects)
	@mkdir -p $(@D)
	$(LinkerName) $(OutputSwitch)$(OutputFile) $(Objects) $(LibPath) $(Libs) $(LinkOptions)

makeDirStep:
	@test -d ./Win32Release || mkdir -p ./Win32Release
PrePreBuild: $(IntermediateDirectory)/resource$(ObjectSuffix)
$(IntermediateDirectory)/resource$(ObjectSuffix): 
	$(RcCompilerName) -i "/home/sergey/QHMesher/resource.rc" $(RcCmpOptions) $(ObjectSwitch)$(IntermediateDirectory)/resource$(ObjectSuffix) $(RcIncludePath)
Can I add resource.o to linkage line?

Re: Resource compilation under Linux problem.

Posted: Tue Jan 27, 2009 11:52 pm
by eranif
Yes, i forgot to mention that:

in the linker tab (project settings -> linker -> options)
add your resource object:

Code: Select all

;./Win32Release/resource.o
Eran