caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* OCaml compilation
@ 2010-05-27 20:38 Matthieu Dubuget
  2010-05-28  7:01 ` [Caml-list] " David Allsopp
  2010-06-08  9:24 ` Matthieu Dubuget
  0 siblings, 2 replies; 6+ messages in thread
From: Matthieu Dubuget @ 2010-05-27 20:38 UTC (permalink / raw)
  To: caml-list

Hello,

I'm trying to compile ocaml (mingw) on XP.

I did not succeed, and could reproduce the very same behaviour on two 
computers (a real one, and in a virtual machine).

On my main development system, the compilation does not fail. The 
difference may be that I don't touch at my currently working cygwin 
installation. During the two failing installs, I did install a fresh 
cygwin. Is this a known problem?

Following are some (pseudo)code extracted from the script I use to make 
my installation.

Can anyone spot a mistake, that would explain the failure ?

Thanks in advance.

Matt


> 1/ cygwin installation: (where setup.exe is downloaded from cygwin web 
> site)
> setup.exe -s http://cygwin.cict.fr/ -R c:\cygwin -q -l c:\depot_cygwin 
> -n -C Base -P 
> wget,unzip,binutils,diffutils,gcc-core,gcc-mingw-core,make,mingw-runtime,ncurses,w32api,m4,time,patch 
>
>
> 2/ home creation: (.bat script)
> ---
> @echo off
>
> c:
> chdir c:\cygwin\bin
> set LANG=fr_FR.UTF-8
> bash --login -i
> ---
>
> 3/ After home is created,
>
> export LANG=fr_FR.UTF-8
>
> is added into .bash_profile
>
> 4/ a cygwin session is launched
>
> 5/ ActiveTcl installation
>
> #!/bin/bash
> activetcl=ActiveTcl8.5.8.0.291595-win32-ix86-threaded.exe
> activetcldownload=http://downloads.activestate.com/ActiveTcl/Windows/8.5.8/${activetcl} 
>
> tkroot=C:/tcl
> tkdll=tk85.dll
> tcldll=tcl85.dll
> download_file ${activetcl} ${activetcldownload}
> chmod +x ${downloaddir}/${activetcl}
> ${downloaddir}/${activetcl} --directory ${tkroot}
>
> 6/ disconnect (windows xp session), reconnect, launch cygwin
> (because ActiveTcl modifies environment (path addded))
>
> 7/ flexlink install
>
> here=`pwd`
> prefix=/home/matt
> appsprefix=${prefix}/apps
> prefixwin=C:/cygwin${prefix}
> appsprefixwin=${prefixwin}/apps
> downloaddir=${here}/download
> extractdir=${here}/extracted
> mkdir ${prefix}/apps
>
> extract_archive_zip "${downloaddir}/${flexarchive}" ${flexdestdir}
> cp /usr/bin/gcc-3.exe ${flexdestdir}/gcc.exe
> cp /usr/bin/cpp-3.exe ${flexdestdir}/cpp.exe
>
> echo 'export PATH="${flexdestdir}:$PATH' >> ${HOME}/.bash_profile"
>
> 8/ Edit .bash_profile
>
> export PATH="/home/matt/apps/flex:$PATH"
>
> 9/ OCaml building
>
> #!/bin/bash
> ocaml=ocaml-3.11.2
> ocamlarchive=${ocaml}.tar.bz2
> ocamldownload=http://caml.inria.fr/pub/distrib/ocaml-3.11/${ocamlarchive}
>
> download_file ${ocamlarchive} ${ocamldownload}
>
> #Extract
> extract_archive ${downloaddir}/${ocamlarchive} ${extractdir} ${ocaml}
>
> #Configure
> cp ${extractdir}/${ocaml}/config/s-nt.h ${extractdir}/${ocaml}/config/s.h
> cp ${extractdir}/${ocaml}/config/m-nt.h ${extractdir}/${ocaml}/config/m.h
> cp ${extractdir}/${ocaml}/config/Makefile.mingw 
> ${extractdir}/${ocaml}/config/Makefile
>
> tklink='$(TK_ROOT)'
> cmd1="s|PREFIX=C:/ocamlmgw|PREFIX=$ocamldirwin|"
> cmd2="s|TK_ROOT=c:/tcl|TK_ROOT=$tkroot|"
> cmd3="s|TK_LINK=$tklink/bin/tk84.dll $tklink/bin/tcl84.dll 
> -lws2_32|TK_LINK=${tklink}/bin/${tkdll} ${tklink}/bin/${tcldll} 
> -lws2_32|"
> sed -i.bak \
>     -e "$cmd1" \
>     -e "$cmd2" \
>     -e "$cmd3" \
>     ${extractdir}/${ocaml}/config/Makefile
>
>
> cd ${extractdir}/${ocaml} && \
>     make -f Makefile.nt world
>
> Fails during ocamlbrowser compilation:
>

