Author Topic: Activate MSVC 8 Compiler on Linux  (Read 12882 times)

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Activate MSVC 8 Compiler on Linux
« on: January 01, 2008, 04:58:19 pm »
Hi

I'm trying to activate the MSVC 8 Compiler in Codeblocks on my Debian/Lenny Box.

I tried to compile the Plugin with VC8 Support by commenting out

#ifdef __WXMSW__

but I still can't find the Compiler in settings->Compiler dialog

This is actual SVN r4764.

The Makefile seems to contain the necessary .cpp file so this shouldn't matter.

I added some extra effort and libcompiler now build with MSVC8 enabled.

Diff is attached but nothing too surprising.


EDIT://
It is working :)
The new patch is attached. It has to be applied at src/plugin/compilergcc/
I'm trying to test this setup.
Are you interested in an wiki entry about Cross Compiling on Linux using MSVC8?

[attachment deleted by admin]
« Last Edit: January 01, 2008, 06:01:20 pm by darthdespotism »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Activate MSVC 8 Compiler on Linux
« Reply #1 on: January 01, 2008, 09:39:04 pm »
you run MSVC8 on linux ???  :shock: :shock: :shock:

Tell me everything !!!

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: Activate MSVC 8 Compiler on Linux
« Reply #2 on: January 02, 2008, 01:46:38 am »
you run MSVC8 on linux ???  :shock: :shock: :shock:

Tell me everything !!!

jajaja that was my impression too!!!  :lol:

Offline AmR EiSa

  • Multiple posting newcomer
  • *
  • Posts: 75
Re: Activate MSVC 8 Compiler on Linux
« Reply #3 on: January 02, 2008, 07:40:26 am »
WineHQ can Run MSVC 8 and have bugs for .net setup, how u do that, f u do it?

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: Activate MSVC 8 Compiler on Linux
« Reply #4 on: January 02, 2008, 11:37:59 am »
I did not try the IDE because I have codeblocks ;) but compiler & linker seem to work yust fine. I had tried this some time ago an as I found the AppDB entry I retried and succeded. Currently I'm testing this setup an having codeblocks for this is quite nice ;)

