[Mesa-dev] dumb meson questions

Jose Fonseca jfonseca at vmware.com
Sat Mar 9 12:24:33 UTC 2019


Did you build LLVM yourself.  In my experience, passing

        -DCMAKE_C_FLAGS="-g1 -fno-omit-frame-pointer" \
        -DCMAKE_CXX_FLAGS="-g1 -fno-omit-frame-pointer" \

to cmake when building LLVM makes debugging info much smaller, without compromising the ability to get stack traces, etc.

Jose

________________________________
From: mesa-dev <mesa-dev-bounces at lists.freedesktop.org> on behalf of Brian Paul <brianp at vmware.com>
Sent: Wednesday, March 6, 2019 15:46
To: Kenneth Graunke
Cc: mesa-dev at lists.freedesktop.org
Subject: Re: [Mesa-dev] dumb meson questions

On 03/06/2019 01:18 AM, Kenneth Graunke wrote:
> On Tuesday, March 5, 2019 10:20:10 PM PST Dave Airlie wrote:
>> On Wed, 6 Mar 2019 at 14:01, Brian Paul <brianp at vmware.com> wrote:
>>> I guess I don't fully understand a few things about the new meson build.
>>>
>>> 1. I'm trying to build the gallium VMware driver with this:
>>>
>>> export BUILD_DIR=build-meson-dri
>>>
>>> mkdir "${BUILD_DIR}"
>>>
>>> meson -Dshared-llvm=false \
>>>            -Dplatforms=x11,drm \
>>>            -Dgallium-drivers=svga \
>>>            -Dvulkan-drivers= \
>>>            "${BUILD_DIR}"
>>>
>>> ninja -C "${BUILD_DIR}"
>>>
>>> When it's done, there is no vmwgfx_dri.so driver file. So libGL
>>> complains that it can't find the svga driver (nor swrast).  I must be
>>> missing something.
>>
>> I don't think meson got the install in place stuff carried over, so I
>> think everyone does --prefix= somewhere
>> and that should create the vmwgfx_dri.so which will be a link to the
>> libgallium_dri.so you've found.
>
> Right.  Running 'ninja' and 'ninja install' together, for the entire
> project, is still faster than the old 'make' system (at least with an
> SSD)...so we didn't bother with the custom lib/ symlinks.
>
> I wrote a wrapper script for ninja that makes it easy to work with
> multiple build trees, can also automatically 'ninja install', and
> which can be run from anywhere in your git repository:
>
> https://nam04.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~kwg%2Fnj%2Fplain%2Fnj&data=02%7C01%7Cjfonseca%40vmware.com%7C68873d3170214283bd2f08d6a24aea95%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C636874839986720161&sdata=bQLVu4ZVREZaXrg%2BCi6ZmGsz5PGYYsOVV5qP%2FsGIKJs%3D&reserved=0
>
> In my setup, I do:
>
> $ mkdir -p build/debug/install
> $ meson --buildtype=debug --prefix=$PWD/build/debug/install \
>    -Ddri-drivers=i965 -Dgallium-drivers=iris -Dvulkan-drivers=intel \
>    -Dglvnd=true -Dtools=intel,nir,glsl,intel-ui build/debug
>
> $ mkdir -p build/release/install
> $ CFLAGS='-O3 -g -fno-omit-frame-pointer -march=native' \
>    CXXFLAGS='-O3 -g -fno-omit-frame-pointer -march=native' \
>    meson --buildtype=release --prefix=$PWD/build/release/install \
>    -Ddri-drivers=i965 -Dvulkan-drivers=intel -Dgallium-drivers=iris \
>    -Dglvnd=true build/release
>
> Then,
>
> $ nj
>
> from anywhere in your Mesa repo will build and install the build/debug
> tree.  Or to use the build/release tree:
>
> $ nj release
> $ nj release clean
>
> You can simply point LD_LIBRARY_PATH at mesa/build/debug/install/lib to
> use your newly built Mesa (instead of pointing it at the old mesa/lib).
>
> For simpler projects, nj also works with a single 'build' directory
> (with no subdirectories), and it can also do in-tree builds if you're
> using CMake (say for Piglit).
>
> Hope this helps!

Yeah, doing a 'ninja install' with a few other tweaks to my script
solves the issue.  Thanks, Ken!


I'd like to point out that the Mesa doc page for Meson doesn't even
mention 'ninja install' despite the title of the page being "Compilation
and *Installation* using Meson"

Perhaps someone can fix that.  It would also be helpful to have a few
concrete examples of meson/ninja commands for common configurations.


>
>>> 2. When the build completes I see that there's a libgallium_dri.so file
>>> that's HUGE:
>>>
>>> $ ls -l build-meson-dri/src/gallium/targets/dri/libgallium_dri.so
>>>
>>> -rwxr-xr-x 1 brianp users 726507584 Mar  5 20:47
>>> build-meson-dri/src/gallium/targets/dri/libgallium_dri.so*
>>>
>>>
>>> 726MB seems a bit excessive.  The libvdpau_gallium.so and
>>> libxatracker.so libraries are also about that size.  What's the story there?
>>
>> meson build debug by default, I expect you've gotten a bunch of that.
>>
>> Dave.
>
> I suspect it also has to do with static LLVM.  Mine is only 49M with
> debugging symbols...

Yeah, that occurred to me too later.  But when I don't specify static
LLVM I get tons of undefined LLVM symbols:

[...]
src/gallium/auxiliary/libgallium.a(gallivm_lp_bld_tgsi.c.o): In function
`lp_build_action_set_dst_type':
/home/projects/Mesa-gitlab/mesa/build-meson-dri/../src/gallium/auxiliary/gallivm/lp_bld_tgsi.c:94:
undefined reference to `LLVMTypeOf'
/home/projects/Mesa-gitlab/mesa/build-meson-dri/../src/gallium/auxiliary/gallivm/lp_bld_tgsi.c:91:
undefined reference to `LLVMVoidTypeInContext'
[...]

I have LLVM 7.0 installed and see both static and dynamic libraries in
my /usr/local/lib/

-Brian
_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fmesa-dev&data=02%7C01%7Cjfonseca%40vmware.com%7C68873d3170214283bd2f08d6a24aea95%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C636874839986720161&sdata=rSEibPOGXAgtZJbNIHAQzFHZW%2Bycbva9tmNHygM6nIE%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190309/16658a63/attachment.html>


More information about the mesa-dev mailing list