Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbound constructor #747

Open
jgrenat opened this issue Mar 14, 2022 · 8 comments
Open

Unbound constructor #747

jgrenat opened this issue Mar 14, 2022 · 8 comments
Assignees

Comments

@jgrenat
Copy link

jgrenat commented Mar 14, 2022

Hello,

I'm totally new to the Ocaml ecosystem and I wanted to try Eliom.
I'm unable to launch the Ocsigen-Start app, when I execute the make test.byte, I have the following error:

Error: Unbound constructor MyApp_i18n.En
make: *** [_server/myapp_Demo_i18n.type_mli] Error 2

Do you know how I can fix this?

Thanks! :)

@ilankri ilankri self-assigned this Mar 14, 2022
@ilankri
Copy link
Member

ilankri commented Mar 14, 2022

Hello @jgrenat,

On Debian 11.2 with opam 2.1.0, a fresh installation of the latest version (6.0.1) of Ocsigen Start works:

cd $(mktemp --directory)
opam update
opam switch --empty create .
opam install ocsigen-start
eliom-distillery -name myapp -template os.pgocaml
cd myapp
make db-init
make db-create
make db-schema
make test.byte

Could you please send the output of the command opam list to try understanding what is happening on your side?

@jgrenat
Copy link
Author

jgrenat commented Mar 14, 2022

Hello @ilankri

Thanks for your answer, here is the result of the command:

Packages matching: installed

Name # Installed # Synopsis