I can build in Releasemode actually as /DEBUG is actually not working but for crosscompiling this is quite nice (also it's usefullness is limited by having MinGW crosscompiler installed)

Ah yes I had Visual Studio Express installed on my Win Partition so I could simply copy the files.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Activate MSVC 8 Compiler on Linux
« Reply #5 on: January 02, 2008, 12:49:40 pm »
could you post a detailed step by step guide, I really want to try this  :P :P :P

PS : I looked at your patch, but there a  few little things :
- some things sems to be unchanged although the patch claims something has changed
Quote
-    // Read the VCToolkitInstallDir environment variable
-    wxGetEnv(_T("VS90COMNTOOLS"), &m_MasterPath);
-    if(m_MasterPath.IsEmpty())
-    {
-        wxGetEnv(_T("VS80COMNTOOLS"), &m_MasterPath);
-    }
+    // Read the VCToolkitInstallDir environment variable
+    wxGetEnv(_T("VS90COMNTOOLS"), &m_MasterPath);
+    if(m_MasterPath.IsEmpty())
+    {
+        wxGetEnv(_T("VS80COMNTOOLS"), &m_MasterPath);
+    }



-        m_MasterPath = Programs + _T("\\Microsoft Visual Studio 9.0\\VC");
-        idepath = Programs + _T("\\Microsoft Visual Studio 9.0\\Common7\\IDE");
-        if(!wxDirExists(m_MasterPath))
-        {
+        m_MasterPath = Programs + _T("\\Microsoft Visual Studio 9.0\\VC");
+        idepath = Programs + _T("\\Microsoft Visual Studio 9.0\\Common7\\IDE");
+        if(!wxDirExists(m_MasterPath))
+        {
             m_MasterPath = Programs + _T("\\Microsoft Visual Studio 8\\VC");
-            idepath = Programs + _T("\\Microsoft Visual Studio 8\\Common7\\IDE");
+            idepath = Programs + _T("\\Microsoft Visual Studio 8\\Common7\\IDE");
         }
- don't you need to specify that the executable is "wine  blablabla" ?? or does linux automatically run it with wine ?? (haven't tried it yet)
« Last Edit: January 02, 2008, 12:57:56 pm by killerbot »

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: Activate MSVC 8 Compiler on Linux
« Reply #6 on: January 02, 2008, 01:39:06 pm »
Hm yes I do have these strange things with svn diff utility from time to time (I notice it quite often on my own svn Project. seems to be something with trailing spaces or so)

OK I'll try it.

Installing the compiler

I had Visual C++ installed and the Win Partition is mounted in my Linux Filesystem.

Create the folder .wine/drive_c/vc8/ for the copied executeables.

After that copy the folders bin, lib and include from WinPartition/Program Files/Microsoft Visual Studio 8/vc/ to .wine/drive_c/vc8.
Copy from WinPartition/Program Files/Microsoft Visual Studio 8/Common7/IDE to VS8DIR/VC/Bin the following dlls:

> msobj80.dll
> mspdb80.dll
> mspdbcore.dll
> mspdbsrv.exe

calling wine C:/vc8/bin/cl.exe should already start the compiler complaining that there is no file to compile.

After that I created 2 Scripts in /usr/local/bin:

link.sh
Code
#!/bin/sh

wine "c:/vc8/bin/link.exe" /LIBPATH:"c:/vc8/lib" $@

cl.sh
Code
#!/bin/sh

wine "c:/vc8/bin/cl.exe" /I"c:/vc8/include" $@

and made both executeable (chmod +x)

one can now try to compile from comandline using cl.sh (and link.sh).

Integrating into Codeblocks.
You need to compile libcompiler because MSVC8 is normaly not included. There are at least the files compilerMSVC8.cpp compilerMSVC8.h and compilergcc.cpp.
Move the MSVC8 out of the #ifdef __WXMSW__ (on MSVC8 header and source Commenting the ifdef and endif out is the easyest I think). I think the patch should be fine as well.

Move the new libcompiler.so (and perhapes the .la too) in the plugins-folder (there should already be one to overwrite). After starting Codeblocks there should be an new compiler detected. I changed the toolchain executeables from cl.exe to cl.sh (one can of course name the script in /usr/local/bin cl.exe, might be an nice Idea).

Problems
  • One can not use Debug mode (some errors, maybe there is a way around I'll investigate here ;)
  • One must specify the .exe Suffix and disable the automated addition of suffixes for the produced executeable to be of use
  • I did not try nmake, cdb or the resource-Compiler by now they may or may not work

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Activate MSVC 8 Compiler on Linux
« Reply #7 on: January 02, 2008, 01:46:37 pm »
Hm yes I do have these strange things with svn diff utility from time to time (I notice it quite often on my own svn Project. seems to be something with trailing spaces or so)
This might be blanks instead of tabs or vice versa, or very often dos/windows line-endings in the original code and linux endings in the new one.

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: Activate MSVC 8 Compiler on Linux
« Reply #8 on: January 02, 2008, 02:00:48 pm »
Normally it could be tabs as I configured codeblocks to convert them to spaces. But this must be Line Endings as kwrite should not convert space<->tab

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Activate MSVC 8 Compiler on Linux
« Reply #9 on: January 02, 2008, 02:22:27 pm »
gonna experiment with this, with a few changes. I will completely mimic the VC installation path --> C:/Program Files/...
Because that's when installing it with wine would be constructed.

Will adjust compiler detection so it works on linux and windows but direct in such a way it would fine the wine path ...

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Activate MSVC 8 Compiler on Linux
« Reply #10 on: January 02, 2008, 03:01:30 pm »
Will adjust compiler detection so it works on linux and windows but direct in such a way it would fine the wine path ...

I would rather not go ahead with it and commit it in trunk. It would create more issues (mostly related to supporting this as a cross-compiler) than it will solve. IMHO, the steps to do this and the corresponding patch may be made available through Wiki so that if anyone is interested, (s)he may try it. :)

Another problem would be to modify the wizards to add Cross-compilation support. None of the wizards are able to generate any project supporting a cross-compiler. We can expect such requests if we add MSVC8 cross-compiler support.

Best regards,

Biplab
Be a part of the solution, not a part of the problem.

Offline ivucica

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Activate MSVC 8 Compiler on Linux
« Reply #11 on: January 02, 2008, 05:15:28 pm »

- don't you need to specify that the executable is "wine  blablabla" ?? or does linux automatically run it with wine ?? (haven't tried it yet)

Actually, there is support for running programs with userspace wrappers (probably made specifically for Wine and its kind). The kernel detects a non-ELF format, checks its registered formats, finds PE format and then runs using Wine. Or something like that. In any case, you can easily forget about Wine and just launch the program directly with something like:
Code
$ ./notepad.exe
So, if kernel support is enabled (it's a kernel option) then you can use it like a regular executable.

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: Activate MSVC 8 Compiler on Linux
« Reply #12 on: January 19, 2008, 02:34:16 pm »
A strange thing happened.

Today I updated codeblocks (probably the first time after doing this modifications) and libcompiler plugin fails to load. I'll try to get back for now but this realy shouldn't prevent libcompiler to load should it?

Clean build with clean SVN sources still don't give working codeblocks.
« Last Edit: January 19, 2008, 03:55:55 pm by darthdespotism »

Enjo

  • Guest
Re: Activate MSVC 8 Compiler on Linux
« Reply #13 on: August 01, 2012, 06:08:00 pm »
Hello all,

I've created a full tutorial on how to activate MSVC 8 on Linux:
http://www.orbiterwiki.org/wiki/Free_Compiler_Setup_Under_Linux
Let me know if anything is missing.