thelema / odb

Oasis-db downloader and installer
Do What The F*ck You Want To Public License
33 stars 7 forks source link

Odb on Windows: problem with pcre #95

Open murmour opened 11 years ago

murmour commented 11 years ago

Steps to reproduce the problem

  1. Install the official Cygwin-based OCaml installer;
  2. Install Odb by downloading the latest odb.ml, adding appropriate lines to findlib.conf, ld.conf and creating the ~/.odb/lib directory;
  3. Run the Cygwin shell;
  4. Crosscompile pcre to mingw64 with configure --host=i686-w64-mingw32 (should succeed);
  5. Install freshly built pcre with make install.

    Problem

mrm@proxima /cygdrive/c/projects/odb
$ ocaml odb.ml pcre
Installing pcre
Deps for pcre satisfied

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
100 81910  100 81910    0     0  22164      0  0:00:03  0:00:03 --:--:-- 22164
package downloaded to C:\cygwin\home\mrm\.odb\install-pcre\pcre-ocaml-7.0.2

Configuration:
ocamlfind: ........................................... C:\ocaml\bin\ocamlfind.EXE
ocamlc: .............................................. C:\ocaml\bin\ocamlc.opt.EXE
ocamlopt: ............................................ C:\ocaml\bin\ocamlopt.opt.EXE
ocamlbuild: .......................................... C:\ocaml\bin\ocamlbuild.EXE
Package name: ........................................ pcre-ocaml
Package version: ..................................... 7.0.2
os_type: ............................................. Win32
system: .............................................. mingw
architecture: ........................................ i386
ccomp_type: .......................................... cc
ocaml_version: ....................................... 4.00.0
standard_library_default: ............................ C:/ocamlmgw/lib
standard_library: .................................... c:/OCaml/lib
standard_runtime: .................................... ocamlrun
bytecomp_c_compiler: ................................. i686-w64-mingw32-gcc -O -mms-bitfields -Wall -Wno-unused
native_c_compiler: ................................... i686-w64-mingw32-gcc -O -mms-bitfields -Wall -Wno-unused
model: ............................................... default
ext_obj: ............................................. .o
ext_asm: ............................................. .s
ext_lib: ............................................. .a
ext_dll: ............................................. .dll
default_executable_name: ............................. camlprog.exe
systhread_supported: ................................. true
flexlink: ............................................ C:\ocaml\bin\flexlink.EXE
FlexDLL version (Win32): ............................. 0.30
Install architecture-independent files dir: .......... C:\cygwin\home\mrm\.odb
Install architecture-dependent files in dir: ......... $prefix
User executables: .................................... $exec_prefix\bin
System admin executables: ............................ $exec_prefix\sbin
Program executables: ................................. $exec_prefix\libexec
Read-only single-machine data: ....................... $prefix\etc
Modifiable architecture-independent data: ............ $prefix\com
Modifiable single-machine data: ...................... $prefix\var
Object code libraries: ............................... $exec_prefix\lib
Read-only arch-independent data root: ................ $prefix\share
Read-only architecture-independent data: ............. $datarootdir
Info documentation: .................................. $datarootdir\info
Locale-dependent data: ............................... $datarootdir\locale
Man documentation: ................................... $datarootdir\man
Documentation root: .................................. $datarootdir\doc\$pkg_name
HTML documentation: .................................. $docdir
DVI documentation: ................................... $docdir
PDF documentation: ................................... $docdir
PS documentation: .................................... $docdir
findlib_version: ..................................... 1.3.3
is_native: ........................................... true
suffix_program: ...................................... .exe
Remove a file.: ...................................... del
Remove a directory.: ................................. rd
Turn ocaml debug flag on: ............................ true
Turn ocaml profile flag on: .......................... false
Compiler support generation of .cmxs.: ............... true
OCamlbuild additional flags: .........................
with_pcre_config: .................................... pcre-config
Strict compile-time checks: .......................... true
Build examples: ...................................... true
Create documentations: ............................... true
Compile tests executable and library and run them: ... false
ocamldoc: ............................................ C:\ocaml\bin\ocamldoc.EXE

mkdir 'C:\cygwin\home\mrm\.odb\install-pcre\pcre-ocaml-7.0.2\_build'
''ocamlc.opt -I 'c:/OCaml/lib\ocamlbuild' unix.cma 'c:/OCaml/lib\ocamlbuild/ocamlbuildlib.cma' myocamlbuild.ml 'c:/OCaml/lib\ocamlbuild/ocamlbuild.cmo' -o myocamlbuild.exe
'pcre-config' is not recognized as an internal or external command,
operable program or batch file.
Exception End_of_file.
E: Failure("Command 'C:\\ocaml\\bin\\ocamlbuild.EXE -classic-display -no-log -no-links -install-lib-dir c:/OCaml/lib\\ocamlbuild -byte-plugin lib/libpcre_stubs.a lib/dllpcre_stubs.dll lib/pcre.cma lib/pcre.cmxa lib/pcre.a lib/pcre.cmxs examples/cloc/cloc.native examples/count_hash/count_hash.native examples/pcregrep/pcregrep.native examples/subst/subst.native -tag debug' terminated with error code 100")
Exception: Failure "Could not build pcre".

mrm@proxima /cygdrive/c/projects/odb
$ ls /usr/bin/ | grep pcre
cygpcre-0.dll
cygpcre-1.dll
cygpcre16-0.dll
cygpcrecpp-0.dll
cygpcreposix-0.dll
pcre-config

Possible root of evil

The build system doesn't seem to find pcre-config (even though it resides in /usr/bin). When building pcre-ocaml by hand one can provide a --with_pcre_config flag to ./configure. Odb doesn't allow to do that.

thelema commented 11 years ago

It is definitely odd that oasis's configure doesn't find it. odb has an insufficiently documented option: --configure-flags that allows you to add configure flags. This should workaround the problem in the short term, but the correct fix is to figure out what's up with pcre-config and oasis.

UnixJunkie commented 11 years ago

On 10/16/2012 05:21 AM, mmouratov wrote:

    Steps to reproduce the problem
  1. Install the official Cygwin-based OCaml installer;
  2. Install Odb by downloading the latest odb.ml, adding appropriate lines to findlib.conf, ld.conf and creating the ~/.odb/lib directory;
  3. Run the Cygwin shell;
  4. Crosscompile pcre to mingw64 with |configure --host=i686-w64-mingw32| (should succeed);
  5. Install freshly built pcre with |make install|.

    Problem

|mrm@proxima /cygdrive/c/projects/odb $ ocaml odb.ml pcre Installing pcre Deps for pcre satisfied

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0 100 81910 100 81910 0 0 22164 0 0:00:03 0:00:03 --:--:-- 22164 package downloaded to C:\cygwin\home\mrm.odb\install-pcre\pcre-ocaml-7.0.2

Configuration: ocamlfind: ........................................... C:\ocaml\bin\ocamlfind.EXE ocamlc: .............................................. C:\ocaml\bin\ocamlc.opt.EXE ocamlopt: ............................................ C:\ocaml\bin\ocamlopt.opt.EXE ocamlbuild: .......................................... C:\ocaml\bin\ocamlbuild.EXE Package name: ........................................ pcre-ocaml Package version: ..................................... 7.0.2 os_type: ............................................. Win32 system: .............................................. mingw architecture: ........................................ i386 ccomp_type: .......................................... cc ocaml_version: ....................................... 4.00.0 standard_library_default: ............................ C:/ocamlmgw/lib standard_library: .................................... c:/OCaml/lib standard_runtime: .................................... ocamlrun bytecomp_c_compiler: ................................. i686-w64-mingw32-gcc -O -mms-bitfields -Wall -Wno-unused native_c_compiler: ................................... i686-w64-mingw32-gcc -O -mms-bitfields -Wall -Wno-unused model: ............................................... default ext_obj: ............................................. .o ext_asm: ............................................. .s ext_lib: ............................................. .a ext_dll: ............................................. .dll default_executable_name: ............................. camlprog.exe systhread_supported: ................................. true flexlink: ............................................ C:\ocaml\bin\flexlink.EXE FlexDLL version (Win32): ............................. 0.30 Install architecture-independent files dir: .......... C:\cygwin\home\mrm.odb Install architecture-dependent files in dir: ......... $prefix User executables: .................................... $exec_prefix\bin System admin executables: ............................ $exec_prefix\sbin Program executables: ................................. $exec_prefix\libexec Read-only single-machine data: ....................... $prefix\etc Modifiable architecture-independent data: ............ $prefix\com Modifiable single-machine data: ...................... $prefix\var Object code libraries: ............................... $exec_prefix\lib Read-only arch-independent data root: ................ $prefix\share Read-only architecture-independent data: ............. $datarootdir Info documentation: .................................. $datarootdir\info Locale-dependent data: ............................... $datarootdir\locale Man documentation: ................................... $datarootdir\man Documentation root: .................................. $datarootdir\doc\$pkg_name HTML documentation: .................................. $docdir DVI documentation: ................................... $docdir PDF documentation: ................................... $docdir PS documentation: .................................... $docdir findlib_version: ..................................... 1.3.3 is_native: ........................................... true suffix_program: ...................................... .exe Remove a file.: ...................................... del Remove a directory.: ................................. rd Turn ocaml debug flag on: ............................ true Turn ocaml profile flag on: .......................... false Compiler support generation of .cmxs.: ............... true OCamlbuild additional flags: ......................... with_pcre_config: .................................... pcre-config Strict compile-time checks: .......................... true Build examples: ...................................... true Create documentations: ............................... true Compile tests executable and library and run them: ... false ocamldoc: ............................................ C:\ocaml\bin\ocamldoc.EXE

mkdir 'C:\cygwin\home\mrm.odb\install-pcre\pcre-ocaml-7.0.2_build' ''ocamlc.opt -I 'c:/OCaml/lib\ocamlbuild' unix.cma 'c:/OCaml/lib\ocamlbuild/ocamlbuildlib.cma' myocamlbuild.ml 'c:/OCaml/lib\ocamlbuild/ocamlbuild.cmo' -o myocamlbuild.exe 'pcre-config' is not recognized as an internal or external command, operable program or batch file. Exception End_of_file. E: Failure("Command 'C:\ocaml\bin\ocamlbuild.EXE -classic-display -no-log -no-links -install-lib-dir c:/OCaml/lib\ocamlbuild -byte-plugin lib/libpcre_stubs.a lib/dllpcre_stubs.dll lib/pcre.cma lib/pcre.cmxa lib/pcre.a lib/pcre.cmxs examples/cloc/cloc.native examples/count_hash/count_hash.native examples/pcregrep/pcregrep.native examples/subst/subst.native -tag debug' terminated with error code 100") Exception: Failure "Could not build pcre".

mrm@proxima /cygdrive/c/projects/odb $ ls /usr/bin/ grep pcre cygpcre-0.dll cygpcre-1.dll cygpcre16-0.dll cygpcrecpp-0.dll cygpcreposix-0.dll pcre-config
    Possible root of evil

The build system doesn't seem to find pcre-config (even though it resides in /usr/bin). When installing pcre-ocaml by hand one can provide a |--with_pcre_config| flag to |./configure|. Odb doesn't allow to do that.

Don't speak too fast. ;)

Here is how to give your own configure shell commands when installing a given package, some example from the packages file (sorry, lines cut by my e-mail client):

tool to lookup annotations for Objective Caml source code within an editor

annot git=git://github.com/avsm/ocaml-annot.git config={./configure --prefix=which ocaml | sed "s/\/bin\/ocaml$//g"}

code coverage analysis tool

bisect darcs=http://bisect.x9c.fr config={chmod 755 configure; ./configure -ocaml-prefix which ocaml | sed "s/\/bin\/ocaml$//g" -ocamlfind which ocamlfind}

So, add config={SOME_COMMANDS_TO_CONFIGURE} on the packages file line for the package with which you are having problems.