Giter Club home page Giter Club logo

oasis's Introduction

Travis-CI Build Status AppVeyor Build status Join the chat at https://gitter.im/ocaml/oasis

oasis - Tooling for building OCaml libraries and applications

OASIS generates a full configure, build and install system for your application. It starts with a simple _oasis file at the toplevel of your project and creates everything required.

OASIS leverages existing OCaml tooling to perform most of it's work. In fact, it might be more appropriate to think of it as simply the glue that binds these other subsystems together and coordinates the work that they do. It should support the following tools:

  • OCamlbuild
  • OMake
  • OCamlMakefile (todo),
  • ocaml-autoconf (todo)

It also features a do-it-yourself command line invocation and an internal configure/install scheme. Libraries are managed through findlib. It has been tested on GNU Linux and Windows.

It also allows to have standard entry points and description. It helps to integrate your libraries and software with third parties tools like OPAM.

Bug reports

Install OASIS

The recommended way to install oasis is via the opam package manager:

$ opam install oasis

As an alternative, INSTALL.md explains how to build OASIS from the sources.

Documentation

Examples

  • custom a project that uses the custom plugin and make to build
  • flags a project that uses flags and .ab files where these flags are substituted
  • interdepend-libraries a project that uses several libraries linked together
  • with-c a project that uses C files in libraries and executables
  • with-data a project that installs data files
  • with-subpackages a project that uses a syntax extension and a library
  • browse the examples directory of OASIS for other examples

Featured projects that use _oasis:

  • ocamlify: the _oasis file includes 2 syntax extensions, a library and tests

Related documentation

OMake README

Copyright and license

(C) 2011-2016 Sylvain Le Gall (C) 2008-2010 OCamlCore SARL

oasis is distributed under the terms of the GNU Lesser General Public License version 2.1 with OCaml linking exception.

See COPYING.txt for more information.

oasis's People

Contributors

aantron avatar adferguson avatar avsm avatar c-cube avatar chambart avatar chris00 avatar dkim avatar dra27 avatar drup avatar fccm avatar gerdstolpmann avatar gildor478 avatar gitter-badger avatar ivg avatar jeremiedimino avatar kit-ty-kate avatar lehy avatar mfp avatar mk270 avatar mmottl avatar murmour avatar paurkedal avatar pveber avatar radicalzephyr avatar samoht avatar seliopou avatar vouillon avatar xvilka avatar ydl7 avatar zakki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

oasis's Issues

omake: creating executables on case-insensitive filesystems

omake gets confused when searching for modules that need to be linked into executables when there is a difference in the file name casing (first letter). The exact circumstances are somewhat unclear, but I have a test case:

  • Main program: Main calls Caller.call
  • Intermediate module Caller calls Mod2.number from libb
  • Library libb, Mod2.numbercalls Liba.Mod1.number
  • Packed library liba, Liba.Mod1.number defines something

In this case, liba.cmo is the only module file starting with a lowercase letter, whereas the other module files are capitalized. Now, when searching for the modules that need to go into the executable besides the two libraries, it is not seen that Mod1 lives inside liba, and it is tried to link it another time, leading to

files liba/Liba.cmo and liba/liba.cma(Liba) both define a module  named Liba

Error running ocamlbuild from setup.exe on Windows/Cygwin

This bug has been migrated from artifact #1546 on forge.ocamlcore.org. It was assigned to user102. It was closed on 2016-06-24 08:36:06.

user20845 posted on 2016-05-24 14:53:03:

When trying to build ocaml-re (which uses OASIS), the build aborts with a bug stating that "ocamlbuild.cmo" is not found in the path reported by "ocamlbuild -where". However, this is not true:

z002rwsm@MD1FVV1C ~/tools/ocaml-libs/ocaml-re
$ make all
ocamlfind ocamlopt -o setup.exe setup.ml || ocamlfind ocamlc -o setup.exe setup.ml || true
File "setup.ml", line 318, characters 20-36:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "setup.ml", line 318, characters 42-58:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "setup.ml", line 327, characters 14-30:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "setup.ml", line 327, characters 38-54:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "setup.ml", line 330, characters 25-41:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "setup.ml", line 368, characters 10-26:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "setup.ml", line 474, characters 13-29:
Warning 3: deprecated: String.lowercase
Use String.lowercase_ascii instead.
File "setup.ml", line 1825, characters 16-33:
Warning 3: deprecated: String.capitalize
Use String.capitalize_ascii instead.
File "setup.ml", line 1831, characters 16-35:
Warning 3: deprecated: String.uncapitalize
Use String.uncapitalize_ascii instead.
File "setup.ml", line 5847, characters 11-28:
Warning 3: deprecated: String.capitalize
Use String.capitalize_ascii instead.
File "setup.ml", line 5848, characters 11-30:
Warning 3: deprecated: String.uncapitalize
Use String.uncapitalize_ascii instead.
rm -f setup.cmi setup.cmo setup.cmx setup.o
./setup.exe -all