>> gcc -mno-cygwin -O -mms-bitfields -Wall -Wno-unused 
>> -I../../../byterun -IC:/tcl/include -c winmain.c
>> ../../../ocamlcomp.sh -o ocamlbrowser.exe -I 
>> ../../../otherlibs/win32unix -I ../../../otherlibs/str -I 
>> ../../../otherlibs/systhreads -I ../labltk -I ../lib -I ../support -I 
>> ../../../parsing -I ../../../utils -I ../../../typing \
>>                 ../../../toplevel/toplevellib.cma \
>>                 unix.cma str.cma threads.cma -custom -ccopt "-link 
>> -Wl,--subsystem,windows" labltk.cma jglib.cma \
>>                 list2.cmo       useunix.cmo     setpath.cmo     
>> lexical.cmo fileselect.cmo      searchid.cmo    searchpos.cmo   
>> shell.cmo help.cmo viewer.cmotypecheck.cmo   editor.cmo      main.cmo 
>> winmain.o
>> ** Cannot resolve symbols for descriptor object:
>>  _Tcl_AppendResult
>>  _Tcl_CreateChannelHandler
>>  _Tcl_CreateCommand
>>  _Tcl_CreateInterp
>>  _Tcl_CreateTimerHandler
>>  _Tcl_DStringAppend
>>  _Tcl_DStringFree
>>  _Tcl_DStringInit
>>  _Tcl_DeleteChannelHandler
>>  _Tcl_DeleteTimerHandler
>>  _Tcl_DoOneEvent
>>  _Tcl_Eval
>>  _Tcl_EvalFile
>>  _Tcl_ExternalToUtfDString
>>  _Tcl_Finalize
>>  _Tcl_FindExecutable
>>  _Tcl_Free
>>  _Tcl_GetCommandInfo
>>  _Tcl_GetInt
>>  _Tcl_GetVar
>>  _Tcl_Init
>>  _Tcl_MakeFileChannel
>>  _Tcl_MakeTcpClientChannel
>>  _Tcl_Merge
>>  _Tcl_ResetResult
>>  _Tcl_SetResult
>>  _Tcl_SetVar
>>  _Tcl_SplitList
>>  _Tcl_TraceVar
>>  _Tcl_UntraceVar
>>  _Tcl_UntraceVar2
>>  _Tcl_UtfToExternalDString
>>  _Tk_GeometryRequest
>>  _Tk_Init
>>  _Tk_MainLoop
>>  _Tk_MainWindow
>> File "_none_", line 1, characters 0-1:
>> Error: Error while building custom runtime system
>> make[2]: *** [ocamlbrowser.exe] Erreur 2
>> make[2]: quittant le répertoire « 
>> /cygdrive/m/projets/Install/InstallDevTools/install_ocaml/InstallPack/extracted/ocaml-3.11.2/otherlibs/labltk/browser 
>> » 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [Caml-list] OCaml compilation
  2010-05-27 20:38 OCaml compilation Matthieu Dubuget
@ 2010-05-28  7:01 ` David Allsopp
  2010-05-28 10:04   ` Matthieu Dubuget
       [not found]   ` <4BFF7AB7.6080003@gmail.com>
  2010-06-08  9:24 ` Matthieu Dubuget
  1 sibling, 2 replies; 6+ messages in thread
From: David Allsopp @ 2010-05-28  7:01 UTC (permalink / raw)
  To: matthieu.dubuget, caml-list

Matthieu Dubuget wrote:
> Hello,
> 
> I'm trying to compile ocaml (mingw) on XP.
> 
> I did not succeed, and could reproduce the very same behaviour on two
> computers (a real one, and in a virtual machine).
> 
> On my main development system, the compilation does not fail. The
> difference may be that I don't touch at my currently working cygwin
> installation. During the two failing installs, I did install a fresh
> cygwin. Is this a known problem?

Don't think it's Cygwin - looks from the error like it's your ActiveTcl
parameters.

<snip>

> > 5/ ActiveTcl installation
> >
> > #!/bin/bash
> > activetcl=ActiveTcl8.5.8.0.291595-win32-ix86-threaded.exe
> > activetcldownload=http://downloads.activestate.com/ActiveTcl/Windows/8
> > .5.8/${activetcl}

Installs Tcl 8.5

