I tried to build this project: https://github.com/frenetic-lang/fattire, but after installing the dependencies and running $ make, I get the error make: .\configure: Command not found
I am using omap package manager and tried to build the project with OCaml 4.03.0.
What is the problem here?
To build an OASIS package from scratch issue the following commands
oasis setup
ocaml setup.ml -configure
ocaml setup.ml -build
ocaml setup.ml -install
Usually, package maintainers make the first step themselves and commit to the repository the generated files, and often they provide a Makefile together with the ./configure scripts. In OP case the package is broken and some pregenerated files are missing, so it is easier to build it from scratch.
Related
I'm working on c++ project on a linux machine and it uses several boost libraries. I've installed them on my system using vcpkg and build it using the toolchain provided by vcpkg. My question is:
How do I define the dependencies so that they automatically install on a different system, if they were to build it?
Conan has a way of doing it by defining the dependencies in conanfile.txt. How do I do the same with vcpkg?
Edit1: I've found autovcpkg which does the job I'm looking to do but can the same be done natively inside cmakelists.txt or by vcpkg itself?
If you have vcpkg as a submodule for your project, define a manifest for the libraries you want vcpkg to build, and are using the vcpkg CMake toolchain - then you will get everything you want.
Adding vcpkg as a submodule means that your users don't need to install it themselves, the CMake toolchain will install it on your behalf. It also means that you can fix the package versions
Using a manifest file is how you programmatically tell vcpkg which packages to get and build during a CMake configuration phase
Using a CMake toolchain file is the only way to tie this into your project's build system
$ git clone .../my_project
$ cd ./my_project
$ git submodule update --init
$ mkdir ../build
$ cd ../build
$ cmake ../my_project
-- Running vcpkg install
-- Running vcpkg install - done
...
I've found autovcpkg which does the job I'm looking to do but can the same be done natively inside cmakelists.txt or by vcpkg itself?
You can write a vcpkg port for your library or executable by providing a CONTROL and portfile.cmake file. In the CONTROL file you define all the dependencies and possible features while the portfile contains the build instruction. You can use vcpkg create <myport> <url> <filename> to create the CONTROL and portfile.cmake from a template which can be customized to your needs.
Together with a port-overlay this port can also be used by others without being merged into vcpkg/master
I'm trying to install a linear programming solver in ocaml, but i can't get any modules to work
I found this : https://github.com/Gbury/Ocaml-simplex
and this : https://github.com/smimram/ocaml-glpk
I'm just following what's written to do (make / make install) but evertytime after the installation, when i try to open Glpk or open Simplex it's not working. In fact even the examples files included are not working
I don't know if I'm doing something wrong or if those modules are just not working
Please help me I'm becoming mad.
Additional information on my problem:
I'm on Debian, the last version I guess. To install the modules, I downloaded the zip files, i installed the required modules, then unzipped, ./configure, make, make install, just what's written on GitHub.
But then when i open an example test files, which begins by open Glpk (the module I'm trying to install), when i try to compile i've an error :
open Glpk
^^^^
Error: Unbound module Glpk
I mean I've found 3 modules to make linear programming solver:
https://github.com/OCamlPro-Iguernlala/ocplib-simplex
https://github.com/Gbury/Ocaml-simplex
https://github.com/smimram/ocaml-glpk
And I can't get any of them to work.
From your description, your issue is not installing libraries but using them. Once you have installed a library, you still need to inform the compiler on where are the compiled interfaces files (.cmi) for this library, and which object files should be linked (aka .cm(x)o and .cm(x)a) .
It will be much easier to let a package manager (like opam) and a build tool (like dune) take care of those minutiæ.
For instance, with opam and dune, you can first install ocplib-simplex:
opam install simplex
Then building a executable from a main.ml file using this library can be done with a dune file
(executable (name main) (libraries ocplib-simplex) )
and a call to
dune build main.exe
I managed to get Glpk working in no time. I think you should learn a bit about OPAM, the OCaml Package Manager. Its purpose is exactly to make library installation as easy as possible. Here's a step-by-step:
Prerequisites
I'm going to assume you have OPAM installed. If this is not the case, you'll find the information you need here. The easiest way to get OPAM working is to execute the following in a shell:
sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) && \
opam init && \
eval $(opam env)
Installing Glpk
First, I tried to install Glpk as is.
opam install glpk
This failed with following error:
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build glpk 0.1.8
└─
╶─ No changes have been performed
The packages you requested declare the following system dependencies. Please make sure they are installed before retrying:
libglpk-dev
This is because the OCaml library Glpk is actually a binding to a system library which needs to be installed separately. On Debian, you can use apt to do this.
sudo apt install libglpk-dev
Then I retried installing Glpk.
opam install glpk
It succeeded. Great.
Requiring Glpk
Now that the Glpk library is installed, you need to require it in order to make it available.
In a REPL
When using the OCaml toplevel, you need to use the following commands in order to require Glpk.
#use "topfind";;
#require "glpk";;
In a project
If you want to use libraries in a fully-fledged project (with multiple files, executables and whatnot), you should use a build system. The most popular OCaml build system today is Dune, which Octachron covered in his answer.
Further considerations
You should consider reading Real World OCaml, a great book that teaches from the ground up everything you need to know to build software with OCaml.
How to compile C++ gRPC code for Android? I have seen several tutorials on how Protobuf itself can be compiled using the Android Native Development Kit, such as in the answer from Swapnil: How to integrate/install latest c++ protobuf (3.2) with Android NDK?
Or Google protobuf and Android NDK
But how to How to compile C++ gRPC code that is using Protobuf as well for Android? Taking into account that there's 20K lines of gRPC Makefile.
I do it with dockcross (which does not do anything fancy, it just sets up the toolchain in a convenient way).
Say for android-arm (but it works for android-arm64, android-x86 and android-x86_64 just the same):
$ git clone https://github.com/grpc/grpc --recursive
$ cd grpc
$ docker run --rm dockcross/android-arm > ./dockcross-android-arm
$ chmod +x dockcross-android-arm
$ ./dockcross-android-arm cmake -DgRPC_BUILD_CODEGEN=OFF -Bbuild -S.
$ ./dockcross-android-arm cmake --build build
It will build all the dependencies in the gRPC submodules. It should work in your project if you add gRPC as a submodule (well, up to some point depending on your transitive dependencies situation, I guess).
This said, I am not a big fan of using git submodules for dependencies with CMake. Instead I like to build the dependencies separately and have my project find them with find_package. I explain that in more details here, and more importantly I have an example doing exactly that for gRPC here.
I've done it here.
In brief: git submodule gRPC C++, add "CMakeLists.txt" file to your project on how to build C++ gRPC (and your code that uses it), add a externalNativeBuild/cmake it to your "build.gradle" - voila!
I've been trying to build and install gRPC with cmake. Building the project went relatively smoothly with ninja after some confusion related to acquiring nuget packages and updating the git submodules.
I am having trouble installing gRPC though. After reading the cmake file I discovered that you need to manually set the gRPC_INSTALL cache variable to ON in order for cmake to generate an install target. After doing this I can invoke the install target and the libraries and headers and cmake config files are emplaced. But the cmake targets file is missing, and it isn't even being generated. The config file is simple, all it does is call the targets file:
include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake)
But it doesn't look like the CMakeLists file in gRPC is even attempting to generate this file, unless I am missing something? You can't even build the example cpp project in the gRPC repo with cmake because when it tries to find the gRPC package, the config file fails to find gRPCTargets.cmake. So what is the proper way to build, install, and link to gRPC with cmake? I am on Windows but that shouldn't matter with cmake.
on OSX:
run these command:
cd grpc
mkdir -p cmake/build
cd cmake/build
cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2r -DOPENSSL_LIBRARIES=/usr/local/Cellar/openssl/1.0.2r/lib ../..
make install
I just download poppler to Linux system,and I want to incorporate it in my app to parse pdf file.
(My goal is to convert pdf file to plain text.)
How can I do this?
Poppler's git tree includes a useless INSTALL doc that just tells you to run ./configure, but they don't include automake/autoconf auto-generated files (including configure) in git. (Probably they do include them in tarball source releases.)
I just built poppler from git source (on Ubuntu 15.04) like so:
git clone --depth 50 --no-single-branch git://git.freedesktop.org/git/poppler/poppler
cmake -G 'Unix Makefiles' # other -G options are to generate project files for various IDEs
# look at the output. If it didn't find some libraries,
# install them with your package manager and re-run cmake
make -j4
# optionally:
sudo make install
It appears that they maintain an autoconf/automake build setup, so you can use that OR cmake to create a Makefile.
If you just want to see if the latest git poppler works better than the distro package, you don't need to sudo make install, you can just run utils/pdftotext or whatever right from the source directory. It apparently tells the linker to embed the build path into the binary, as a library search path, so running /usr/local/src/poppler/utils/pdftotext works, and finds /usr/local/src/poppler/libpoppler.so.52.
If the latest poppler does work better than the distro-packaged poppler, you should install it to /usr/local/bin with sudo make install. When you upgrade to the next version of your distro, check your /usr/local. Often the new distro version will be newer than when you built it from source, so you should just remove your version from /usr/local/{bin,share,lib,man,include}. (Or make uninstall in the source dir, if supported).
Their website explains it very clearly :
Poppler is available from git. To clone the repository use the following command:
git clone git://git.freedesktop.org/git/poppler/poppler
Once you download the source code, read the INSTALL file where it says :
cd to the directory containing the package's source code and type
./configure to configure the package for your system.
Type `make' to compile the package.
Type `make install' to install the programs and any data files and
documentation.
Since some time has passed and it seems there was some uncertainty, I also took a look.
At the end of 2021, their homepage says
We run continuous integration via the gitlab CI
I checked out their .gitlab-ci.yml which has many build tasks. It would seem these days we build libpoppler like this:
git clone git://git.freedesktop.org/git/poppler/test test.repo
mkdir -p build && cd build
cmake -DTESTDATADIR=`pwd`/../test.repo -G Ninja ..
ninja