angstrom 0.15.0 Parser combinators built for speed and memory-efficiency
asn1-combinators 0.2.6 Embed typed ASN.1 grammars in OCaml
astring 0.8.5 Alternative String module for OCaml
base v0.14.3 Full standard library replacement for OCaml
base-bigarray base
base-bytes base Bytes library distributed with the OCaml compiler
base-threads base
base-unix base
base64 3.5.0 Base64 encoding for OCaml
bigarray-compat 1.1.0 Compatibility library to use Stdlib.Bigarray when possible
bigstringaf 0.8.0 Bigstring intrinsics and fast blits based on memcpy/memmove
biniou 1.2.1 Binary data format designed for speed, safety, ease of use and backward compatibility as protocols evolve
bos 0.2.1 Basic OS interaction for OCaml
ca-certs 0.2.2 Detect root CA certificates from the operating system
calendar 2.04 Library for handling dates and times in your program
camlzip 1.11 Accessing compressed files in ZIP, GZIP and JAR format
cmdliner 1.1.0 Declarative definition of command line interfaces for OCaml
cohttp 4.0.0 An OCaml library for HTTP clients and servers
cohttp-lwt 4.0.0 CoHTTP implementation using the Lwt concurrency library
cohttp-lwt-unix 4.0.0 CoHTTP implementation for Unix and Windows using Lwt
conduit 4.0.2 A network connection establishment library
conduit-lwt 4.0.2 A portable network connection establishment library using Lwt
conduit-lwt-unix 4.0.2 A network connection establishment library for Lwt_unix
conf-gmp 4 Virtual package relying on a GMP lib system installation
conf-gmp-powm-sec 3 Virtual package relying on a GMP lib with constant-time modular exponentiation
conf-libpcre 1 Virtual package relying on a libpcre system installation
conf-libssl 3 Virtual package relying on an OpenSSL library system installation
conf-npm 1 Virtual package relying on npm installation
conf-pkg-config 2 Check if pkg-config is installed and create an opam switch local pkgconfig folder
conf-zlib 1 Virtual package relying on zlib
cppo 1.6.8 Code preprocessor like cpp for OCaml
cryptokit 1.16.1 A library of cryptographic primitives
csexp 1.5.1 Parsing and printing of S-expressions in Canonical form
cstruct 6.0.1 Access C-like structures directly from OCaml
csv 2.4 A pure OCaml library to read and write CSV files
devoxx 0.1 pinned to version 0.1 at file:///Users/jordan/projects/perso/eliom/devoxx
domain-name 0.4.0 RFC 1035 Internet domain names
dune 3.0.3 Fast, portable, and opinionated build system
dune-build-info 3.0.3 Embed build informations inside executable
dune-configurator 3.0.3 Helper library for gathering system configuration
duration 0.2.0 Conversions to various time units
easy-format 1.3.2 High-level and functional interface to the Format module of the OCaml standard library
eliom 9.4.0 Client/server Web framework
eqaf 0.8 Constant-time equal function on string
fmt 0.9.0 OCaml Format pretty-printer combinators
fpath 0.7.3 File system paths for OCaml
gmap 0.3.0 Heterogenous maps over a GADT
hex 1.4.0 Library providing hexadecimal converters
hmap 0.8.1 Heterogeneous value maps for OCaml
ipaddr 5.2.0 A library for manipulation of IP (and MAC) address representations
ipaddr-sexp 5.2.0 A library for manipulation of IP address representations using sexp
js_of_ocaml 4.0.0 Compiler from OCaml bytecode to JavaScript
js_of_ocaml-compiler 4.0.0 Compiler from OCaml bytecode to JavaScript
js_of_ocaml-lwt 4.0.0 Compiler from OCaml bytecode to JavaScript
js_of_ocaml-ocamlbuild 3.11.0 Compiler from OCaml bytecode to JavaScript
js_of_ocaml-ppx 4.0.0 Compiler from OCaml bytecode to JavaScript
js_of_ocaml-ppx_deriving_json 4.0.0 Compiler from OCaml bytecode to JavaScript
js_of_ocaml-tyxml 4.0.0 Compiler from OCaml bytecode to JavaScript
jsonm 1.0.1 Non-blocking streaming JSON codec for OCaml
logs 0.7.0 Logging infrastructure for OCaml
lwt 5.5.0 Promises and event-driven I/O
lwt_log 1.1.1 Lwt logging library (deprecated)
lwt_ppx 2.0.3 PPX syntax for Lwt, providing something similar to async/await from JavaScript
lwt_react 1.1.5 Helpers for using React with Lwt
lwt_ssl 1.1.3 OpenSSL binding with concurrent I/O
macaddr 5.2.0 A library for manipulation of MAC address representations
magic-mime 1.2.0 Map filenames to common MIME types
menhir 20220210 An LR(1) parser generator
menhirLib 20220210 Runtime support library for parsers generated by Menhir
menhirSdk 20220210 Compile-time library for auxiliary tools related to Menhir
mirage-crypto 0.10.5 Simple symmetric cryptography for the modern age
mirage-crypto-ec 0.10.5 Elliptic Curve Cryptography with primitives taken from Fiat
mirage-crypto-pk 0.10.5 Simple public-key cryptography for the modern age
mirage-crypto-rng 0.10.5 A cryptographically secure PRNG
mirage-no-solo5 1 Virtual package conflicting with mirage-solo5
mirage-no-xen 1 Virtual package conflicting with mirage-xen
mmap 1.2.0 File mapping functionality
mtime 1.4.0 Monotonic wall-clock time for OCaml
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.13.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.13.1 Official release 4.13.1
ocaml-compiler-libs v0.12.4 OCaml compiler libraries repackaged
ocaml-config 2 OCaml Switch Configuration
ocaml-lsp-server 1.10.3 LSP Server for OCaml
ocaml-options-vanilla 1 Ensure that OCaml is compiled with no special options enabled
ocaml-syntax-shims 1.0.0 Backport new syntax to older OCaml versions
ocamlbuild 0.14.1 OCamlbuild is a build system with builtin rules to easily build most OCaml projects
ocamlfind 1.9.3 A library manager for OCaml
ocamlformat-rpc-lib 0.19.0 Auto-formatter for OCaml code (RPC mode)
ocamlnet 4.1.9-2 Internet protocols (HTTP, CGI, e-mail etc.) and helper data structures
ocplib-endian 1.2 Optimised functions to read and write int16/32/64 from strings and bigarrays
ocsigen-i18n 4.0.0 pinned to version 4.0.0 at git+https://github.com/besport/ocsigen-i18n.git
ocsigen-ppx-rpc 1.0 This PPX adds a syntax for RPCs for Eliom and Ocsigen Start
ocsigen-start 6.0.1 An Eliom application skeleton ready to use to build your own application with users, (pre)registration, notifications, etc
ocsigen-toolkit 3.2.0 Reusable UI components for Eliom applications (client only, or client-server)
ocsigenserver 5.0.1 A full-featured and extensible Web server
ocsipersist 1.1.0 Persistent key/value storage (for Ocsigen) using multiple backends
ocsipersist-lib 1.1.0 Persistent key/value storage (for Ocsigen) - support library
ocsipersist-pgsql 1.1.0 Persistent key/value storage (for Ocsigen) using PostgreSQL
parsexp v0.14.2 S-expression parsing library
pbkdf 1.2.0 Password based key derivation functions (PBKDF) from PKCS#5
pcre 7.5.0 Bindings to the Perl Compatibility Regular Expressions library
pgocaml 4.3.0 Native OCaml interface to PostgreSQL databases
pgocaml_ppx 4.3.0 PPX extension for PGOCaml
pp 1.1.2 Pretty-printing library
ppx_derivers 1.2.1 Shared [@@deriving] plugin registry
ppx_deriving 5.2.1 Type-driven code generation for OCaml
ppx_optcomp v0.14.3 Optional compilation for OCaml
ppx_sexp_conv v0.14.3 [@@deriving] plugin to generate S-expression conversion functions
ppx_yojson_conv_lib v0.14.0 Runtime lib for ppx_yojson_conv
ppxlib 0.25.0 Standard library for ppx rewriters
ptime 1.0.0 POSIX time for OCaml
re 1.10.3 RE is a regular expression library for OCaml
react 1.2.2 Declarative events and signals for OCaml
reactiveData 0.2.2 Declarative events and signals for OCaml
resource-pooling 1.2 Library for pooling resources like connections, threads, or similar
result 1.5 Compatibility Result module
rresult 0.7.0 Result value combinators for OCaml
safepass 3.1 Facilities for the safe storage of user passwords
seq base Compatibility package for OCaml's standard iterator type starting from 4.07.
sexplib v0.14.0 Library for serializing OCaml values to and from S-expressions
sexplib0 v0.14.0 Library containing the definition of S-expressions and some base converters
spawn v0.15.0 Spawning sub-processes
ssl 0.5.10 Bindings for OpenSSL
stdio v0.14.0 Standard IO library for OCaml
stdlib-shims 0.3.0 Backport some of the new stdlib features to older compiler
stringext 1.6.0 Extra string functions for OCaml
topkg 1.0.5 The transitory OCaml software packager
tyxml 4.5.0 A library for building correct HTML and SVG documents
uchar 0.0.2 Compatibility library for OCaml's Uchar module
uri 4.2.0 An RFC3986 URI/URL parsing library
uri-sexp 4.2.0 An RFC3986 URI/URL parsing library
uutf 1.0.3 Non-blocking streaming Unicode codec for OCaml
x509 0.16.0 Public Key Infrastructure (RFC 5280, PKCS) purely in OCaml
xml-light 2.4 Xml-Light is a minimal XML parser & printer for OCaml
yojson 1.7.0 Yojson is an optimized parsing and printing library for the JSON format
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers

I'm on MacOS, from what I understand of the error, there should be a module En that is missing, maybe it should have been generated somewhere is the previous steps and wasn't?

My problem seems similar to https://stackoverflow.com/questions/68140969/error-during-compiling-application-template-written-with-eliom-of-ocsigen-start

@ilankri
Copy link
Member

ilankri commented Mar 14, 2022

Thanks! At first glance, I do not see anything suspicious regarding the installed packages.

What is the contents of the file Makefile.i18n at the root of your Ocsigen Start project?

@jgrenat
Copy link
Author

jgrenat commented Mar 14, 2022

Starting a fresh install following your instructions, I've had the following error:

==== The website is available at http://localhost:8080 ====
ocsigenserver "-v" -c local/etc/myapp/myapp-test.conf
ocsigenserver: ocsigen:main: Command pipe created
ocsigenserver: main: Fatal - While loading /private/var/folders/_m/q5kjpznx3434h9s08ps543540000gp/T/tmp.FiMk1lUJmK/_opam/lib/cstruct/cstruct.cma: error loading shared library: error loading shared library: (Failure
ocsigenserver: main:   "dllcstruct_stubs.so: dlopen(dllcstruct_stubs.so, 10): image not found")
make: *** [test.byte] Error 52
rm myapp_Demo_i18n.eliom

@jgrenat
Copy link
Author

jgrenat commented Mar 14, 2022

Here is the content:

##----------------------------------------------------------------------
## The following part defines rules for i18n.
## See https://github.com/besport/ocsigen-i18n for more information.

I18N_CHECKER            := ocsigen-i18n-checker
I18N_GENERATOR          := ocsigen-i18n-generator

## The i18n generated file.
## IMPROVEME: Due to myapp_language, the module
## defining all translations must be static.
I18N_ELIOM_FILE         := $(PROJECT_NAME)_i18n.eliom

## PPX extension to rewrite each file while compiling.
I18N_PPX_REWRITER       := "ocsigen-i18n-rewriter --prefix 'Myapp_' --suffix '_i18n' --default-module Myapp_i18n"

## This rule will update the primary I18N module
$(I18N_ELIOM_FILE): $(I18N_PRIMARY_FILE)
# use LC_ALL=C so that all $(I18N_ELIOM_FILE) files are generated the same
# way.
	LC_ALL=C $(I18N_GENERATOR) \
	--languages $(I18N_LANGUAGES) \
	--default-language $(I18N_DEFAULT_LANGUAGE) \
	< $(I18N_PRIMARY_FILE) \
	> $(I18N_ELIOM_FILE)

## This rule will update all other I18N modules
$(PROJECT_NAME)_%_i18n.eliom: $(I18N_TSV_DIR)$(PROJECT_NAME)_%_i18n.tsv
# use LC_ALL=C so that all I18N files are generated the same
# way.
	LC_ALL=C $(I18N_GENERATOR) \
	--languages $(I18N_LANGUAGES) \
	--default-language $(I18N_DEFAULT_LANGUAGE) \
	--primary $(notdir $(I18N_PRIMARY_FILE)) \
	< $< \
	> $@


i18n-check:
	$(I18N_CHECKER) ./*.eliom < $(I18N_TSV_FILE)

.PHONY: i18n-clean
i18n-clean:
	-rm -f $(notdir $(patsubst %.tsv,%.eliom,$(I18N_PRIMARY_FILE)	\
						 $(I18N_EXTRA_FILES)))

## end of i18n
##----------------------------------------------------------------------

On the fresh install, I've managed to make it work using make test.opt instead of make test.byte! 🚀 What are the differences between the two commands?

@ilankri
Copy link
Member

ilankri commented Mar 14, 2022

Starting a fresh install following your instructions, I've had the following error:

==== The website is available at http://localhost:8080 ====
ocsigenserver "-v" -c local/etc/myapp/myapp-test.conf
ocsigenserver: ocsigen:main: Command pipe created
ocsigenserver: main: Fatal - While loading /private/var/folders/_m/q5kjpznx3434h9s08ps543540000gp/T/tmp.FiMk1lUJmK/_opam/lib/cstruct/cstruct.cma: error loading shared library: error loading shared library: (Failure
ocsigenserver: main:   "dllcstruct_stubs.so: dlopen(dllcstruct_stubs.so, 10): image not found")
make: *** [test.byte] Error 52
rm myapp_Demo_i18n.eliom

Thanks! I have a similar error on my side on macOS.

@ilankri
Copy link
Member

ilankri commented Mar 14, 2022

Starting a fresh install following your instructions, I've had the following error:

==== The website is available at http://localhost:8080 ====
ocsigenserver "-v" -c local/etc/myapp/myapp-test.conf
ocsigenserver: ocsigen:main: Command pipe created
ocsigenserver: main: Fatal - While loading /private/var/folders/_m/q5kjpznx3434h9s08ps543540000gp/T/tmp.FiMk1lUJmK/_opam/lib/cstruct/cstruct.cma: error loading shared library: error loading shared library: (Failure
ocsigenserver: main:   "dllcstruct_stubs.so: dlopen(dllcstruct_stubs.so, 10): image not found")
make: *** [test.byte] Error 52
rm myapp_Demo_i18n.eliom

This workaround works for me: #564 (comment)

@ilankri
Copy link
Member

ilankri commented Mar 14, 2022

On the fresh install, I've managed to make it work using make test.opt instead of make test.byte! rocket What are the differences between the two commands?

make test.byte produces a bytecode executable using ocamlc whereas make test.opt produces a native-code executable using ocamlopt. Not sure, but I think that make test.opt works because it uses static linking whereas make test.byte uses dynamic linking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants