mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.39k stars 1.55k forks source link

Python traceback when I run meson setup --backend xcode #10193

Closed jonancm closed 2 years ago

jonancm commented 2 years ago

Describe the bug

When I try to set up a build directory with the Xcode backend, I get the following traceback:

Traceback (most recent call last):
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/mesonmain.py", line 146, in run
    return options.run_func(options)
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/msetup.py", line 294, in run
    app.generate()
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/msetup.py", line 185, in generate
    self._generate(env)
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/msetup.py", line 247, in _generate
    intr.backend.generate()
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/backend/xcodebackend.py", line 302, in generate
    self.generate_pbx_file_reference(objects_dict)
  File "/Users/jonancm/Library/Caches/pypoetry/virtualenvs/testapp-gtkmm3-UQ0_I4tI-py3.8/lib/python3.8/site-packages/mesonbuild/backend/xcodebackend.py", line 825, in generate_pbx_file_reference
    s = os.path.joni(t.subdir, s)
AttributeError: module 'posixpath' has no attribute 'joni'

This is clearly caused by a misspelling of the word join.

To Reproduce

  1. Create the following empty files:

    • main.c
    • ui.gresources.xml
  2. Create a meson.build file with the following content:

    project('xcode-test', 'c')
    
    gnome = import('gnome')
    ui_resources = gnome.compile_resources(
     'ui_resources',
     'ui.gresource.xml',
     source_dir : 'res/ui',
    )
    
    exe = executable('xcode-test', 'main.c')
  3. Set up a build with the Xcode backend

    meson setup build --backend xcode

Expected behavior

An Xcode project is created successfully, without any Python tracebacks.

system parameters

Debugging information

I debugged this with ipdb by setting a breakpoint at mesonbuild/backend/xcodebackend.py:825:

ipdb> b mesonbuild/backend/xcodebackend.py:825

The error arises when Meson is processing the argument 'ui.gresource.xml' to gnome.compile_resources:

    824                 elif isinstance(s, str):
1-> 825                     s = os.path.joni(t.subdir, s)
    826                 else:

ipdb> print(s)
res/ui.gresource.xml

I've also located 3 occurrences of this bug in 0.61.3:

https://github.com/mesonbuild/meson/blob/5cf5575a7c76746935dcd9a9e380803c85023c04/mesonbuild/backend/xcodebackend.py#L825

https://github.com/mesonbuild/meson/blob/5cf5575a7c76746935dcd9a9e380803c85023c04/mesonbuild/backend/xcodebackend.py#L945

https://github.com/mesonbuild/meson/blob/5cf5575a7c76746935dcd9a9e380803c85023c04/mesonbuild/backend/xcodebackend.py#L978

As of now, the bug persists in the latest master (commit 86aaac8e4229608b25508027267f49624a9a8cb5).

eli-schwartz commented 2 years ago

8649 #8671

So good to know that xcode has comprehensive testsuite coverage. :D Perhaps if we installed more testsuite dependencies. EDIT: right, that's still not running in CI is it.