1

Some years ago on Ubuntu 16.0.4 I've used this library: git clone https://github.com/Beckhoff/ADS and using only the make command I got build, compile and finally on the main directory I found a file called AdsLib-Linux.a and maybe nothing more than this.

Now I'm on Ubuntu 20.04 I need this library once again but this times make dosn't produce the same output and looking forth to the ReadMe instructions I finally used that instead of make:

meson build
ninja -C build

That now create a new directory build but no .a file as before on the root directory. Instead a new file in the build directory libADSLib.a is there. The same thing happens using right the make command.

Maybe the author changed over the years something on the config files or the behavior of the tools have changed, but I cannot get the former file anymore and I need it for other referencing code that now is not executing anymore.

Looking to the MakeFile I found that in the example folder, differently from the one on the parent directory, the MakeFile has something like that:

$(warning ATTENTION make is deprecated and superseeded by meson)
...
${PROGRAM}: LIB_NAME = ../AdsLib-${OS_NAME}.a
...

But all i've tried reading the guides on meson and ninja about setup, configure, build, and so on, did not produce anymore that file.

I've tried also to first build and then copy all files form the example folder to the parent directory and then build again, but again no .a file there.

How's the right way to configure the build process corectly so that this -Linux.a file is created. Or if not possibile anymore, what does it now produce I can use instead of what produced before?

2 Answers2

0

Meson is a build system generator, similar to CMake or somewhat like ./configure, you need to run meson, then run ninja to actually build something.

You need to run both meson and ninja:

meson setup builddir
ninja -C builddir

Once you do that successfully, there will be a libAdsLib.a inside the builddir directory.

dcbaker
  • 643
  • 2
  • 7
  • That's fine but the question is: how do I get once again the AdsLib-Linux.a? – Davide Mannone Sep 26 '21 at 23:16
  • The project has renamed the file it's now called libAdsLib.a, but it's the same lib – dcbaker Sep 27 '21 at 03:28
  • That's fine. Right for learn sometihng more about meson and build: could you show where this is visible and how to change it for example again in the former name? – Davide Mannone Sep 28 '21 at 08:47
  • There's a line: ```meson adslib = static_library('AdsLib', [common_files, router_files], include_directories: inc, ) ``` that `'AdsLib'` is the name of the library, if it's appropriate for the platform (like linux, *BSD, etc) meson will add `lib` automatically. You can edit the meson.build to rename the target. – dcbaker Oct 09 '21 at 22:04
0

Let me correct a bit @dcbaker, according to their README you should setup build as build directory:

# configure meson to build the library into "build" dir
meson build

# let ninja build the library
ninja -C build

Of course, in general, it shouldn't be specific, but their example code is written in a weird way so this path is hard-coded. So, to use the example:

# configure meson to build example into "build" dir
meson example/build example

# let ninja build the example
ninja -C example/build

# and run the example
./example/build/example

About the library: it's now libAdsLib.a and produced in build directory. The name is set here and it's now in linux naming style, the old one - not. So, you have options:

  1. Update your configuration/build files (Makefile?) where you use it

  2. Copy or make symbolic link, e.g.

    $ ln -s <>/build/libAdsLib.a <target_path>/AdsLib-Linux.a

Above it's very dependent on your development environment, do you have installation or setup scripts for it? do you permissions to modify/configure parameters for target application? do you need to support both old and new names? - many questions not related to original question about meson.

pmod
  • 10,450
  • 1
  • 37
  • 50
  • That's fine and very clear, thank you! For the solutions, thanks also to @dcbaker's response I reached to the same 2nd conclusion making a link. So, even if the files are still there it is not more possible to reproduce the former behavior. – Davide Mannone Oct 05 '21 at 22:07
  • @DavideMannone please accept the answer as I see you are satisfied with it – pmod Aug 31 '23 at 17:12