Configuration:
ocamlfind: ........................................... C:\ocamlms\bin\ocamlfind.EXE
ocamlc: .............................................. C:\ocamlms\bin\ocamlc.opt.EXE
ocamlopt: ............................................ C:\ocamlms\bin\ocamlopt.opt.EXE
ocamlbuild: .......................................... C:\ocamlms\bin\ocamlbuild.EXE
Package name: ........................................ re
Package version: ..................................... 1.5.0
os_type: ............................................. Win32
system: .............................................. win32
architecture: ........................................ i386
ccomp_type: .......................................... msvc
ocaml_version: ....................................... 4.03.0
standard_library_default: ............................ C:/ocamlms/lib
standard_library: .................................... C:/ocamlms/lib
standard_runtime: .................................... ocamlrun
bytecomp_c_compiler: ................................. cl -nologo -D_CRT_SECURE_NO_DEPRECATE -O2 -Gy- -MD
native_c_compiler: ................................... cl -nologo -D_CRT_SECURE_NO_DEPRECATE -O2 -Gy- -MD
model: ............................................... default
ext_obj: ............................................. .obj
ext_asm: ............................................. .asm
ext_lib: ............................................. .lib
ext_dll: ............................................. .dll
default_executable_name: ............................. camlprog.exe
systhread_supported: ................................. true
flexlink: ............................................ C:\Program Files (x86)\flexdll\flexlink.EXE
FlexDLL version (Win32): ............................. 0.34
Install architecture-independent files dir: .......... C:\Program Files (x86)\re
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.6.2
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: .........................
Create documentations: ............................... true
Compile tests executable and library and run them: ... false
pkg_bytes: ........................................... C:\ocamlms\lib\site-lib\bytes
ocamldoc: ............................................ C:\ocamlms\bin\ocamldoc.EXE

mkdir 'C:\cygwin64\home\z002rwsm\tools\ocaml-libs\ocaml-re/_build'
Das System kann den angegebenen Pfad nicht finden.
Failure: Cannot find "ocamlbuild.cmo" in ocamlbuild -where directory.
E: Failure("Command 'C:\ocamlms\bin\ocamlbuild.EXE -classic-display -no-log -no-links -install-lib-dir C:/ocamlms/lib\ocamlbuild -byte-plugin lib/re.cma lib/re.cmxa lib/re.lib lib/re.cmxs lib/re_emacs.cma lib/re_emacs.cmxa lib/re_emacs.lib lib/re_emacs.cmxs lib/re_str.cma lib/re_str.cmxa lib/re_str.lib lib/re_str.cmxs lib/re_posix.cma lib/re_posix.cmxa lib/re_posix.lib lib/re_posix.cmxs lib/re_glob.cma lib/re_glob.cmxa lib/re_glob.lib lib/re_glob.cmxs lib/re_perl.cma lib/re_perl.cmxa lib/re_perl.lib lib/re_perl.cmxs lib/re_pcre.cma lib/re_pcre.cmxa lib/re_pcre.lib lib/re_pcre.cmxs -tag debug' terminated with error code 2")
Makefile:16: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 1

z002rwsm@MD1FVV1C ~/tools/ocaml-libs/ocaml-re
$ ls -l ocamlbuild -where
insgesamt 2139
-rw-r--r-- 1 z002rwsm Domain Users 199 24. Mai 14:45 META
-rw-r--r-- 1 z002rwsm Domain Users 611 24. Mai 14:45 ocamlbuild.cmo
-rw-r--r-- 1 z002rwsm Domain Users 587 24. Mai 14:45 ocamlbuild.cmx
-rw-r--r-- 1 z002rwsm Domain Users 1651 24. Mai 14:45 ocamlbuild.obj
-rw-r--r-- 1 z002rwsm Domain Users 959 24. Mai 14:45 ocamlbuild_executor.cmi
-rw-r--r-- 1 z002rwsm Domain Users 2697 24. Mai 14:45 ocamlbuild_executor.cmx
-rw-r--r-- 1 z002rwsm Domain Users 27409 24. Mai 14:45 ocamlbuild_executor.obj
-rw-r--r-- 1 z002rwsm Domain Users 125781 24. Mai 14:45 ocamlbuild_pack.cmi
-rw-r--r-- 1 z002rwsm Domain Users 105892 24. Mai 14:45 ocamlbuild_pack.cmx
-rw-r--r-- 1 z002rwsm Domain Users 26311 24. Mai 14:45 ocamlbuild_plugin.cmi
-rw-r--r-- 1 z002rwsm Domain Users 25347 24. Mai 14:45 ocamlbuild_plugin.cmx
-rw-r--r-- 1 z002rwsm Domain Users 7608 24. Mai 14:45 ocamlbuild_plugin.obj
-rw-r--r-- 1 z002rwsm Domain Users 296 24. Mai 14:45 ocamlbuild_unix_plugin.cmi
-rw-r--r-- 1 z002rwsm Domain Users 1729 24. Mai 14:45 ocamlbuild_unix_plugin.cmx
-rw-r--r-- 1 z002rwsm Domain Users 13070 24. Mai 14:45 ocamlbuild_unix_plugin.obj
-rw-r--r-- 1 z002rwsm Domain Users 337765 24. Mai 14:45 ocamlbuildlib.cma
-rw-r--r-- 1 z002rwsm Domain Users 4548 24. Mai 14:45 ocamlbuildlib.cmxa
-rw-r--r-- 1 z002rwsm Domain Users 1433876 24. Mai 14:45 ocamlbuildlib.lib
-rw-r--r-- 1 z002rwsm Domain Users 35124 24. Mai 14:45 signatures.mli

