GithubHelp home page GithubHelp logo

lean4-alloy's People

Contributors

badly-drawn-wizards avatar iacore avatar tydeu 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

Watchers

 avatar  avatar  avatar  avatar

lean4-alloy's Issues

Link Library

Hi, alloy sounds nice!

I wonder, how does one link a library -- in particular, with gcc for example, I would add the flag -lsqlite3 to link the library and make its symbols available. How would I add a -l flag using alloy?

For example
sudo apt install sqlite3-dev

import Alloy.C
open scoped Alloy.C

alloy c include <lean/lean.h> <sqlite3.h> <stdio.h>

alloy c extern
def sqliteversion : BaseIO UInt32 :=
  printf("%s\n", sqlite3_libversion())
  return lean_io_result_mk_ok(lean_box(0))
$ lake build
...
error: stderr:
ld.lld: error: undefined symbol: sqlite3_libversion
>>> referenced by Sqlite.alloy.c:6 (./.lake/build/ir/Sqlite.alloy.c:6)
>>>               ./.lake/build/ir/Sqlite.alloy.c.o:(_alloy_c_l_sqliteversion)
...
/home/dr/.elan/toolchains/leanprover--lean4---4.6.0/bin/lean: symbol lookup error: ./.lake/build/lib/libSqlite-1.so: undefined symbol: sqlite3_libversion

How to ensure that C_INCLUDE_PATH is respected by clangd started by Alloy?

My Lean4 LSP starts with a C_INCLUDE_PATH variable set. This is inherited by the clangd server started by alloy (checked through /proc/<clang-pid>/environ), but it doesn't pick up on the sqlite.h file in that include path.

If I edit a c file using the clangd LSP directly, it finds the header.

A lake build is fine though. ๐Ÿคท

lake build does not rebuild alloy

It seems that if I change my .lean file (Seccomp.lean), it does not rebuild the .alloy.c. file. I can make it do so by deleting it explicitly.

Here, loogle is an executable using Seccomp, and Seccomp.lean has been changed:

~/build/lean/mathlib4 $ lake build loogle
[258/374] Building Seccomp
[372/374] Building Loogle.Main
~/build/lean/mathlib4 $ lake build +Seccomp:alloy.c
~/build/lean/mathlib4 $ rm ./build/ir/Seccomp.alloy.c
~/build/lean/mathlib4 $ lake build +Seccomp:alloy.c
Generating Seccomp alloy
~/build/lean/mathlib4 $ lake build loogle
[370/374] Compiling Seccomp alloy
[371/374] Linking Seccomp
[372/374] Building Loogle.Main
[374/374] Linking loogle

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.