eliom icon indicating copy to clipboard operation
eliom copied to clipboard

Ocamlbuild plugin fails to correctly link in modules in cmxs for ocisgenserver.opt

Open rand00 opened this issue 7 years ago • 0 comments

The bytecode-version works fine, running the ocsigenserver executeable. The problem happens when having an extra module linked into the cmxs while running ocsigenserver.opt. I get the following error:

ocsigenserver.opt: ocsigen:main: Fatal - Error in configuration file: Error while parsing configuration file: Eliom: while loading _build/server/app.cmxs: error loading shared library: /foo/_build/server/app.cmxs: undefined symbol: camlBar__1
Makefile:2: recipe for target 'server' failed
make: *** [server] Error 50

Files

./app.eliom:

[%%shared
    open Eliom_lib
    open Eliom_content
    open Html5
    open Html5.F
]

let title = "Foo" 

module Foo_app =
  Eliom_registration.App (
    struct
      let application_name = "app"
    end)

let main_content s = body [
  h1 [pcdata s]
]

let main_content = main_content (Bar.v)
(* let main_content = main_content "nobar" *)

let main_service =
  Eliom_service.App.service ~path:[] ~get_params:Eliom_parameter.unit ()

let () =
  Foo_app.register
    ~service:main_service
    (fun () () ->
       Lwt.return
         (Eliom_tools.F.html ~title
          @@ main_content 
         ));

./bar.ml:

let v = "bar"

./Makefile:

server: build
    ocsigenserver.opt -v -c config/server_opt.xml
#   ocsigenserver -v -c config/server.xml

browse:
    sensible-browser http://localhost:8080
    make server

build:
    ocamlbuild.native -use-ocamlfind \
        -plugin-tags 'package(eliom.ocamlbuild)' \
        server/app.cma \
        server/app.cmxa \
        server/app.cmxs \
        client/app.js 
    @ln -sf ../_build/client/app.js public/app.js

clean:
    rm -f public/app.js
    ocamlbuild -clean

.PHONY: server build clean

./config/server_opt.xml:

<ocsigen>
  <server>
    <port>8080</port>

    <logdir>log</logdir>
    <datadir>data</datadir>
    <charset>utf-8</charset>

    <commandpipe>tmp/run/cmd</commandpipe>
    <extension findlib-package="ocsigenserver.ext.staticmod"/>
    <extension findlib-package="ocsigenserver.ext.ocsipersist-sqlite"/>
    <extension findlib-package="eliom.server"/>

    <host hostfilter="*">
      <static dir="public" />
      <eliommodule module="_build/server/app.cmxs" />
      <eliom/>
    </host>

    <debugmode/>
  </server>
</ocsigen>

Edit: I got the native version working with eliomopt and js_of_eliom while trying to diagnose this (but then other problems happen when having source-files lying in subdirectories...)

rand00 avatar Oct 22 '16 16:10 rand00