z002rwsm@MD1FVV1C ~/tools/ocaml-libs/ocaml-re

user102 replied on 2016-06-24 08:36:06:

Duplicate of #1538:
https://forge.ocamlcore.org/tracker/index.php?func=detail&aid=1538&group_id=54&atid=291

disabled library placed into META

After upgrading Chris00/ocaml-csv from version 1.5 to 1.7 the resulting META file has a subpackage 'lwt", even with --disable-lwt. The lwt is not built, so I think it should not be part of the META file for ocamlfind.

No warning given when compiling with .a

Usability feature: when specifying a Library target that includes some CSources spec and filled out with an external .a file, we should warn the user of a known build issue on OSX that has to do with the linker ignoring the .a file file generated by, of all things oddly, the oasis build system itself.

There is an example in the opam package libdai of a Library that achieves just this if you put the libdai.a file that it builds as a target of the Library "libdai" contained in libdai/ocaml_swig/_oasis, you'll see that it generates a healthy error, and doesn't indicate much in regards to the limitations on .a files in any warnings what so ever. It's appears assumed that if you use your own .a file, that you will put it as a spec under any executable that will use it. Perhaps another way to get around it is to not use .a files, but instead build shared libraries of them, but it's a different matter to dive too deep into extraneous projects' build specs, and it doesn't seem like it would be too much to have something helpful on the command line to explain this.

Dependencies aren't tracker per repo in admin/odb page

This bug has been migrated from artifact #975 on forge.ocamlcore.org. It was assigned to user102. It was closed on 2016-05-18 12:57:05.

user142 posted on 2011-05-24 15:39:30:

When I promote a package from unstable to testing, if its deps aren't in testing, I should get a dep error.

user144 replied on 2016-05-18 12:57:05:

oasis db is no longer developed.

Correct error locations for myocamlbuild.ml

This bug has been migrated from artifact #934 on forge.ocamlcore.org. It was assigned to user144. It was closed on 2011-08-29 21:12:39.

user144 posted on 2011-03-26 17:14:03:

OASIS should add a

current_line "myocamlbuild.ml"

before

(* OASIS_STOP *)

in myocamlbuild.ml for the errors in the additional code to be reported with correct localtions.

user102 replied on 2011-04-04 08:01:42:

Indeed, this is the behavior when generating setup.ml, we should apply the same for myocamlbuild.ml

ImplementationPattern with multiple file suffixes prevents building

There seems to be some kind of sanity check in the generated setup.ml, which attempts to search for the generated (by compilation) files. If these files are not found, an error is reported. This search gets confused by multiple file endings in a source file given with the sourcePattern feature.

OASISFormat: 0.4
Name:        implementation_pattern_test
Version:     0.1
Synopsis:    Modelica Runtime Environment
Authors:     Christoph Höger <[email protected]>
License:     BSD-3-clause

AlphaFeatures: source_patterns

Library implpattest
  Path:       src/
  CompiledObject: best
  BuildTools: ocamlbuild
  Modules: Test
  ImplementationPatterns+: ${capitalize_file module}.my.extension 

See the attached file for a complete test case.

The output is:

Finished, 1 target (0 cached) in 00:00:00.
Finished, 7 targets (0 cached) in 00:00:00.
E: Failure("None of expected built files '_build/src/Test.my.cmi' or '_build/src/Test.my.cmti' or '_build/src/Test.my.cmt' or '_build/src/Test.my.annot' exists.")

oasis_test.tar.gz

Automatically generated document section for library is bad

This bug has been migrated from artifact #552 on forge.ocamlcore.org. It was assigned to user102. It was closed on 2010-06-14 13:18:31.

user102 posted on 2010-04-08 10:22:46:

Generating automatically the content of some parts of the OASISTypes.package datastructure is not good. It implies to use the plugin that allow its generation (typically ocamlbuild plugin). This prevents to have a static view of the dependencies of the package.

A better to achieve this, it to warn/fail whenever there is a missing document or build dependencies.

For example, if there is dependencies on ocamlbuild for a library and the ocamlbuild plugin is enabled, we can fails when translating the _oasis file.

Another example, is the document generation, we should allow to have a document, built with ocamlbuild plugin that attaches to a library. This way we only generate documentation for library we need to.

[#1747] omake: all project libs are linked into executables

Current behavior: all libraries defined in the oasis project are linked into any executable defined there.

Correct behavior: only those libraries are linked into executables that are build dependencies.

Normally, this bug isn't a big problem, because the linker throws out unused modules from executables. However, there are situations when this doesn't work, for example when the executable is bytecode only, and one of the libraries is native-only.

(NB. Moved this bug from the old bug tracker over here.)

Generating .merlin file

It would be great to have oasis also generating a .merlin file
(like e.g. solvuu or jbuilder).

Path with dot results in confusing build error

StR:

  • apply the following patch to extunix :
diff --git a/_oasis b/_oasis
index 704023e..c854ef9 100644
--- a/_oasis
+++ b/_oasis
@@ -41,7 +41,7 @@ Flag strict
   Default: true
 
 Library extunix
-  Path: src/
+  Path: ./src/
   Modules: ExtUnix, ExtUnixAll, ExtUnixSpecific, ExtUnixConfig
   if flag(strict) && ccomp_type(cc)
     CCOpt: -pedantic -Wno-long-long -Wextra
  • oasis setup
  • make
  • observe build failing with :
Finished, 0 targets (0 cached) in 00:00:00.
Solver failed:
  Ocamlbuild knows of no rules that apply to a target named src/extunix.mly. This can happen if you ask Ocamlbuild to build a target with the wrong extension (e.g. .opt instead of .native) or if the source files live in directories that have not been specified as include directories.
Compilation unsuccessful after building 77 targets (77 cached) in 00:00:00.

reproduces on other projects with C stubs, without C stubs it works ok

External commands (like ocamlbuild) are printing errors on stdout instead of stderr

Dear Oasis team,

I was trying to write a little parser that would underline in red in Vim the errors returned by the output of make on a project relying on oasis.

But I found out that ocaml setup.ml -build redirects any errors sent to stderr by external commands (e.g., ocamlbuild) to stdout. Which is... unexpected. Why does setup.ml have this behavior?

Thanks!

OMake plugin has a bogus cmxs rule

The rule to build the %.cmxs files

    $(CMXSFILE): $(NATIVELIB) $(CLIB)
        $(OCAMLOPTLINK) -shared -cclib -L. -o $(CMXSFILE) $(NATIVELIB)

However, when cmxa is used, ocamlopt will only link those modules that are used. Since there are no other input files, the produced file is empty and totally useless.

Proposed solutions

  1. Passing the -linkall option will resolve this issue and the cmxs file will have the same units as the cmxa file.

  2. Alternatively, the cmxa file could be defined the same as cmxa rule, i.e., to build the output from the cmx files (and ofiles).

The former solution is easier to implement, the latter provides more opportunities for parallelization (cmxs and cmxa could be built in parallel), but at the cost of slightly more complex rule.

I can PRovide either solution so if you have any preferences I'm interested to know.

Create documentation to migrate from OASIS to dune

This is an alternative proposal to #109

Rather than providing a tool to do the migration, we can provide a bunch of examples and a general HOWTO for the migration from OASIS to dune.

It is probably pretty straight forward to migrate and a bunch of examples will probably help people to do so -- without having to delve into the complexity of an automated tools that will not manage corner cases.

How to enable tests by default?

Having to run configure with --enable-tests explicitly by default is annoying.
By default during development I want tests to be enabled, and then possibly disable once in opam file

OMake backend passes OCAMLCFLAGS and OCAMLOPTFLAGS to gcc

From the documentation

OCAMLCFLAGS flags to pass to "ocamlc"
OCAMLOPTFLAGS flags to pass to "ocamlopt"
OCAMLFLAGS flags to pass to "ocamlc" and "ocamlopt"

However, in oasis_lib.om

        if $(gt $(length $(OCAMLCFLAGS)), 0)
            byteflags = -ccopt $(quote $(OCAMLCFLAGS))
            export byteflags
        if $(gt $(length $(OCAMLOPTFLAGS)), 0)
            natflags = -ccopt $(quote $(OCAMLOPTFLAGS))
            export natflags

Passes them to gcc via the -ccopt. In best case, this leads to compilation erros from gcc, but sometimes it is even worse, e.g.,

OCAMLOPTFLAGS += -opaque

leads to the following command run underneath the hood

gcc -shared -o 'disasm.cmxs'   '-L/home/ivg/.opam/dev/lib/ocaml' -opaque 'disasm.cmxs.startup.o' 'disasm.a'  '-L.'

And gcc interprets -opaque as -o paque and outputs code into paque file instead of disasm.cmxs :)

Workaround

The OCAMLFLAGS option works fine and passes flags only to ocamlc and ocamlopt. However, it won't work if you need to pass options different to bytecode or native compiler, cf. NativeOpt and ByteOpt fields of the oasis specification.

parametrized plugin tags do not work on windows

witness https://ci.appveyor.com/project/ygrek/sqlgg/build/1.0.5 (build of https://github.com/ygrek/sqlgg/tree/415c05c6116177e01eb6a712426743dd0d787c04)
_oasis contains :

AlphaFeatures: ocamlbuild_more_args
XOCamlbuildPluginTags: package(mybuild)

and generated setup.ml has :

     build =
       OCamlbuildPlugin.build
         ["-use-ocamlfind"; "-plugin-tags"; "'package(mybuild)'"; "-j"; "0"];

which breaks build on windows. Manually removing single quotes breaks build on linux. Supposely quoting in OASISExec.run is too naive.

oasis version 0.4.10

DllPath does not respect variable substitution

I'm trying to use DllPath to link a .so shared library (specifically z3) that ships with opam. The library is located at ~/.opam/version/lib/z3, which is the path $(ocamlfind query z3).

So I wrote

Executable "foo"
  ...
  BuildDepends:
    z3
  DllPath: $(pkg_z3)

The above doesn't work, but works if I hard code the path manually.
I found pkg_z3 is correctly defined in setup.data
I also inspected the command ocamlbuild is using using "ByteOpt: -verbose", and I got

