Compiling the 64bit version using VS2008 cross compiler

Hello,

I noticed there is a problem with the 3rd party libraries (TBB, FreeImage, gl2ps) when compiling OCCT 6.5.1 for 64bit with VS2008 cross compiler on 32bit WinXP. Apparently, the mentioned libs do not get linked against.

This is what I do:
- I use the 'msvc.bat vc9 win64_on32 Release adm\win64\vc9\OCCT.sln' command to start VS
- 'win64_on32' configures the cross compiler through 'env_build.bat':
set ARCH=64
set TBBARCH=intel64
set VCARCH=x86_amd64
- 'set CSF_DEFINES=HAVE_TBB;HAVE_FREEIMAGE;HAVE_GL2PS' is NOT commented out in env_build.bat
- I compile OCCT

To my surprise, the output libraries are not linked against the 3rd party libs (e.g. TKernel.dll does not depend on tbbmalloc.dll).

This is strange because when I compile the same version for 32bit it all goes well. It all goes well when I compile on a 64bit system too.

With 'Process Explorer' I can also see that CSF_DEFINES was properly set for VS so I'm pretty sure that the environment is configured properly.

So something is missing about the cross compiler configuration. Does any one have an idea what that might be?

For example, TBB is linked using the following code:

#if _MSC_VER
#if __TBB_BUILD && !defined(__TBBMALLOC_NO_IMPLICIT_LINKAGE)
#define __TBBMALLOC_NO_IMPLICIT_LINKAGE 1
#endif

#if !__TBBMALLOC_NO_IMPLICIT_LINKAGE
#ifdef _DEBUG
#pragma comment(lib, "tbbmalloc_debug.lib")
#else
#pragma comment(lib, "tbbmalloc.lib")
#endif
#endif
#endif

Could this be that _MSC_VER is not defined or something?

Pawel

Forum supervisor's picture

Dear Pawel,
Probably path to these libs are incorrect or missing.
Check, please properties of TKernel project (.../Additional Library Directories).
Regards

Pawel's picture

I think I found the problem.

In 'env_build.bat' there is a workaround section for VS2010:

rem Workaround for problems of building by VS2010 in 64 bit mode
if /I "%VCVER%" == "vc10" (
if "%ARCH%" == "64" (
set "PATH=%VS100COMNTOOLS%..\..\VC\bin\x86_amd64;%PATH%"
)
echo Attention: If you get problem during compilation with embedding manifests
echo ^(mt.exe^), try building ^(not rebuilding^) for the second time
)

A similar section is needed for VS2008.

By the way, this workaround works for a 64bit build made on a 32bit machine with a cross compiler and is probably not needed (at least not for VS2008) if you build on a 64bit machine.

Pawel