Saturday, February 17, 2018

First try on vala


It has been for quite few years that I know about Vala. I don't remember exactly how or why I run into it. I believe I spent a bit of time reading about it and was thinking this is exactly the language I would like to use for all my personal project.

I am not sure that thought will change or not. But here are few things I like about Vala the first time I learn about it:
  It is open source.
  It is cross-platform ( Windows and Linux). 
  It supports class in a way similar to C# and Java instead of C++
    - even though I like C++'s native look.
  It can do GUI in the way of classes - through GUI packages.

For this article, I will just describe the steps I took to finally test the first vala program. I try to follow the instructions I could find. But, somehow, I do run into few problems that bothered me a bit. I did get them resolved but I am not totally confident that is what suppose to happen or if I missed something obvious.

I Started with Vala installation instruction for Windows. But that call for installing the MSYS2 system first. The instruction for installing MSYS2 can be found here. The instruction call for running the command line command: 'pacman -Syuu'. Few articles pointed out that the pacman was a package manage command used by Arch Linux and this lead me to read the man page at here. Unfortunately, reading that does not give me the confidence that the -Syuu is the correct option to use and this lead me to suspect that I probably should be looking for reference information about the pacman command on MSYS2 related websites. At this point, I haven't found appropriate references but I do know that -Syuu seems to lead me to finish test the first Vala program. After finishing with MSYS2, I headed bake to the Vala installation instruction for windows page and installed the following Vala packages in MSYS2:

pacman -S mingw-w64-x86_64-gcc 
pacman -S mingw-w64-x86_64-pkg-config
pacman -S mingw-w64-x86_64-vala

I then headed to this page to test the first Vala program.

After creating the program file, I issued the Valac command to compile the program and the shell returned that Valac is not recognized as a command. This give the hint that this maybe caused by the path variable in MSYS2 shell environment. Checking the syntax for setting path in Linux, I entered the following command:
    $ export PATH=$PATH:PathToMSys2/mingw64/bin/
and that solved the problem and a .exe file was generated.

To test the .exe file, I started a DOS window and typed in
>my_first_program
which failed with a message of missing .dll file.

After modify the DOS path with this command:
path=PathToMSys2\mingw64\bin;%path
I was able to run the .exe file successfully.

* Since I uses the zipped file instead of the installer file to install the MSYS2, It seems reasonable that the path info would not presented in MSYS2 or DOS even though I do need to run the package management program, which could detect the path and setting the path info for both MSYS2 and DOS environment.


End


No comments:

Post a Comment