> > tkroot=C:/tcl
> > tkdll=tk85.dll
> > tcldll=tcl85.dll
> > download_file ${activetcl} ${activetcldownload} chmod +x
> > ${downloaddir}/${activetcl} ${downloaddir}/${activetcl} --directory
> > ${tkroot}

<snip>

> > 9/ OCaml building
> >
> > #!/bin/bash
> > ocaml=ocaml-3.11.2
> > ocamlarchive=${ocaml}.tar.bz2
> > ocamldownload=http://caml.inria.fr/pub/distrib/ocaml-3.11/${ocamlarchi
> > ve}
> >
> > download_file ${ocamlarchive} ${ocamldownload}
> >
> > #Extract
> > extract_archive ${downloaddir}/${ocamlarchive} ${extractdir} ${ocaml}
> >
> > #Configure
> > cp ${extractdir}/${ocaml}/config/s-nt.h
> > ${extractdir}/${ocaml}/config/s.h cp
> > ${extractdir}/${ocaml}/config/m-nt.h ${extractdir}/${ocaml}/config/m.h
> > cp ${extractdir}/${ocaml}/config/Makefile.mingw
> > ${extractdir}/${ocaml}/config/Makefile
> >
> > tklink='$(TK_ROOT)'
> > cmd1="s|PREFIX=C:/ocamlmgw|PREFIX=$ocamldirwin|"
> > cmd2="s|TK_ROOT=c:/tcl|TK_ROOT=$tkroot|"
> > cmd3="s|TK_LINK=$tklink/bin/tk84.dll $tklink/bin/tcl84.dll
> > -lws2_32|TK_LINK=${tklink}/bin/${tkdll} ${tklink}/bin/${tcldll}
> > -lws2_32|"
> > sed -i.bak \
> >     -e "$cmd1" \
> >     -e "$cmd2" \
> >     -e "$cmd3" \
> >     ${extractdir}/${ocaml}/config/Makefile

Does this definitely build the correct Makefile - you're searching for
tcl84.dll but out-of-the-box OCaml 3.11.2 uses references tcl85.dll. Your
sed instruction would be better if it was TK_ROOT=.* rather than assuming
the value that the OCaml Dev team will have left there. You shouldn't need
to update TK_LINK.


David


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] OCaml compilation
  2010-05-28  7:01 ` [Caml-list] " David Allsopp
@ 2010-05-28 10:04   ` Matthieu Dubuget
       [not found]   ` <4BFF7AB7.6080003@gmail.com>
  1 sibling, 0 replies; 6+ messages in thread
From: Matthieu Dubuget @ 2010-05-28 10:04 UTC (permalink / raw)
  To: caml-list

Thanks for your answer, David.
> Installs Tcl 8.5
>
>    

Yes.

>>> tkroot=C:/tcl
>>> tkdll=tk85.dll
>>> tcldll=tcl85.dll
>>> download_file ${activetcl} ${activetcldownload} chmod +x
>>> ${downloaddir}/${activetcl} ${downloaddir}/${activetcl} --directory
>>> ${tkroot}
>>>        
> <snip>
>
>    
>>> 9/ OCaml building
>>>
>>> #!/bin/bash
>>> ocaml=ocaml-3.11.2
>>> ocamlarchive=${ocaml}.tar.bz2
>>> ocamldownload=http://caml.inria.fr/pub/distrib/ocaml-3.11/${ocamlarchi
>>> ve}
>>>
>>> download_file ${ocamlarchive} ${ocamldownload}
>>>
>>> #Extract
>>> extract_archive ${downloaddir}/${ocamlarchive} ${extractdir} ${ocaml}
>>>
>>> #Configure
>>> cp ${extractdir}/${ocaml}/config/s-nt.h
>>> ${extractdir}/${ocaml}/config/s.h cp
>>> ${extractdir}/${ocaml}/config/m-nt.h ${extractdir}/${ocaml}/config/m.h
>>> cp ${extractdir}/${ocaml}/config/Makefile.mingw
>>> ${extractdir}/${ocaml}/config/Makefile
>>>
>>> tklink='$(TK_ROOT)'
>>> cmd1="s|PREFIX=C:/ocamlmgw|PREFIX=$ocamldirwin|"
>>> cmd2="s|TK_ROOT=c:/tcl|TK_ROOT=$tkroot|"
>>> cmd3="s|TK_LINK=$tklink/bin/tk84.dll $tklink/bin/tcl84.dll
>>> -lws2_32|TK_LINK=${tklink}/bin/${tkdll} ${tklink}/bin/${tcldll}
>>> -lws2_32|"
>>> sed -i.bak \
>>>      -e "$cmd1" \
>>>      -e "$cmd2" \
>>>      -e "$cmd3" \
>>>      ${extractdir}/${ocaml}/config/Makefile
>>>        
> Does this definitely build the correct Makefile - you're searching for
> tcl84.dll but out-of-the-box OCaml 3.11.2 uses references tcl85.dll. Your
> sed instruction would be better if it was TK_ROOT=.* rather than assuming
> the value that the OCaml Dev team will have left there. You shouldn't need
> to update TK_LINK.
>
>    

Here are  the corresponding lines in the Makefile just after sed ran:

### Configuration for LablTk
# Set TK_ROOT to the directory where you installed TCL/TK 8.5
# There must be no spaces or special characters in $(TK_ROOT)
TK_ROOT=C:/tcl
TK_DEFS=-I$(TK_ROOT)/include
TK_LINK=$(TK_ROOT)/bin/tk85.dll $(TK_ROOT)/bin/tcl85.dll -lws2_32

I'm ok with your advices in order to improve my small scripts. In this 
case (3.11.2),
cmd3 does not modify anything. But it does when I'm installing an older 
version of


Anyway,
the resulting Makefile seems ok to me. And it compiles fine in one computer.

Salutations

Matt


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] OCaml compilation
       [not found]     ` <1275036886.4305.5.camel@Nokia-N900-02-8>