+ ocamlc.opt -g -dllpath ${pkg_z3} -verbose ...

So the variable is not expanded correctly?

OASIS-DB API seems down

This bug has been migrated from artifact #1219 on forge.ocamlcore.org. It was assigned to user100. It was closed on 2016-05-18 12:59:44.

user188 posted on 2012-09-19 09:27:16:

Got 404 at

http://oasis.ocamlcore.org/api/

I'd like do ask the API for URLs of all new tarballs created since some particular time.

user102 replied on 2012-09-19 11:12:47:

Humm, what about
http://oasis.ocamlcore.org/dev/api/ ?

user188 replied on 2012-09-19 13:21:12:

I see, so the real problem is that

http://oasis.ocamlcore.org/dev/contribute

contains hardwired absolute link so the /dev/api page stays secret.

See the broken link:

http://validator.w3.org/checklink?uri=http%3A%2F%2Foasis.ocamlcore.org%2Fdev%2Fcontribute&hide_type=all&depth=2&check=Check

Anyway, thanks for the right URL, this is going to be very useful.

Problem when executable name and MainIs doesn't match

This bug has been migrated from artifact #333 on forge.ocamlcore.org. It was assigned to user100. It was closed on 2010-02-03 00:36:57.

user102 posted on 2009-10-20 09:46:02:

OCamlbuild plugin set tags for pkg* to executable name, but ocamlbuild compile using MainIs filename.

We should set pkg_* tags to MainIs and copy generated exec to executable name.

Line number shift in ocamlmod

This bug has been migrated from artifact #553 on forge.ocamlcore.org. It was assigned to user102. It was closed on 2010-05-24 10:44:06.

user102 posted on 2010-04-08 10:26:40:

There is a problem due to the presence of the headers which are skipped. The line number still starts at #0 but not counting the header of the file.

We should also consider the fact that the #0 line itself counts as a line in the file.

Cannof find findlib package

When I run :

./setup.exe -configure

I get

W: Invalid_argument("varname_of_string")
E: Cannot find findlib package 
E: Failure("1 configuration error")

And I don't understand why. (I just updated my compiler to 4.06.1 using opam, reinstalled all the packages for this switch after running eval $(opam config env))

Commit updated setup.ml in oasis before tagging a release

Right now, the tag is set independently of the generated tarball. The oasis project has actually a significant difference in its setup.ml, because we store the generated version in the VCS.

We should change the order to generation to have:

  1. start a release
  2. build oasis
  3. use built oasis to generate setup.ml
  4. generate the tarball
  5. tag a release

The content of the release tarball will be closer to the content of the VCS for the release tag.

See #107 for someone affected by this discrepancy.

ocaml setup.ml -install fails to use destdir, since 0.4.8

Up to 0.4.7 --destdir installed the oasis binary properly. This fails with 0.4.8 and later:

[    1s] + ocaml setup.ml -configure --psdir /usr/share/doc/ocaml/ocaml-oasis --pdfdir /usr/share/doc/ocaml/ocaml-oasis --dvidir /usr/share/doc/ocaml/ocaml-oasis --htmldir /usr/share/doc/ocaml/ocaml-oasis --docdir /usr/share/doc/ocaml/ocaml-oasis --localedir /usr/share/locale --datadir /usr/share --bindir /usr/bin --mandir /usr/share/man --destdir /home/abuild/rpmbuild/BUILDROOT/ocaml-oasis-0.4.9.20170426.a236ff4-170517152746.0.x86_64 --datarootdir /usr/share --infodir /usr/share/info --libdir /usr/lib64 --libexecdir /usr/lib --localstatedir /var --sbindir /usr/sbin --prefix /usr --sysconfdir /etc --exec-prefix /usr --sharedstatedir /usr/com --enable-docs
...
[   29s] cp: cannot create regular file '/usr/bin/oasis': Permission denied
[   29s] E: Failure("Command ''cp' '/home/abuild/rpmbuild/BUILD/oasis-0.4.9.20170426.a236ff4/_build/src/cli/Main.native' '/usr/bin/oasis'' terminated with error code 1")

omake plugin terminates with the out-of-bound error

Problem Description

The OASIS_concat2 function fails with the out-of-bound error when an executable has only one dependency and the base name of this dependency is shorter than the directory name of it.

To reproduce, use the following _oasis file

OASISFormat: 0.4
Name:        outofbound
Version:     0.0
Synopsis:    Showcases the out-of-bound error
Authors:     Ivan Gotovchits
License:     MIT
BuildTools+: omake
BuildType:   OMake (0.4)
OCamlVersion: >= 4.01

Library somelibrary
  Modules:                   M
  Path:                      somelibrary

Executable t
  Path:                      .
  MainIs:                    main.ml
  BuildDepends:              somelibrary

then do

touch main.ml
mkdir somelibrary
touch somelibrary/m.ml
oasis setup
ocaml setup.ml -configure
ocaml setup.ml -build

The last command will output

