Building Erlang projects on Windows - windows

I'm looking for a way to build an Erlang project on Windows. I have Erlang installed and all project files, including makefile, cloned from GitHub. I would like to build the project as if I was using make command on Linux and run it. What tools can I use to do that?

I'd try cygwin. https://www.cygwin.com
http://erlang.org/doc/installation_guide/INSTALL-WIN32.html
You can either build erlang with cygwin or use gnu-make in combination with a native windows build of erlang

If you're asking "how do I run make in Windows?" then you can use Cygwin, the newly-available Bash shell, or the MinGW tools. These will all give you some level of ability to run make, though not every makefile will work.
If you're asking "how can I build an Erlang project using a makefile?" then you are looking for erlang.mk. Note that Rebar3 (which is configured with Erlang terms and looks nothing like a make system) was recently selected as the "official" build tool, but erlang.mk is quite popular and is well-maintained.

Related

Is it possible to run sdl2-config on Windows?

It seems there are several times when running the sdl2-config script bundled with SDL2 would be useful (such as checking which libraries need to be linked to). But it doesn't seem possible to run this script natively on Windows.
I'm using I've been using mingw for all my C compiling needs so far, if that helps. Is there any way I can run this script on Windows?
Yes, sure!
However, that script is just a Bash script, so you need to install Cygwin which has Bash built in. It is not recommended to use the native (Win10) port of the Bash shell, since it is not behaving as expected.
If you don't already have it installed, then the tricky part is how to install SDL2 using Cygwin. IMHO, that should probably be avoided, as it tend to cause a lot of weird problems (for other packages).
However, there is already a Cygwin package if you want to try it.
apt-cyg install mingw64-x86_64-SDL2 libSDL2-devel libSDL2_2.0_0 # etc

Installing Primer3

I need to install Primer3 for my research in Windows, and I really have no idea of how to go about it. I was following the instructions mentioned here.
I'm getting to the part where I need to run
mingw32-make TESTOPTS=--windows
and I keep getting an error saying:
'mingw32-make' is not recognized as an internal or external command,
operable program or batch file.
Just for reference, I went into the minGW Installation manager and got the ming32-make packages, including the bin, doc, lang, and lic ones, because I really had no idea which one was the correct one.
If someone could help me, I would be very grateful! Installing these niche programs without an installation wizard is a challenge!
You will need to install mingw32-make. This is a
Windows of port of GNU Make,
a software-build tool that is supported on all operating systems,
indeed the daddy of such tools.
But make alone will not suffice. To build primer3 you will
need a Windows port of the whole GNU toolchain for building software
from source code. Without that, running make by itself will
just expose the absence of the GCC compiler and linker that it
expects to do its bidding.
This is quite a lot of software, but it is easy and quick to install and there
are several open-source offerings. I suggest you go to TDM GCC
and download the TDM64 bundle. This will give you an executable installer.
Just run it and you will end up with the complete GNU toolchain, including,
mingw32-make, in your chosen installation directory.
It will also install in your Windows launch menu the MinGW command prompt.
Launch this and you will be presented with a Windows commandline console
with its environment set up to find and run any of the GNU tools.
In this console change directory to your primer3-X.Y.Z/test directory
and then run mingw32-make TESTOPTS=--windows as per documentation.
Be forwarned that the self-tests of primer3 that are executed to
verify the build may take 1/2 hr. to 1 hr. to run, depending on your
hardware, but they will finish successfully with the steps I've
described, barring problems specific to your machine. It is a foolproof-simple build.
All the built executables are deposited in the primer3-X.Y.Z/src
directory. You may want to move them somewhere more convenient
in in your PATH.
It does seem oddly amateurish that the documentation simply
directs you to run mingw32-make with no preliminary account of
what that is or how to install it, while on the other hand it
advises that you must install perl and strongly recommends a
specific perl distribution; but evidently primer3 is open-source
scientfic software and its documentation is not bad by the standard
of that genre.

Can Elixir or Erlang programs be compiled to a standalone binary?

