You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Gregory Shimansky <gs...@gmail.com> on 2006/06/01 23:34:58 UTC

Re: how to build Harmony on Windows (with minimum of commercial soft)

Hello

I decided to ressurrect this thread because I have some news. At home I
decided to try to use as free software as possible and here is what I have.

First I decided to use the current MS free software to repeat what is done
by commercial. Nowdays MS offers VS.NET 2005 express edition (no earlier
verions are available for download as far as I could find) and Platform SDK
Server 2003 R2 (at first I've downloaded an earlier one but later upgraded
to 2006 year version). The VS 2005 brings some new nuisances which software
written outside of Redmond wasn't ready for.

1. Headers shipped with VS.NET 2005 have new "feature". They warn about
unsafe functions which Microsoft replaced with "safe" ones. These includes
functions like getenv, sprintf, fopen and probably many others. Compiling
sources that use them results in W1 warning and since warnings are treated
as errors in native sources compilation fails.The way to fix it is either
use new MS functions or define _CRT_SECURE_NO_DEPRECATE (warning message
mentions it) and _CRT_NONSTDC_NO_DEPRECATE (warning message doesn't mention
it) as described here
http://www.wxwidgets.org/wiki/index.php/MSVC_.NET_Setup_Guide

I've solved this problem in a different way because I didn't want to change
makefiles. It appears that files like stdlib.h in VS.NET distribution have
this new "secure" stuff while files in Platform SDK don't. But by default
SetEnv.cmd sets $INCLUDE path only to "Platform SDK/Include" directory while
files like stdlib.h are located in "Platform SDK/Include/crt" directory. So
I added it first into $INCLUDE path in environment and compilation went
fine.

2. VS.NET 2005 has some new (at least to me) feature to generate manifests
for executables and DLLs. They are external files created alongside of the
executables. It appears that they are necessary now for executables to
function properly, otherwise they generate an error R6034 (
http://msdn2.microsoft.com/en-us/library/ms235560.aspx). It appears that
manifests for applications built with VS.NET 2005 are required to be present
either in a form of external .manifest file or embeded into the program or
DLL. Right now I didn't find a quick way to embed a manifest into an
executable, but just having an external manifest file for every .exe and
.dll works. Build system actually copies all *.dll.manifest files into
deploy directory but doesn't do it for java.exe.manifest and
javaw.exe.manifest files which are created in
classlib/trunk/native-src/win.IA32.

After resolving those new obstacles I got a fully functional harmony build.

Now what next. I had to get MASM in a not quite legal way described by
Davanum Srinivas. I unpacked MS Processor Pack executable (it refuses to
install unless you have exacly VC 6.0 SP5 installed which is not available
for download for a long time) with 7-zip and got MASM executable out of it.
I think the best way to change it is to move to NASM which also uses Intel
assembly notation but different directives syntax. I have yet to understand
the black magic done with CONST segments in locklbl.asm, thrhelp.asm and
thrspinlock.asm. The way it is used escapes me. If someone could explain I
would be very grateful.

I also tried gcc -mno-cygwin with little success. One lesson learned is that
sources should be compiled with -DWINVER=0x501 and the compilation succeds.
But I have troubles with linking and I just don't have any idea what to do
with *.def and *.rc files in cygwin/mingw environment. Any ideas?

2006/3/25, Davanum Srinivas <da...@gmail.com>:
>
> Patches are welcome :) Please feel free to send instructions to this
> list on how to build the pieces using which ever tools you wish to. If
> there are any patches, please open up new JIRA report and upload the
> "svn diff" against latest SVN.
>

-- 
Gregory Shimansky, Intel Middleware Products Division

Re: how to build Harmony on Windows (with minimum of commercial soft)

Posted by Gregory Shimansky <gs...@gmail.com>.
Thanks a lot for the pointer Mark. I didn't know about windres tool. I think
it may be used to embed manifests which are required for apps built with
VS.NET 2005 as well. I didn't try to do it yet though.

I tried to port MASM code to NASM [1]. I think I've done it although I
didn't test it much. Eclipse works with IBM's VME and as I've added some
debug prints, adresses of lock prefixes to cmpxchg which are replaced by
NOPs in lock386.c in single processor case seem to be correct. I have a
single processor and this code works for me.

One bad thing about NASM is that it cannot write COFF object files with long
segment names. It is limited to 8 symbols and I didn't find a way around it.
So I had to replace long segment names like "CONST$_LOCKFIXUPS_B" with
".rdata$B" in NASM sources. I hope it doesn't cause any segments names
collision.

If anyone is interested I can create a JIRA issue with attached sources.
They may be integrated into build with command line "nasm -f win32 $<" [2]
for nmake.

[1] NASM is free as in speech, it is available under LGPL in Cygwin which
most developers I know use already and it is available independent from
Cygwin from http://sourceforge.net/projects/nasm
[2] If NASM is an executable separate from Cygwin it is called nasmw (for
windows) so the command line may look differently on windows depending on
which way NASM is available.