*** omake: reading OMakefiles
--- Checking for ocamlfind... (found /home/ivg/.opam/4.07.0/bin/ocamlfind)
--- Checking for ocamlc.opt... (found /home/ivg/.opam/4.07.0/bin/ocamlc.opt)
--- Checking for ocamlopt.opt... (found /home/ivg/.opam/4.07.0/bin/ocamlopt.opt)
--- Checking for ocamldep.opt... (found /home/ivg/.opam/4.07.0/bin/ocamldep.opt)
--- Checking for ocamllex.opt... (found /home/ivg/.opam/4.07.0/bin/ocamllex.opt)
--- Checking whether ocamlc understands the "z" warnings... (yes)
--- Checking whether ocamlopt can create cmxs plugins... (yes)
*** omake: finished reading OMakefiles (0.18 sec)
*** omake: 37/46 targets are up to date
*** omake: failed (0.24 sec, 2/2 scans, 4/10 rules, 30/87 digests)
*** omake error:
   File /home/ivg/.opam/4.07.0/lib/omake/Pervasives.om: line 443, characters 6-33
   out of bounds: 0
E: Failure("Command 'omake build' terminated with error code 123")

and terminate with an error code.

Problem Analysis

The error occurs in _oasis_lib.om file,

OASIS_concat2(seq1, seq2) =
    if $(eq $(seq1.length), 0)
        return $(OASIS_empty_seq)
    else
        private.h1 = $(seq1.nth 0)
        private.h2 = $(seq2.nth 0)  # <--- fail is here
        private.r = $(h1)$(DIRSEP)$(h2)
        return $(r) $(OASIS_concat2 $(seq1.nth-tl 1), $(seq2.nth-tl 1))

because seq2 is shorter than seq1 .

This function is called from

OASIS_set_diff(set1, set2) =
    private.dir2 = $(dirname $(set2))
    private.base2 = $(basename $(set2))
    private.base2_lc = $(uncapitalize $(base2))
    private.base2_uc = $(capitalize $(base2))
    private.set2_lc = $(OASIS_concat2 $(dir2), $(base2_lc))
    private.set2_uc = $(OASIS_concat2 $(dir2), $(base2_uc))
    private.set2_all = $(set2) $(set2_lc) $(set2_uc)
    return $(set-diff $(set1), $(set2_all))

When set2 consists of one element (i.e., there is only one dependency), it has type String istead of type Array, therefore the concat function, instead of concatenating two strings is concatenating each character, e.g, instead of

somelibrary/m.cmx

we get

s/m o/. m/c e/m l/x <fail-here>

Problem Mitigation

By now, I'm using omake for three and a half hours, so this all is very new to me, therefore I'm not sure that the mitigation that I have is the right one, so I would really like to have comments from the author of this function, @gerdstolpmann.

So far, my solution is to change

-    private.dir2 = $(dirname $(set2))
-    private.base2 = $(basename $(set2))
+    private.dir2[] = $(dirname $(set2))
+    private.base2[] = $(basename $(set2))

and it works fine, both when we have set2 as an array and set2 as a string.
I will be happy to submit a PR, but I would prefer if someone who knows how OMake works will come up :)

Restrict package names

This bug has been migrated from artifact #925 on forge.ocamlcore.org. It was assigned to user102.

user142 posted on 2011-03-07 22:15:14:

Package names probably don't need to contain most special symbols, and allowing this can cause security problems in sloppily coded programs (including odb.ml). Let's restrict package names to something more like [-a-zA-Z0-9]+

OMake backend doesn't pass flags to the cmxs rule.

Same rule as in #134 has one more problem, OCAMLOPTFLAGS and OCAMLFLAGS are not passed to ocamlopt, despite that documentation requires this

Variable	Compiler? Linker?	Comment
USE_OCAMLFIND	X	X	true/false - whether to use findlib
OCAMLINCLUDES	X	X	search path for compiled modules and archives, also used by the dependency scanner
OCAMLFINDFLAGS	X	X	additional flags to pass to ocamlfind
OCAMLPACKS	X	X	findlib packages to include in build
BYTE_ENABLED	X	X	true/false - whether bytecode compiler is enabled
NATIVE_ENABLED	X	X	true/false - whether nativecode compiler is enabled
OCAMLCFLAGS	X	X	flags to pass to "ocamlc"
OCAMLOPTFLAGS	X	X	flags to pass to "ocamlopt"
OCAMLFLAGS	X	X	flags to pass to "ocamlc" and "ocamlopt"

In fact, this rule doesn't have any extension points, i.e., it doesn't reference any dynamic variables.

oasis should warn on potential overwrite of .o file

Common (and very confusing) pitfall with bindings is having module.ml and module.c in same directory (ocaml and C side of bindings respectively) - which results in object file having same name for both inputs, and getting overwritten by ocamlbuild during build. The library will compile fine, but fail when linked with final program, because only one .o is linked.
Arguably this should be a warning/fix in ocamlbuild too, but warning in oasis would be very nice too and seems easier to implement.

Library in "." with ocamlbuild doesn't work

This bug has been migrated from artifact #409 on forge.ocamlcore.org. It was assigned to user102. It was closed on 2010-03-19 00:15:53.

user102 posted on 2009-11-19 14:37:18:

E.g. the attached _oasis file has problem.

