Problems compiling blender with MS Visual Studio .NET

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
nyoxi
Posts: 0
Joined: Fri Jul 25, 2003 8:14 pm

Problems compiling blender with MS Visual Studio .NET

Post by nyoxi »

I cannot compile blender with MSVS .NET. Does somebody have the same problems?

The problem is that relative paths are written as
$(SolutionDir)source\blender\.....
but the variable "SolutionDir" is omitted whien building absolute paths. Then compilere tries to reference files this way
c:\sources\blender\bf-blender\blender\make\msvc_7_0\blender\blenkernel\source\blender\blenkernel\intern\action.c
insead of
c:\sources\blender\bf-blender\blender\source\blender\blenkernel\intern\action.c

EvilEngel
Posts: 6
Joined: Wed Oct 16, 2002 1:09 am

Post by EvilEngel »

It seems to me that you opened the blender.vcproj directly, instead of the blender.sln in the base directory. It's hard to tell, could you tell me exactly what you did? If you want to talk on AIM or Yahoo Messenger, let me know.

nyoxi
Posts: 0
Joined: Fri Jul 25, 2003 8:14 pm

Post by nyoxi »

No, I opened the blender.sln file. The SolutionDir variable is set correctly (I verified this through Project properties.

After a while of disappointment I opened the blender.dsw project (but this is not the solution!) and it works well (but not so exactly).

The first think I had to do was to make some change to python-freeze (I'm using Python 2.2.2)
at first I had to change
import regex
to
import re as regex
in parsesetup.py and makeconfig.py files, because regex was renamed to re

then I had to add -D parameter into freeze.py invaction, because the script was looking for diectory C:\Python22\lib\python2.2\config which doesn't exist.

And the last thing to the python-freeze - it reports error
The win32api module is not available - modules listed in the registry will not be found.
than I had to add include path to inter\SoundSystem into some projects

And finaly the errors I didn't solved till now:
I'm missing files QTML.h, SND_C-api.h, Movies.h and FixMath.h
I receive an error:

Code: Select all

C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xmemory(87) : error C2535: 'std::allocator<_Ty>::pointer std::allocator<_Ty>::address(std::allocator<_Ty>::reference) const' : member function already defined or declared
        with
        [
            _Ty=const std::_Tree<std::_Tmap_traits<const STR_String,CValue *,std::less<const STR_String>,std::allocator<std::pair<const STR_String,CValue *>>,false>>::key_type
        ]
        C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xmemory(81) : see declaration of 'std::allocator<_Ty>::address'
        with
        [
            _Ty=const std::_Tree<std::_Tmap_traits<const STR_String,CValue *,std::less<const STR_String>,std::allocator<std::pair<const STR_String,CValue *>>,false>>::key_type
        ]
        C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(122) : see reference to class template instantiation 'std::allocator<_Ty>' being compiled
        with
        [
            _Ty=const std::_Tree<std::_Tmap_traits<const STR_String,CValue *,std::less<const STR_String>,std::allocator<std::pair<const STR_String,CValue *>>,false>>::key_type
        ]
        C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\map(77) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
        with
        [
            _Traits=std::_Tmap_traits<const STR_String,CValue *,std::less<const STR_String>,std::allocator<std::pair<const STR_String,CValue *>>,false>
        ]
        \sources\blender\bf-blender\blender\source\gameengine\Expressions\Value.cpp(287) : see reference to class template instantiation 'std::map<_Kty,_Ty,_Pr,_Alloc>' being compiled
        with
        [
            _Kty=const STR_String,
            _Ty=CValue *,
            _Pr=std::less<const STR_String>,
            _Alloc=std::allocator<std::pair<const STR_String,CValue *>>
        ]
I must say that this is not an easy task to compile Blender :? Is it some kind of test? :lol:

EvilEngel
Posts: 6
Joined: Wed Oct 16, 2002 1:09 am

Post by EvilEngel »

heh, heh. No, it's not easy. :)
I want to help you 'cause I went through a lot of headache to get it to compile just a few days ago. Basically, MANY include/lib paths in the project files have to be changed.
All the SND_*.h files are now in $(SolutionDir)intern\SoundSystem, but they used to be in the gameengine directory, and many projects don't have the change.
I encourage you to open the blender.sln file and modify the project files.
Even better, I can email you the project files I already modified (I don't have write access to CVS). We have to get somebody to commit those changes.

The QTML and Movies header files belong to the QuickTime SDK, which you have to download. Last time I was there, the apple developers pages did not have the QuickTime SDK in zip format, only .hqx. If you don't find it in the internet I can send it to you. There are #defines that contro whether to compile with Quicktime support.

After that, I had to add another preprocessor variable to tell the code to compile FTGL as a static library instead of a .dll, and minor changes to the code elsewhere

Hang in there, I can help you with that once I"m back at my work. And maybe we can help each other to find the right guy to commit these changes :)

nyoxi
Posts: 0
Joined: Fri Jul 25, 2003 8:14 pm

Post by nyoxi »

Ok, I try to download the QuickTime SDK and see what else can I do to make the Blender compile.

Yeah, and submiting changes to CVS is a good idea. Those who come after use, will not have to solve this problems again and again.

SirDude
Posts: 233
Joined: Sun Oct 13, 2002 7:37 pm
Location: University of Minnesota (USA)
Contact:

Post by SirDude »

You guys can email me directly and or the bf-committers
mailling list and we'll put them in cvs.

thornae
Posts: 44
Joined: Mon Nov 04, 2002 11:53 am

Post by thornae »

...And now, for bonus geek-points, get it running in Mono! 8)
...because I can!

mtr
Posts: 0
Joined: Tue Jul 29, 2003 4:40 pm

Post by mtr »

I have FINALLY got Blender 2.28 to compile in MSCV7. I want to do another dry run through starting with the blender2.28.tar.gz to make sure I have documented every single change.

However, I have not included Quicktime, so I've removed the WITH_QUICKTIME from projects where it is referenced.

Python: I have a completely different of fixes to you! Scary or what.

The compilation error above reported by 'nyexi' are due to the declaration const in the value.c file in the EXP_Expressions project - MSCV7 can't handle this, and I don't know what is correct behaviour. I just put #define const
before the new std::map<const String, CVlaue *> line and
#undef const
afterwards.

When I have got a set of .sln and .vcproj files I am happy with, shall I send them to SirDude?

Martin

nyoxi
Posts: 0
Joined: Fri Jul 25, 2003 8:14 pm

Post by nyoxi »

Hi,

It seems to me that it will be best to recreate the solution and vcproject from the biginning. Do you thing that we can handle this? I know it's lot of work, but I we connect our forces we can do it, don't we?

:shock: It's horrible, after I solved almost all problems with compilation I encourted problems with linking. Some libraries have extension .lib instead of .a and there are many unresolved externals because some libraries are missing in the list of input libraries.

And I'm missing one .c file and .tlb file.
mtr wrote:reported by 'nyexi'
Hey, I'm nyoxi :)

EvilEngel
Posts: 6
Joined: Wed Oct 16, 2002 1:09 am

Post by EvilEngel »

nyoxi. I got the 'blender' project to compile, with many library/include directories changed, I saw the issues you mentioned. The fact that you mentioned the .tlb tells me that you're trying to rebuild the whole solution. The .tlb is only generated in the ActiveX plugin for Blender, I believe, which I'm not even compiling, but I fixed that one error too. There's one .old file that needs to be compiled into a .tlb (type library), so you have to specify that in its properties. Other errors show up anyway :)

the project blender is the actual blender.exe program, and that's the only want I want to build. A lot of the dependencies to the required libraries, are missing, so they have to be added.

I can only play with Visual Studio in the office, since I only have Linux at home. So it won't be until monday that I can play with this again. Maybe then I can send you a patch file ( can you apply unix patch files to your source tree?) with my changes to see if they help you.

I already tried to send the first one of a number of patches to the bf-committers mailing list to help solve this problem, and I got the nastiest response... I guess I'm not used to open source projects. Oh, well. I'll keep trying.

nyoxi
Posts: 0
Joined: Fri Jul 25, 2003 8:14 pm

Post by nyoxi »

Yeah, I forgot to tell you the happy news. On saturday morning I finaly compiled the blender and it works good.
EvilEngel wrote:The .tlb is only generated in the ActiveX plugin for Blender
You are right, I knew that so I didn't compile the ActiveX in the end.

But the problem is still here. It'll be good to recreate the solution and projects, because tomorow can come sombody else who will have to solve this problems again, and another one will come after him, ... And I think this is not good.

peepsalot
Posts: 0
Joined: Fri Oct 03, 2003 3:44 am

Post by peepsalot »

nyoxi:
I'm getting the same huge error about xmemory that you wrote at the beginning of this post. Could you tell me how you resolved that problem? As far as I can tell, Visual Studio has a file named xmemory, and blender has one also. I just can't figure out how to make Visual Studio use the blender source instead.

peepsalot
Posts: 0
Joined: Fri Oct 03, 2003 3:44 am

Post by peepsalot »

aw forget it. I just commented out the offending lines in the Visual Studio file. I won't be needing those any time soon

mtr
Posts: 0
Joined: Tue Jul 29, 2003 4:40 pm

Post by mtr »

As I said in my post, it's because of the lines (in .h and .c) for

Code: Select all

std::map<const String, CValue*>
I think the MSVC7 C++ compiler can't handle the const. If you remove it, comment it out, or temporarily #define const, it compiles ok.

Martin

Post Reply