It says that Elixir has a tool called elixirc and Erlang has a tool called erlc to compile modules for use. It says immediately after this that you can then run code with the elixir command line tool.
Is there a way to compile a binary executable with Elixir or Erlang? (one which I can chmod +x binary_name and then run from the same directory with ./binary_name)
Escripts support that to some extent but you still need Erlang installed in your machine. See this answer for more information: Elixir or Hex portable package format?
Make sure you checkout Distillery. It does what you need, without having to deal with Rebar.
Add this to your mix.exs file's dependencies then run mix release.
defp deps do
[{:distillery, "~> 0.9"}]
end
Their documentation is great:
Home - Distillery Documentation
You can use tools like rebar to generate a release that also contains the erts, which makes it possible to run said release on a machine where erlang is not installed. But the erts included corresponds to the operating system on which the release was built, i.e. windows binaries if built on windows.
You can use Elixir's built-in releases as of Elixir 1.9. It is a lightweight alternative to Distillery.
Caveats:
It will not create anything remotely like Go does with a single binary executable that you can run almost anywhere. Also your target will have to match the CPU architecture and OS.
To build a release run:
mix release
Read more here:
https://hexdocs.pm/mix/Mix.Tasks.Release.html
There are a few tools now that allow you to create a self contained executable binary that doesn't require any dependencies on the target machine. They support multiple platforms.
Bakeware: https://github.com/bake-bake-bake/bakeware
Burrito: https://github.com/burrito-elixir/burrito

Code::Blocks build from bash

I'm developing a C++ application in Code::Blocks.
My program has a few dependencies and has to run under Linux and Windows, this is why
I use Code::Blocks.
Now I'd like to include Travis CI for testing the builds.
On the Travis server, where I have no X11, I won't be able to run Code::Blocks. How can I build my project without Code::Blocks. (Is there a possibility to create "a Makefile" out of the .cbp-file?
This page (Code::Blocks Wiki) mentions there is a --build flag, but you need Code::Blocks & X11. Is there a server way without X11?
You can not run anything which require X11 on Travis, and as far as I know, there is no way to launch a build using Code::Blocks without requiring X11.
The best choice would be to set up your project differently, for example using a Makefile. You will be able to configure Code::Blocks to use your Makefile and also to build on Travis using the make command.
You can also consider using CMake (especially if you are not familiar with Makefile syntax, but not only). This will let you configure your project in a more high level way (compared to a Makefile), and then you will be able to generate a Makefile or a project for the IDE of your choice.
I used cbp2make (C::B Forum entry).
It is quite simple
cbp2make -in project.cbp -out Makefile
and it worked immediatly, even with a more complex configuration
than a simple command line project in Code::Blocks.
It also generates the same build targets as in Code::Blocks. For example make Release would work.
The debian package list shows only a few dependencies, so X11 is not required.

use MinGW to create exe file in windows from GNU source package

the basic idea was, I wanted to generate the call graph in text format for several c files. After googling around for long time, i found cflow, which can deliver everything I want, but it is only runable in Linux or else. Then I began to search how to compile the cflow source files on the web to a exe file. I found MinGW which should be able to do the cross-platform compilation.
After installing the MinGW and the MSYS and running the usual commands "./configure; make; make install", I simply got an error that "mkdir" was not found. Actually. Actually I was wondering whether this is the correct way to compile the whole package.
Does anyone has an idea how I can build the cflow.exe correctly in Windows? If there is a tutorial or something like this, I will be very thankful.
Song
Solution
Please try this Github repository "MinGW + MSYS build of GNU cflow 1.4" (For Windows).
https://github.com/noahp/cflow-mingw
It contains already compiled "cflow.exe",and an instruction about how to build cflow using mingw and msys.
Test
System Environment:Win 8.1 (x64)
1.I tested the "cflow.exe" downloaded from the github repository , and amazingly it worked!
2.I followed the mingw compiling instruction,and it successfully compiled "cflow 1.5".
Command:
bash configure
make
I was able to do that today. I'm using cygwin, after installing gcc, binutils, make and after downloading the gnu cflow.tar.gz, it was as easy as ./configure ; make ; make install.

Resources