OCamlAutobuild
ocaml setup.ml -configure
ocaml setup.ml -build -classic-display
Running command '/usr/bin/ocamlbuild ./with-c.cma ./with-c.cmxa main.byte -classic-display'
ocamlfind ocamlopt -c -o A.cmx A.ml
ocamlfind ocamlopt -a -linkpkg A.cmx -o with-c.cmxa
Solver failed:
Ocamlbuild knows of no rules that apply to a target named ./with-c.mly. This can happen if you ask Ocamlbuild to build a target with the wrong extension (e.g. .opt instead of .native) or if the source files live in directories that have not been specified as include directories.
Backtrace:

  • Failed to build the target main.byte
    • Building main.byte:
      • Building ./with-c.cma:
        • Failed to build all of these:
          • Building ./with-c.cmo:
            • Failed to build all of these:
              • Building ./with-c.ml:
                • Failed to build all of these:
                  • Building ./with-c.mly
                  • Building ./with-c.mll
              • Building ./with-c.mli:
                • Building ./with-c.mly
              • Building ./with-c.mlpack
              • Building ./with-c.mli:
                • Building ./with-c.mly
          • Building ./with-c.mllib
            Failure("Command '/usr/bin/ocamlbuild ./with-c.cma ./with-c.cmxa main.byte -classic-display' terminated with error code 6")

compiled_setup_ml and FreeBSD

This bug has been migrated from artifact #1435 on forge.ocamlcore.org. It was assigned to user7847.

user923 posted on 2014-11-02 02:31:38:

compiled_setup_ml generates a Makefile that is broken on FreeBSD, see ocsigen/tyxml#61 for some evidences.

Basically, the issue boils down to the fact that "gmake ./setup.exe" is not valid, as opposed to "gmake setup.exe".

Problem with argument order for c libraries

This bug has been migrated from artifact #1069 on forge.ocamlcore.org. It was assigned to user102. It was closed on 2012-03-13 01:48:08.

user142 posted on 2011-12-14 17:11:05:

The argument order to GCC used to work, but after upgrading Ubuntu to 11.10, oasis' generated commands for detecting C libraries fail even when the library is installed.

In the following example, I try to configure cairo2 0.3.4 from oasis-db. First the setup.ml -configure runs and dies. Then I reorder the -lcairo after the name of the temp script (which is nicely left behind by oasis) and everything works.