@ 2010-05-28 10:06       ` Matthieu Dubuget
  2010-05-28 12:43         ` Matthieu Dubuget
  0 siblings, 1 reply; 6+ messages in thread
From: Matthieu Dubuget @ 2010-05-28 10:06 UTC (permalink / raw)
  To: caml-list

Thanks again.

In the meantime, I gone on another way: I really needed to have a 
working development environment on this notebook before leaving!

I just used brute force : copy of c:\cygwin from the working computer to 
the "new" one. My compiled version of ocaml came with this brute force copy.

This allowed me to try again my compilation script:
- ActiveTcl installation was not modified
- and this time, it passed ocamlbrowser compilation.

Now, can anybody confirm the behaviour I observed with a fresh cygwin 
install?

I will (later) investigate the problem (taking your suggestion into 
account) on the virtual machine on which I reproduced the problem.

Salutations

Matt

> Certainly looks correct, I agree. One thought - have you remembered to put C:\Tcl\bin in your PATH on the machines which are failing?
>
> Is flexlink definitely the same version on each machine? Two other possibilities:
>
> 1. Try entering the command that's failing manually with -verbose and then do the same with the flexlink command displayed, adding -v -v to see exactly what flexlink is doing.
>
> 2. Diff your two Cygwin dirs (a tool like ExamDiff Pro is good for this). If your old machine is using Cygwin 1.5 and the new ones 1.7 then that may be the cause. I had some weird issues when upgrading to Cygwin because if the location of Cygwin1.dll is wrong then cygpath returns garbage paths - which confuses the hell out of flexlink! However, I don't think this is what's affecting you because errors owing to that surfaced while linking ocamlc for me.
>
> Hope something there helps!
>    


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] OCaml compilation
  2010-05-28 10:06       ` Matthieu Dubuget
@ 2010-05-28 12:43         ` Matthieu Dubuget
  0 siblings, 0 replies; 6+ messages in thread
From: Matthieu Dubuget @ 2010-05-28 12:43 UTC (permalink / raw)
  To: caml-list


>> Certainly looks correct, I agree. One thought - have you remembered 
>> to put C:\Tcl\bin in your PATH on the machines which are failing?
>>
>> Is flexlink definitely the same version on each machine? Two other 
>> possibilities:
>>
>> 1. Try entering the command that's failing manually with -verbose and 
>> then do the same with the flexlink command displayed, adding -v -v to 
>> see exactly what flexlink is doing.

I called the original command with -verbose -cclib -v -cclib -v

If anybody can conclude anything from this? I will try the same command 
with a working system, trying to spot differences…


+ flexlink -chain mingw -exe -o "ocamlbrowser.exe"   "-L../../../stdlib" 
"-L../../../otherlibs/win32unix" "-L../../../otherlibs/str" 
"-L../../../otherlibs/systhreads" "-L../labltk" "-L../lib" 
"-L../support" "-L../../../parsing" "-L../../../utils" 
"-L../../../typing" ".\camlprim986116.c" "-llabltk" "-lthreads" "-lstr" 
"-lunix" "-lws2_32" "winmain.o" "-v" "-v" "-lcamlrun"  -lws2_32 -link 
-Wl,--subsystem,windows C:/tcl/bin/tk85.dll C:/tcl/bin/tcl85.dll -lws2_32
** Use cygpath: true
** Search path:
../../../typing
../../../utils
../../../parsing
../support
../lib
../labltk
../../../otherlibs/systhreads
../../../otherlibs/str
../../../otherlibs/win32unix
../../../stdlib
/lib/mingw
/lib
/lib/w32api
/usr/lib/gcc/i686-pc-mingw32/3.4.4
** Default libraries:
crt2.o
-lmingw32
-lgcc
-lmoldname
-lmingwex
-lmsvcrt
-luser32
-lkernel32
-ladvapi32
-lshell32
+ gcc -mno-cygwin -c -o ".\dyndll255a54.o" -I"../../../typing" 
-I"../../../utils" -I"../../../parsing" -I"../support" -I"../lib" 
-I"../labltk" -I"../../../otherlibs/systhreads" 
-I"../../../otherlibs/str" -I"../../../otherlibs/win32unix" 
-I"../../../stdlib" .\camlprim986116.c
** Cannot resolve symbols for descriptor object:
  _Tcl_AppendResult
  _Tcl_CreateChannelHandler
  _Tcl_CreateCommand
  _Tcl_CreateInterp
  _Tcl_CreateTimerHandler
  _Tcl_DStringAppend
  _Tcl_DStringFree
  _Tcl_DStringInit
  _Tcl_DeleteChannelHandler
  _Tcl_DeleteTimerHandler
  _Tcl_DoOneEvent
  _Tcl_Eval
  _Tcl_EvalFile
  _Tcl_ExternalToUtfDString
  _Tcl_Finalize
  _Tcl_FindExecutable
  _Tcl_Free
  _Tcl_GetCommandInfo
  _Tcl_GetInt
  _Tcl_GetVar
  _Tcl_Init
  _Tcl_MakeFileChannel
  _Tcl_MakeTcpClientChannel
  _Tcl_Merge
  _Tcl_ResetResult
  _Tcl_SetResult
  _Tcl_SetVar
  _Tcl_SplitList
  _Tcl_TraceVar
  _Tcl_UntraceVar
  _Tcl_UntraceVar2
  _Tcl_UtfToExternalDString
  _Tk_GeometryRequest
  _Tk_Init
  _Tk_MainLoop
  _Tk_MainWindow
+ objdump -p C:/tcl/bin/tk85.dll > .\dyndll5dd309.dmp
+ objdump -p C:/tcl/bin/tcl85.dll > .\dyndll4644ba.dmp
** open: C:/cygwin/lib/mingw/crt2.o
** open: C:/cygwin/lib/mingw/libmingw32.a
** open: C:/cygwin/lib/gcc/i686-pc-mingw32/3.4.4/libgcc.a
** open: C:/cygwin/lib/mingw/libmoldname.a
** open: C:/cygwin/lib/mingw/libmingwex.a
** open: C:/cygwin/lib/mingw/libmsvcrt.a
** open: C:/cygwin/lib/w32api/libuser32.a
** open: C:/cygwin/lib/w32api/libkernel32.a
** open: C:/cygwin/lib/w32api/libadvapi32.a
** open: C:/cygwin/lib/w32api/libshell32.a
File "_none_", line 1, characters 0-1:
Error: Error while building custom runtime system





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: OCaml compilation
  2010-05-27 20:38 OCaml compilation Matthieu Dubuget
  2010-05-28  7:01 ` [Caml-list] " David Allsopp
@ 2010-06-08  9:24 ` Matthieu Dubuget
  1 sibling, 0 replies; 6+ messages in thread
From: Matthieu Dubuget @ 2010-06-08  9:24 UTC (permalink / raw)
  Cc: caml-list

Hello,

I'm answering to myself, since I understood the problem.

I had LANG=fr_FR.UTF-8 in my environment.

This led objdump to generate a dump file with:

     Table [Ordinal/Nom de pointeurs]

instead of

     [Ordinal/Name Pointer] Table

This line is searched by flexlink.exe when parsing
objdump file, and was nether found.

Salutations

Matt


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-06-08  9:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-27 20:38 OCaml compilation Matthieu Dubuget
2010-05-28  7:01 ` [Caml-list] " David Allsopp
2010-05-28 10:04   ` Matthieu Dubuget
     [not found]   ` <4BFF7AB7.6080003@gmail.com>
     [not found]     ` <1275036886.4305.5.camel@Nokia-N900-02-8>
2010-05-28 10:06       ` Matthieu Dubuget
2010-05-28 12:43         ` Matthieu Dubuget
2010-06-08  9:24 ` Matthieu Dubuget

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).