How to debug a meson.build file? - debugging

I am learning to code build "scripts" of Meson.
I have been wrote a lot of mistakes in my meson.build file, and the only method to check/debug my file is launch $ meson compile -C build and get the errors.
It is something like as debug (not debug my .cpp files the build script) or "interactive console" to write line by line the script and test my mistakes.

You have two option for that.
message : Output will be printed on terminal(stdout)
debug : Output will be printed to file /meson-logs/meson-log.txt

Related

I Cant get Ruby Packer to work and need a method to package a Ruby application

I have a ruby script that I run from the terminal, however I want to be able to double-click an icon like I would an application and run the script. I've looked at ruby-packer, but it isn't working for me.
What is the best option to accomplish this?
Im on a mac.
In terminal, I'm not at the directory of the .rb file because when I try to run ./rubyc from the directory containing the .rb file, I get the error command not recognized
When I run ./rubyc /RubyProjects/signOff.rb /signOff.out I'm able to get it to run, but the outfile file is called rubyc that just re-runs the same code when I double-click it. I'm at a loss for how to get it to work properly.
`
The -o parameter defines the output filename:
rubyc -o signOff signOff.rb

How to call a custom build tool through a batch file

While trying to setup the Cap'n Proto compiler as a custom build tool in Visual Studio 2017, I came across a curious behavior, it only seems to work when called directly and not through a batch file.
What I first tried was, for each .capnp file, set the following Custom Build Tool settings:
Command line: "$(SolutionDir)run_capnpn.bat" compile -oc++ "%(FullPath)"
Description: Executing capnp.exe on %(Identity)...
Outputs: %(Identity).c++;%(Identity).h
I made the batch file because I wanted to avoid polluting my %PATH% with the capnp folder, this is what it contains:
#echo on
echo %*
SET PATH=%PATH%;C:\GitHub\capnproto\bin\c++\src\capnp\Debug
start /wait "" capnp.exe %*
exit /b %errorlevel%
However, with this setup the Custom Build Tool was only called on 1 of the 5 capnp files in my solution (all 5 files had exactly the same settings). I know this because only one pair of generated files appeared and only one message appeared in my build log.
Even weirder, if I compiled again it would do the next file, and on the following compile it would do another file. In all, it would take 5 compiles (one per file) before it considered everything to be fully built and stop calling the custom build tool.
After much trial and error and some help from other programmers on Discord, I tried adding capnp.exe to my path and call it directly (instead of going through the batch file) so for each capnp fil I changed the command line setting to:
capnp.exe compile -oc++ "%(FullPath)"
and now it all builds correctly. Is it possible to call a custom build tool through a batch file? and if so how?

lnk1104 : cannot open file 'libpng.lib', but 'libpng.lib' is the output, not an input

I'm trying to build libpng-1.16.6 as a static lib from VS 2010. I think I've ruled out makefile syntax issues, file system permissions and incorrect LIB/LIBPATH environment variables. The makefile is the unchanged makefile.vcwin32 delivered with lpng1616. I'm certain the issue is environmental, but am out of ideas as to what it is. I'm looking for fresh ideas! TIA for any assistance.
Pertinent facts:
The overall pattern is the same I've used to build geos, gdal and wxWidgets open source projects: A Visual Studio makefile project calls a Windows command file. The Windows command file does any required preprocessing, calls vcvarsall.bar to set up the VS build environment, calls nmake, and performs any required postprocessing. The command file is largely the same, but customized, for each project. The makefile in each case is the one delivered with the source code. A successful retest of my wxWidgets build proves that there has not been an environmental change on my computer causing the libpng failure.
The log output of interest is:
lib -nologo -out:libpng.lib png.obj pngerror.obj pngget.obj pngmem.obj pngpread.obj pngread.obj pngrio.obj pngrtran.obj pngrutil.obj pngset.obj pngtrans.obj pngwio.obj pngwrite.obj pngwtran.obj pngwutil.obj
LINK : fatal error LNK1104: cannot open file 'libpng.lib'
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\lib.EXE"' : return code '0x450'
Explanation of the log output: Lib.exe is asked to produce libpng.lib from the list of object files. The error is that the output file cannot be open. At this point in the execution of the makefile all object files have been generated, which I have confirmed are present. The library is to be written in the same directory as the object files.
Since the compiler is able to write the object files, there cannot be a write permissions issue in this directory.
Starting a VS command prompt window, navigating to this path and executing the same 'lib' command line the makefile is executing succeeds. Therefore there cannot be a command line syntax error. Running the nmake from the Windows command file from this same VS command prompt also succeeds.
Adding the 'lib' commandl line to the Windows command file immediately after execution of the makefile results in the same error as when run from the makefile.
The natural conclusion is that the problem is the environment in which lib.exe is being executed.
Google results, searching on combinations of 'lib', 'link', 'lnk1104', '0x450', 'nmake', 'makefile', 'makefile.vcwin32', 'works in command line, not in makefile', etc., reveal several patterns. As one would expect, the most common problem is that one of the input files is missing or invalid. (See 3, 4, 5 and 6 above.) I haven't noticed a single case where the file cited in the error message is actually the output file, not an input file. Another common issue that something is wrong with the LIB or LIBPATH environment variables. (I've examined these, comparing the VS command prompt values with the ones from my workflow.)
I've found that apparently lib.exe writes its output to the default output name and renames to the name requested by the '-out' option. If the makefile is altered to build 'tmplibpng.lib' instead of 'libpng.lib' the same error message is generated.
I thought I was being safe. When writing Windows command files I prefix and suffix all 'internal' environment variables with underscore characters to avoid collisions, for example, 'LIB'. Apparently 'LIB' is in use by lib.exe, though it's not in Microsoft's published list. Renaming this environment variable solved my problem.

using custom build event in VS 2010

I am in the process of creating a visual studio solution to wrap the command-line portions of OCaml. In the standard OCaml make file there is the following target:
version.h : ../VERSION
echo "#define OCAML_VERSION \"`sed -e 1q ../VERSION`\"" > version.h
which I was hoping to simulate via a custom build event. I have modified my vcproj file to include the following lines:
<CustomBuildStep>
<Command>C:\Windows\System32\sed.exe -e "1 s/^/#define OCAML_VERSION " "$(SourceDir)VERSION" > "$(SourceDir)version.h"
</Command>
<Inputs>VERSION</Inputs>
<Outputs>version.h;%(Outputs)</Outputs>
<Message>Building version header file ....</Message>
</CustomBuildStep>
I do have sed installed on my system (from unxutils), and the command does work correctly from a command terminal (after macro-expansion naturally). However, when I execute it from inside Visual Studio I get the following error message:
CustomBuildStep:
Description: Building version header file ....
'C:\Windows\System32\sed.exe' is not recognized as an internal or external command,
operable program or batch file.
I've seen this problem on several forums and the proposed solution is to include the absolute path (which I did) or set the working directory to where the executable lives. Is there anything that I could do to get this to work?

Compiling pascal programs with FPC and then running them, all in Notepad++

Here's my problem
I've been searching for a while now on how to compile a pascal program in notepad, then immediately running it after a successful compile.
So far, I've managed just to find a compile script for NppExec, which goes like this :
PATH_TO_FPC\ppc386.exe "$(FULL_CURRENT_PATH)"
I've tried combining this script with another script for compiling and running C/C++ programs in notepad++
cmd /K DPATH-TO-FPC\ppc386.exe
"$(FULL_CURRENT_PATH)" -o
"$(CURRENT_DIRECTORY)\$(NAME_PART).exe"
but I always get a message, when I try to run it.
"Error: Illegal parameter: -o"
So I was wondering if anyone can help me with this, or post a complete solution if they know on a topic.
Thank You in advance.
Try to append -o with your output executable file. Which will be like this:
-o"$(CURRENT_DIRECTORY)\$(NAME_PART).exe"

Resources