This isn't the only library affected by this, LWT can't find libev (although it doesn't give as good debugging info as cairo; I guess its setup.ml was generated differently),

$ ocaml setup.ml -configure
I: Running command '/usr/local/bin/ocamlc.opt -config > '/tmp/oasis-7a810c.txt''
I: Running command '/usr/local/bin/ocamlfind query -format %v findlib > '/tmp/oasis-1b1c9b.txt''
I: Running command 'pkg-config cairo --cflags-only-I > '/tmp/oasis-a7a6d3.txt''
I: Running command 'gcc -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC -o /tmp/oasis-cb0508.exe -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 /tmp/setupfb3578.c'
I: Running command '/tmp/oasis-cb0508.exe'
I: Running command 'pkg-config cairo --libs > '/tmp/oasis-47f860.txt''
I: Running command 'pkg-config cairo --cflags-only-I > '/tmp/oasis-7892ac.txt''
I: Running command 'gcc -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC -o /tmp/oasis-47a6c5.exe -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -lcairo /tmp/setup711cfb.c'
/tmp/cclUoAiM.o: In function main': setup711cfb.c:(.text+0x1f): undefined reference to cairo_image_surface_create'
setup711cfb.c:(.text+0x27): undefined reference to cairo_create' setup711cfb.c:(.text+0x37): undefined reference to cairo_destroy'
collect2: ld returned 1 exit status
ERROR: Could not compile a test program. The cairo library flags "-lcairo" are likely incorrect. Set them in config.ml.
thelema@norige-desktop:/.odb/install-cairo2/cairo-0.3.4$ gcc -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC -o /tmp/oasis-47a6c5.exe -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 /tmp/setup711cfb.c -lcairo
thelema@norige-desktop:
/.odb/install-cairo2/cairo-0.3.4$

user142 replied on 2011-12-14 17:22:52:

Patching the setup.ml file, the configure step completes successfully if I change the function compile_and_run_c to:

let compile_and_run_c ?(flags=[]) pgm ?(run_err=(fun _ -> ())) compile_err =
let tmp, fh = Filename.open_temp_file "setup" ".c" in
output_string fh pgm;
close_out fh;
let exe = Filename.temp_file "oasis-" ".exe" in
let o = match Sys.os_type with
| "Unix" | "Cygwin" -> "-o " ^ exe
| "Win32" -> "/Fe" ^ exe
| _ -> assert false in
let args = o :: tmp :: flags in
BaseExec.run (BaseStandardVar.bytecomp_c_compiler()) args
~f_exit_code:(fun e -> if e <> 0 then (compile_err(); exit 1));
Sys.remove tmp;
BaseExec.run exe [] ~f_exit_code:run_err;
Sys.remove exe

The fix is in the "let args = o::tmp::flags", changed from "let args = o :: (flags @ [tmp])"

user142 replied on 2011-12-27 21:05:08:

Author of cairo2 notified of this bug via email. LWT authors also notified via IRC. Please close.

Failing AppVeyor build

(new-object net.webclient).DownloadString("https://aantron.github.io/binaries/cygwin/x86/ocaml/4.02/install.ps1") | PowerShell -Command -
+ [07:46:54] C:\Cygwin\bin\bash.exe -lc 'true'
+ [07:46:54] Invoke-WebRequest 'https://ci.appveyor.com/api/buildjobs/c3doinoqjyl0twgp/artifacts/packages-flexdll.zip' -OutFile 'C:\Users\appveyor\AppData\Local\Temp\1\ocaml-binaries\packages-flexdll.zip'
PowerShell : Invoke-WebRequest : BlobNotFoundThe specified blob does not exist. 
At line:1 char:117
+ ... /binaries/cygwin/x86/ocaml/4.02/install.ps1") | PowerShell -Command -
+                                                     ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Invoke-WebReque...oes not exist. :String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
RequestId:1caec848-101e-00b8-32f3-2b5817000000 
Time:2019-06-26T07:46:55.3302930Z
At line:1 char:1
+ Invoke-WebRequest 'https://ci.appveyor.com/api/buildjobs/c3doinoqjyl0 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:Htt 
   pWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe 
   ll.Commands.InvokeWebRequestCommand
+ [07:46:55] C:\Cygwin\bin\bash.exe -lc 'flexlink -help | grep "version 0\\.35"'
0\.35: flexlink: command not found
C:\Cygwin\bin\bash.exe -lc 'flexlink -help | grep "version 0\\.35"' exited 
with 1
At line:3 char:9
+         throw "$args exited with $LastExitCode"
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (C:\Cygwin\bin\b...' exited wi 
   th 1:String) [], RuntimeException
    + FullyQualifiedErrorId : C:\Cygwin\bin\bash.exe -lc 'flexlink -help | gre 
   p "version 0\\.35"' exited with 1
 
+ [07:46:56] Invoke-WebRequest 'https://ci.appveyor.com/api/buildjobs/ulea7059dhjsktq2/artifacts/packages-ocaml.zip' -OutFile 'C:\Users\appveyor\AppData\Local\Temp\1\ocaml-binaries\packages-ocaml.zip'
Invoke-WebRequest : NoSuchKeyThe specified key does not exist.No such object: a
ppveyor-artifacts/aantron-23994/binaries/31-cygwin/ulea7059dhjsktq2/packages-oc
aml.zip
At line:1 char:1
+ Invoke-WebRequest 'https://ci.appveyor.com/api/buildjobs/ulea7059dhjs ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:Htt 
   pWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe 
   ll.Commands.InvokeWebRequestCommand
+ [07:46:56] C:\Cygwin\bin\bash.exe -lc 'ocaml -version | grep 4.02'
/usr/bin/bash: ocaml: command not found
C:\Cygwin\bin\bash.exe -lc 'ocaml -version | grep 4.02' exited with 1
At line:3 char:9
+         throw "$args exited with $LastExitCode"
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (C:\Cygwin\bin\b...' exited wi 
   th 1:String) [], RuntimeException
    + FullyQualifiedErrorId : C:\Cygwin\bin\bash.exe -lc 'ocaml -version | gre 
   p 4.02' exited with 1
 
Command executed with exception:  

bytecode only support broken

Since oasis.0.4.7 stublibs shared libraries (dll*.so) are not longer installed, although they are still built (it only happens on platforms without ocamlopt).

e.g. the installation of lambda-term 1.10.1 will succeed, because it's setup.ml file was generated with oasis 0.4.6. If you regenerate it with oasis 0.4.7 or later, dlllambda-term_stubs.so won't be installed any longer. (Of course lambda-term can't be used with the latest version of lwt, because it's setup.ml file is too recent,...)

You can try it out with the 4.04.0+bytecode-only switch under opam.

Optional dependencies → separate packages

This is to start a discussion about how to best accomodate that conditional dependencies (considered harmful) be treated as separate packages. Many packages are moving towards that design. oasis2opam could easily treat Flags as separate packages instead of optional dependencies. The support needed from oasis is

  • make possible to only compile a sub-library (treating the main one as an installed findlib dep);
  • generate separate META files (with lib-sub instead of lib.sub);
  • install only a sub-library (in its own dir).

Problem when ocamlopt.opt cannot be found

This bug has been migrated from artifact #351 on forge.ocamlcore.org. It was assigned to user100. It was closed on 2010-03-18 23:47:31.

user102 posted on 2009-11-06 15:58:56:

Failure("Cannot find any of the files: "/home/gildor/programmation/00build//bin/ocamlopt.opt", "/home/gildor/bin/ocamlopt.opt", "/home/gildor/programmation/00build/all/bin/ocamlopt.opt", "/usr/local/bin/ocamlopt.opt", "/usr/bin/ocamlopt.opt", "/bin/ocamlopt.opt", "/usr/games/ocamlopt.opt"")

Problem with version links on camlzip page

This bug has been migrated from artifact #1185 on forge.ocamlcore.org. It was assigned to user102. It was closed on 2016-05-18 12:52:34.

user142 posted on 2012-07-06 13:02:19:

Apparently + is used as part of camlzip's version numbers, is this causing the version links on the camlzip page to 404?

user144 replied on 2016-05-18 12:52:34:

oasis db is no longer developed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.