companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.0 released(!!1!): https://ocaml.org/releases/5.0.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Tuplanolla has quit [Quit: Leaving.]
nkatte has quit [Remote host closed the connection]
xd1le has quit [Quit: xd1le]
nfc has quit [Server closed connection]
nfc has joined #ocaml
rwmjones has quit [Server closed connection]
rwmjones has joined #ocaml
waleee has quit [Ping timeout: 246 seconds]
octachron has quit [Server closed connection]
octachron has joined #ocaml
tengu1 has joined #ocaml
pie_ has quit [Server closed connection]
pie_ has joined #ocaml
szkl has joined #ocaml
deadmarshal_ has quit [Server closed connection]
deadmarshal_ has joined #ocaml
Anarchos has joined #ocaml
Serpent7776 has joined #ocaml
landonf has quit [Server closed connection]
landonf has joined #ocaml
bartholin has joined #ocaml
mro has joined #ocaml
tengu1 has quit [Quit: Client closed]
bartholin has quit [Quit: Leaving]
yziquel has joined #ocaml
szkl has quit [Quit: Connection closed for inactivity]
jlrnick has joined #ocaml
yziquel has quit [Ping timeout: 250 seconds]
yziquel has joined #ocaml
yziquel has quit [Quit: Ping timeout (120 seconds)]
dnh has joined #ocaml
jlrnick has quit [Ping timeout: 260 seconds]
anpad has quit [Quit: ZNC 1.8.2 - https://znc.in]
anpad has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
edr has joined #ocaml
bartholin has joined #ocaml
Anarchos has joined #ocaml
<Anarchos> strange bug of my OS uncovered by opam : when opam launches dune (by execve()), it can do it from a thread which is not the process main thread (a notion specific to my OS), leading to an error 'Operation not allowed' ; POSIX don't prevent to run execve from other threads than the first or principal one (whatever it can means) of the process.
rwmjones has quit [Ping timeout: 246 seconds]
rwmjones has joined #ocaml
euouae has joined #ocaml
terrorjack has quit [Server closed connection]
terrorjack has joined #ocaml
waleee has joined #ocaml
esum has joined #ocaml
mro has quit [Remote host closed the connection]
CO2 has quit [Quit: WeeChat 4.1.1]
justache has quit [Quit: ZNC 1.8.2 - https://znc.in]
justache has joined #ocaml
<euouae> Hello
<euouae> Is there some particular issue for which I can't define an ocaml module such as Foo_bar_baz?
justache has quit [Remote host closed the connection]
<euouae> I see in the examples of Dune there's modules such as Hello_world but if I try with 3 words it simply can't find the module
<euouae> and I can't understand this bug at all
<euouae> (if a bug?)
<companion_cube> huuuu
<companion_cube> is your file `foo_bar_baz.ml`?
justache has joined #ocaml
<euouae> companion_cube: I use (modules)
<companion_cube> (modules foo_bar_baz)?
<euouae> companion_cube: if you take hello_world.t and run a sed on `s/hello_world/foo_bar_baz/g` and `s/Hello_world/Foo_bar_baz/g` you'll get the error (also replace the .opam file)
<euouae> from dune/example
<euouae> e.g. `rm hello_world.opam && find . -exec sed -e 's/hello_world/foo_bar_baz/g' 's/Hello_world/Foo_bar_baz/g' -i {} \; && touch foo_bar_baz.opam && dune build`
<euouae> err add a -type f in `find` to avoid trying to sed directories
<euouae> ah wait, so the issue _was_ the file
<euouae> sigh. sorry. thanks!
<companion_cube> :)
<euouae> companion_cube: is it a bug if dune segfaults if I mess with _build?
<companion_cube> no
<companion_cube> don't mess with _build :p
<euouae> okay
<euouae> another question is, can a package depend on another?
<euouae> I was trying to have 1 package be an OCaml library and another package be a C .so library depending on the former. I thought the packages would be named `foo-ocaml` and `foo-c` or some such thing.
<companion_cube> in dune? yeah
<companion_cube> hmmm you want a .so that uses OCaml internally?
<companion_cube> I've never done that, I must say
<euouae> I've already figured out how to do it
<euouae> but I'm trying to decouple the sources and not have everything in one directory
<euouae> within a single project, right? how do I declare such a dependency between two ocaml packages?
<euouae> I mean, dune packages
<octachron> Like any other libraries
<euouae> does (package) have (libraries)?
<octachron> `package` is a notion for the package manager, `dune` handles libraries.
<octachron> (mostly)
<octachron> (currently)
<euouae> I really don't understand the role of name/public_name/modules
<euouae> I don't get why I can't have foo.ml and declare it a different public_name and have (modules foo)
<euouae> anyway I'll try what you're suggesting with the library dependency
<octachron> `modules` is the list of modules that are part of the library or executable being defined.
<euouae> so I need explicit `module Foo = struct ...` stuff in my .ml files?
<octachron> no?
<euouae> eh, I'm terribly confused
<octachron> `name` is the name of the library, whereas `public_name` is the name of the library as a package or package component.
CO2 has joined #ocaml
<euouae> so why can't I name it `bar` and have it be defined in a foo.ml file?
<euouae> with (library (public_name bar) (modules foo))
<octachron> The contents of the foo.ml file describes the content of the module Foo.
<euouae> okay so I define a library Bar with modules Foo?
<octachron> You are defining a library `Bar` which contains a submodule `Bar.Foo` whose contents is defined in `foo.ml`
<octachron> (since there is no name the `name` is assumed to be the same as the `public_name`)
<euouae> I see, libraries and modules collide for the top-level name
<euouae> and name is what the library internally uses while public_name is what the package manager uses for dependencies?
justache is now known as justThanks
<octachron> Indeed a library name is a module name too.
<octachron> This is the name used by dune for dependencies, whereas `public_name` is indeed just at the destination of the package manager.
<euouae> I see, so name is what is used internally in the project in the dune files
m5zs7k has quit [Ping timeout: 255 seconds]
<octachron> yep, and for private components you don't need public_name.
m5zs7k has joined #ocaml
<euouae> What can I say -- maybe I'm not the sharpest. Probably dune would benefit from more examples. I'll get around to writing some. Right now I'm writing a blog post for a very particular setup -- Coq to OCaml to C. If I can get it done I'll post it here and you can see (companion_cube) how to do the .so thing
<euouae> thank you for the help
<euouae> later I might try to PR some examples
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bacam has quit [Server closed connection]
bacam has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<euouae> but why do I get errors about using a public_name that is not a package name?
<euouae> do I need to add scope?
<euouae> pkg_name.mod_name
<companion_cube> public_name must always be `foo` or `foo.bar` where `foo` is one of the packages
<euouae> okay, how do I make an executable part of a package?
<companion_cube> I think with `(package foo)` in the executable stanza
<euouae> hm. yeah. with public_name
<euouae> something is strange here again
<euouae> I have (modes (native shared_object)) and I get Error: No installable mode found for this executable. When public_name is set, one of the following modes is required: - exe - native - byte - byte_complete
<companion_cube> hmmmmmmmmmmm 😅
<companion_cube> I guess `shared_object` isn't for public executables??? idk
<companion_cube> you probably should ask on a dune channel (discord, or their github issues)
<companion_cube> or comb through the docs
<euouae> Does it make sense to you that shared_object wouldn't be for public executables? :P
<euouae> I actually have this /working/ when I use a single package
<companion_cube> I have no idea tbh
<euouae> it's only when I'm stuck having to use (package) because there's more than one package that I get this error
<euouae> This one really sounds like a bug to me
<euouae> unfortunate that they have discord, I'll try github issues
<companion_cube> discord isn't official iirc
<euouae> I figured it out!
<euouae> Apparently the idea of using the 'executable' stanza for producing the .so is erroneous. I had found that online a while ago and I went along with it
<euouae> but now I realize that I can use the 'library' sanza instead.
<companion_cube> oh yeah, makes sense
<companion_cube> I _suspect_ that executable might be .so for stuff like ppx drivers
<euouae> and that still allows me to produce a shared object
<euouae> I don't know anything about ppx
<euouae> I'm coming from a different world :P
<companion_cube> stay that way :p
<euouae> haha
<euouae> in the (package) definitions
<euouae> what does it mean to use (depends ...) such as (depends ocaml dune)?
<euouae> It means opam must install ocaml and dune before attempting to install the package, right?
<companion_cube> this is in `dune-project`, where for each package you declare opam deps, yeah
<companion_cube> well it's not going to install ocaml (most likely; ocaml should be installed)
<octachron> The package stanza is essentially describing the opam package
<companion_cube> but it will install dune first.
Anarchos has joined #ocaml
<euouae> great, thank you
<euouae> now I have used public_headers from the library stanza to include the C header
<euouae> and I performed a `opam switch create .` together with an `eval $(opam env)`
<euouae> I'm seeing a `_opam/lib/foo/CAPI/cstub.h` and a `_opam/lib/stublibs/dllCAPI_stubs.so`
<euouae> so something is not clear to me, how would I compile a C file that does #include <CAPI/cstub.h>?
<euouae> or does that also need to be managed from dune?
<euouae> normally headers go under some include/ directory, not lib/
<euouae> for instance, <https://termbin.com/r7mi>.
<euouae> this is with opam-installer
<euouae> As you can see, when I install foo, it installs the header file under /usr/local/lib/, which is the wrong place for headers
<euouae> also I'm confused why the library .so starts with dll* as its name, shouldn't it be `lib` on unix targets? I thought it only used dll within dune/opam, but not when installed
<companion_cube> hmm I have no idea about the C stubs, sorry
<euouae> I'll go with this to the GH issues page
bibi_ has quit [Server closed connection]
bibi_ has joined #ocaml
<esum> Hello, is there a way to have the toplevel outputs errors (uncaught exceptions) on stderr instead of stdout while in interactive mode ?
<euouae> you could catch all exceptions and write them to stderr instead
<esum> That would be ok for me, thanks!
<euouae> Does that help you or are you still wondering how to do it?
mro has joined #ocaml
dnh has joined #ocaml
<esum> I know how to do it, I just didn't think about this solution before you suggested it.
<euouae> nice!
<discocaml> <contextfreebeer> does Dune have something like global opens?
<companion_cube> `(flags :standard -open Foo)` can be used
<discocaml> <contextfreebeer> Cool, thanks
Anarchos has quit [Quit: Vision[]: i've been blurred!]
CO2 has quit [K-Lined]
euouae has quit [Remote host closed the connection]
yoyofreeman has joined #ocaml
mro_ has joined #ocaml
mro has quit [Remote host closed the connection]
Anarchos has joined #ocaml
mro_ has quit [Quit: Leaving]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
kurfen has quit [Ping timeout: 264 seconds]
kurfen has joined #ocaml
kurfen_ has joined #ocaml
kurfen has quit [Ping timeout: 260 seconds]
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
Tuplanolla has joined #ocaml
bartholin has quit [Quit: Leaving]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
szkl has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
Serpent7776 has quit [Ping timeout: 240 seconds]
<discocaml> <gantsev.denis> does anyone knows how to handle C -`union`s with `cstruct` ? I can't find related documentation
<discocaml> <gantsev.denis> I guess i ll do unions manually
Tuplanolla has quit [Quit: Leaving.]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]