2006/6/2, Mark Hindess <ma...@googlemail.com>:
>
> I tried using mingw directly a while back - but decided to give up until
> we'd split the natives.  It should be similar to "gcc -mno-cygwin" but
> things just seemed to proceed far more smoothly.
>
> For .rc files, I used a rule like:
>
>   %.res.obj: %.rc
>           windres --include-dir ../include -i $< -o $@
>
> to create .obj files from the .rc files.  (I think that's the right
> thing to do but since I never actually got it working ... )
>
> As for .def files,  I think these can be generated by the linker - and
> we want .lib files created too I think.  You can pass linker options
> from the dll build rule with the -Wl,... option something
> like:
>
> $(DLLNAME): $(BUILDFILES) $(VIRTFILES) $(MDLLIBFILES)
>   $(CC) -shared -o $@ \
>   -Wl,--output-def,${@F:.dll=.def},--out-implib,$(LIBPATH)${@F:.dll=.lib}
> \
>   $(BUILDFILES) $(VIRTFILES) $(MDLLIBFILES) $(SYSLIBFILES) \
>   -lkernel32  -lws2_32 -ladvapi32 -luser32 -lgdi32 -lcomdlg32 -lwinspool
>
-- 
Gregory Shimansky, Intel Middleware Products Division

Re: how to build Harmony on Windows (with minimum of commercial soft)

Posted by Thorbjørn Ravn Andersen <th...@gmail.com>.
Gregory Shimansky skrev  den 22-07-2006 23:57:
> classlib but I assure you that all I had installed was Visual Studio 
> Express
> and Platform SDK, not even MASM because it was not available by that time.
>   
Ok, thank you for replying.  I have now given up on this, so hopefully 
others will get it sorted out.

Right now just keeping up with the Jones' on Linux is enough for me :)

-- 
  Thorbjørn

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: how to build Harmony on Windows (with minimum of commercial soft)

Posted by Gregory Shimansky <gs...@gmail.com>.
On Sunday 09 July 2006 14:54 Thorbjørn Ravn Andersen wrote:
> Gregory Shimansky skrev  den 01-06-2006 23:34:
> > First I decided to use the current MS free software to repeat what is
> > done
> > by commercial. Nowdays MS offers VS.NET 2005 express edition (no earlier
> > verions are available for download as far as I could find) and
> > Platform SDK
> > Server 2003 R2 (at first I've downloaded an earlier one but later
> > upgraded
> > to 2006 year version). The VS 2005 brings some new nuisances which
> > software
> > written outside of Redmond wasn't ready for.
>
> I have now played a bit around with this, and I would like to have you
> confirm that the software above is the _ONLY_ Visual Studio stuff
> installed on your machine?
>
> The reason for this is that I have Visual Studio C++ Express, Platform
> Server 2003 SDK R2 (the latest I could find), and MASM installed on my
> XP box, and I cannot get a runnable deploy/.../jre/java.exe

(Sorry for a very late response, maybe it still may help you)

First I have to admit that I didn't try free MS toolchain since the time I 
wrote the email describing how I built classlib with it. At that time I 
thought that current free toolchain provided by MS is not really suitable and 
switched completely to Linux. I think many things could have changed in 
classlib but I assure you that all I had installed was Visual Studio Express 
and Platform SDK, not even MASM because it was not available by that time.

> If I run first the "C:\Program Files\Microsoft Platform SDK for Windows
> Server 2003 R2\SetEnv.cmd" /XP32 command and then the
> "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" I can
> build all of classlib, but invoking deploy\jdk\jre\bin\java gives me the
> dreaded "Cannot find MSVCR8.DLL" dialogue box.

The library "MSVCR80.dll" is installed in windows\system directory for me so 
it has to be accessible to any applications. This is what objdump -x shows to 
me for java.exe compiled on uh... June 06... it's been quite a while since I 
actually used windows toolchain for classlib.

> I tried looking around on the net for information how to fix this, and
> changing -MD to -MT did not change anything.   All this with manifests
> and dll is very strange to me so I'm giving up on that for the moment.

I can understand you, I am not a big windows expert myself.

-- 
Gregory Shimansky, Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: how to build Harmony on Windows (with minimum of commercial soft)

Posted by Thorbjørn Ravn Andersen <th...@gmail.com>.
Gregory Shimansky skrev  den 01-06-2006 23:34:
> First I decided to use the current MS free software to repeat what is 
> done
> by commercial. Nowdays MS offers VS.NET 2005 express edition (no earlier
> verions are available for download as far as I could find) and 
> Platform SDK
> Server 2003 R2 (at first I've downloaded an earlier one but later 
> upgraded
> to 2006 year version). The VS 2005 brings some new nuisances which 
> software
> written outside of Redmond wasn't ready for.
I have now played a bit around with this, and I would like to have you 
confirm that the software above is the _ONLY_ Visual Studio stuff 
installed on your machine?

The reason for this is that I have Visual Studio C++ Express, Platform 
Server 2003 SDK R2 (the latest I could find), and MASM installed on my 
XP box, and I cannot get a runnable deploy/.../jre/java.exe

If I run first the "C:\Program Files\Microsoft Platform SDK for Windows 
Server 2003 R2\SetEnv.cmd" /XP32 command and then the
"C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" I can 
build all of classlib, but invoking deploy\jdk\jre\bin\java gives me the 
dreaded "Cannot find MSVCR8.DLL" dialogue box.

I tried looking around on the net for information how to fix this, and 
changing -MD to -MT did not change anything.   All this with manifests 
and dll is very strange to me so I'm giving up on that for the moment.

If I run the R2\SetEnv.cmd command only (and not the vcvarsall.bat) the 
compilation fails at the first call to "lib" which cannot find the 
mscrt.dll (spelling?) library.

I am very confident that you have it running, so I just need to figure 
out how to get to your configuration :)


-- 
  Thorbjørn (who is now considering installing vmware to get to a varm, 
comforting linux environment :)






---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org