Giter VIP home page Giter VIP logo

Comments (13)

arch1t3cht avatar arch1t3cht commented on August 14, 2024 3

The CMake subproject violation was fixed (or, well, circumvented) with Meson 0.63.1, but another violation error still remains:
subprojects/luabins/src/meson.build:1:0: ERROR: Sandbox violation: Tried to grab file fwrite.c from a nested subproject.

It appears that with the new sandbox detection logic, any access to a file in the subprojects folder is a violation - even if that file does not belong to any subproject (see mesonbuild/meson@f08aabf). Luabins is a simple subdir, but it's located in the subprojects folder, which causes the violation.

So this can be fixed by either moving subprojects/luabins back to vendor/luabins, or by turning luabins into a proper subproject. The latter option would be the nicer one, but it would require copying some of the luajit detection logic to the subproject's build file to obtain the include directory.

from aegisub.

arch1t3cht avatar arch1t3cht commented on August 14, 2024

For posterity, here are the CI's logs for the MSVC build:
msvc_ci_build.txt

from aegisub.

eli-schwartz avatar eli-schwartz commented on August 14, 2024

This sounds like mesonbuild/meson#10566

This technically both is and isn't a regression.

  • It used to work, but now it doesn't.
  • cmake support is considered "best effort, we hope it works" but per https://mesonbuild.com/Mixing-build-systems.html a bug in cmake support would not be considered a release blocker. We'll still try to fix it though.

The underlying issue seems to be that the cmake module's parsing of cmake subprojects and creation of an autogenerated meson.build based on it (to serialize the cmake rules into meson ones) doesn't take into account the sandbox model, and cannot really handle cmake configure_file() as a configure-time rule -- properly speaking it "should" be translated into a meson configure_file() but that's probably impossible without a hand port at which point it becomes a meson subproject instead.

Because the file is configured, it's in the build directory, but Meson expects build directory files to be passed as return values of the functions that create them, which in the case of cmake is "oh haha no actually that's not how it works, cmake is a build system not a meson function".

This can probably be fixed by our resident cmake expert / module maintainer, who I'm hoping to hear back from soon. In the meantime, I guess your options are:

  • use system versions of those dependencies, e.g. by building them manually with cmake in CI, then finding them as regular dependencies
  • port those subprojects to Meson, lots of work but ultimately robust
  • pin meson in CI for now, and keep an eye on that ticket, then wait for a meson point release

Option 3 is likely the most appealing, although I doubt anyone would be surprised if I shill for option 2.

from aegisub.

CoffeeFlux avatar CoffeeFlux commented on August 14, 2024

Thanks for the explanation! I'll watch the linked issue for mensinda's response. In the meantime, option 3 sounds like the way to go.

from aegisub.

rcombs avatar rcombs commented on August 14, 2024

I feel like I'm missing something incredibly obvious here, but… is there a reason you can't just make a rule that shells out to cmake --build, then use the artifacts produced by that? That's how every case of one build system calling into another I've ever seen works; I don't see the point of having meson poke around at another build system's internals and try to replicate what it would've done if it'd actually been run normally.

from aegisub.

eli-schwartz avatar eli-schwartz commented on August 14, 2024

subdir('subprojects/luabins/src')

Hmmm...

BTW, I'm not sure why you need any detection logic? The luajit wrap provides a luajit dependency and that's all you need, I guess... if you want to allow finding system luajit and check that it's the right one, but fall back to the subproject, then I guess you could still use meson.override_dependency() to ensure that the subproject one takes over as the only result for dependency('luajit').

It's incorrect to pass around luajit_inc anyway:

Aegisub/meson.build

Lines 296 to 300 in 8336c7d

luajit_inc = luajit_sp.get_variable('src_inc')
deps += luajit_sp.get_variable('luajit_dep')
else
luajit_inc = include_directories(luajit.get_variable('includedir'))
endif

Just use

luajit_inconly = juajit_dep.partial_dependency(compile_args: true, includes: true)

But you can do that in the luabins subproject. I'm not sure why it matters in practice since it's a static library and only used in a target that adds luajit to dependencies: but there you have it.

from aegisub.

CoffeeFlux avatar CoffeeFlux commented on August 14, 2024

I'm not sure why you need any detection logic

A lot of distros will compile luajit without the flags we need, specifically 5.2 support.

I guess you could accomplish the same thing with override_dependency?

from aegisub.

stefba avatar stefba commented on August 14, 2024

So this can be fixed by either moving subprojects/luabins back to vendor/luabins

I did it this way and adjusted the path in the meson.build file and it finally compiled. 🙏

from aegisub.

Siberiawind avatar Siberiawind commented on August 14, 2024

Update meson version from 0.63.0 to 1.0.0 can fix this problem.

from aegisub.

FichteFoll avatar FichteFoll commented on August 14, 2024

Building still fails for me with meson 1.0.0 and current master (via AUR):

==> Starting prepare()...
'subprojects/luajit' -> '../../luajit'
Re-applying patchfiles overlay for luajit...
mkdir: created directory 'subprojects/packagecache'
'subprojects/packagecache/gtest-1.8.1.zip' -> '../../../gtest-1.8.1.zip'
'subprojects/packagecache/gtest-1.8.1-1-wrap.zip' -> '../../../gtest-1.8.1-1-wrap.zip'
+ exec meson setup --prefix /usr --libexecdir lib --sbindir bin --buildtype plain --auto-features enabled --wrap-mode nodownload -D b_lto=true -D b_pie=true builddir -Dportaudio=disabled -Dopenal=disabled
The Meson build system
Version: 1.0.0
Source dir: /build/aegisub-ttools-meson-git/src/aegisub-ttools
Build dir: /build/aegisub-ttools-meson-git/src/aegisub-ttools/builddir
Build type: native build
Project name: Aegisub
Project version: 3.2.2
C compiler for the host machine: cc (gcc 12.2.1 "cc (GCC) 12.2.1 20230111")
C linker for the host machine: cc ld.bfd 2.40
C++ compiler for the host machine: c++ (gcc 12.2.1 "c++ (GCC) 12.2.1 20230111")
C++ linker for the host machine: c++ ld.bfd 2.40
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program tools/version.sh found: YES (/build/aegisub-ttools-meson-git/src/aegisub-ttools/tools/version.sh)
Found pkg-config: /usr/bin/pkg-config (1.8.0)
Run-time dependency fontconfig found: YES 2.14.2
Library m found: YES
Library dl found: YES
Run-time dependency iconv found: YES
Run-time dependency libass found: YES 0.17.0
Run-time dependency Boost (found: chrono, filesystem, locale, regex, system, thread) found: YES 1.81.0 (/usr)
Run-time dependency zlib found: YES 1.2.13
wx-config found: YES (/usr/bin/wx-config) 3.2.1
Run-time dependency WxWidgets found: YES 3.2.1
Run-time dependency icu-uc found: YES 72.1
Run-time dependency icu-i18n found: YES 72.1
Run-time dependency libpulse found: YES 16.1
Run-time dependency alsa found: YES 1.2.8
Run-time dependency ffms2 found: YES 2.40.0
Run-time dependency fftw3 found: YES 3.3.10
Run-time dependency hunspell found: YES 1.7.2
Run-time dependency uchardet found: YES 0.0.8
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency luajit found: NO (tried pkgconfig and cmake)
Message: System luajit not found; using built-in luajit

Executing subproject luajit

luajit| Project name: luajit
luajit| Project version: 2.1.0
luajit| C compiler for the host machine: cc (gcc 12.2.1 "cc (GCC) 12.2.1 20230111")
luajit| C linker for the host machine: cc ld.bfd 2.40
luajit| Library dl found: YES
luajit| Library m found: YES
luajit| Library readline found: YES
luajit| Fetching value of define "LJ_ARCH_BITS" : 64
luajit| Fetching value of define "LJ_HASJIT" : 1
luajit| Fetching value of define "LJ_HASFFI" : 1
luajit| Build targets in project: 11
luajit| Subproject luajit finished.


subprojects/luabins/src/meson.build:1:0: ERROR: Sandbox violation: Tried to grab file fwrite.c from a nested subproject.

A full log can be found at /build/aegisub-ttools-meson-git/src/aegisub-ttools/builddir/meson-logs/meson-log.txt

Edit: Applying tgoyne/aegisub@5832ffc gets through the sandbox violation but building then fails because of incompatibilities with boost 1.81.

from aegisub.

sl1pkn07 avatar sl1pkn07 commented on August 14, 2024

hi, relating this (after apply tgoyne patch). for me, fails because meson is unable to build the rule "make luajit.h" necessary for build luajit iself

Found ninja-1.11.1 at /usr/bin/ninja
INFO: autodetecting backend as ninja                                                                                                                                                                                                                                    
INFO: calculating backend command to run: /usr/bin/ninja -C /tmp/makepkg/sl1-aegisub-git/src/aegisub/build -j 1 -v
ninja: Entering directory `/tmp/makepkg/sl1-aegisub-git/src/aegisub/build'
[1/390] /tmp/makepkg/sl1-aegisub-git/src/aegisub/tools/version.sh /tmp/makepkg/sl1-aegisub-git/src/aegisub/build /tmp/makepkg/sl1-aegisub-git/src/aegisub
[2/390] cc -Isubprojects/luajit/src/host/minilua.p -Isubprojects/luajit/src/host -I../subprojects/luajit/src/host -flto=auto -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -DLUAJIT_ENABLE_LUA52COMPAT -DENDIAN_LE -DLUAJIT_OS=LUAJIT_OS_LINUX -march=native -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fPIE -MD -MQ subprojects/luajit/src/host/minilua.p/minilua.c.o -MF subprojects/luajit/src/host/minilua.p/minilua.c.o.d -o subprojects/luajit/src/host/minilua.p/minilua.c.o -c ../subprojects/luajit/src/host/minilua.c
[3/390] cc  -o subprojects/luajit/src/host/minilua subprojects/luajit/src/host/minilua.p/minilua.c.o -flto -Wl,--as-needed -Wl,--no-undefined -pie -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -march=native -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wl,--start-group -ldl -lm -Wl,--end-group
[4/390] /tmp/makepkg/sl1-aegisub-git/src/aegisub/build/subprojects/luajit/src/host/minilua ../subprojects/luajit/src/host/../../dynasm/dynasm.lua -D P64 -D JIT -D FFI -o subprojects/luajit/src/host/buildvm_arch.h ../subprojects/luajit/src/host/../vm_x64.dasc
[5/390] cc -Isubprojects/luajit/src/host/buildvm.p -Isubprojects/luajit/src/host -I../subprojects/luajit/src/host -Isubprojects/luajit/src -I../subprojects/luajit/src -flto=auto -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -DLUAJIT_ENABLE_LUA52COMPAT -DENDIAN_LE -DLUAJIT_OS=LUAJIT_OS_LINUX -march=native -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fPIE -MD -MQ subprojects/luajit/src/host/buildvm.p/buildvm.c.o -MF subprojects/luajit/src/host/buildvm.p/buildvm.c.o.d -o subprojects/luajit/src/host/buildvm.p/buildvm.c.o -c ../subprojects/luajit/src/host/buildvm.c
FAILED: subprojects/luajit/src/host/buildvm.p/buildvm.c.o 
cc -Isubprojects/luajit/src/host/buildvm.p -Isubprojects/luajit/src/host -I../subprojects/luajit/src/host -Isubprojects/luajit/src -I../subprojects/luajit/src -flto=auto -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -DLUAJIT_ENABLE_LUA52COMPAT -DENDIAN_LE -DLUAJIT_OS=LUAJIT_OS_LINUX -march=native -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fPIE -MD -MQ subprojects/luajit/src/host/buildvm.p/buildvm.c.o -MF subprojects/luajit/src/host/buildvm.p/buildvm.c.o.d -o subprojects/luajit/src/host/buildvm.p/buildvm.c.o -c ../subprojects/luajit/src/host/buildvm.c
../subprojects/luajit/src/host/buildvm.c:31:10: error fatal: luajit.h: No existe el fichero o el directorio
   31 | #include "luajit.h"
      |          ^~~~~~~~~~
compilación terminada.
ninja: build stopped: subcommand failed.

a workgrond is run make luajit.h beween meson setup and meson compile like:

  meson build aegisub aegisub/build
 -D somefooo

  (
  cd aegisub/subprojects/luajit/src
  make luajit.h
  )

  meson compile -C aegisub/build

after this. and apply before this patch for boost issues https://gitweb.gentoo.org/repo/gentoo.git/tree/media-video/aegisub/files/3.2.2_p20160518/aegisub-3.2.2_p20160518-fix-boost-181-build.patch. aegisub "builds ok." .. y say betheen "" because meseon configure fails when detect systemwide luajit installed, but not with the requeriments specified by aegisub. leading mix build and link with systemwide ones

sl1-aegisub-git E: Dependency luajit detected and not included (libraries ['usr/lib/libluajit-5.1.so.2'] needed in files ['usr/bin/aegisub'])

a little hack for this is:

sed "s|>=2.0.0|>=3.0.0|g" -i aegisub/meson.build

sorry, i can't found other method like cmake "-DFoo_FOUND=OFF" does but for meson

sorry if i not explain better

greetings

from aegisub.

arch1t3cht avatar arch1t3cht commented on August 14, 2024

A proper fix for luajit switching to rolling releases is here arch1t3cht@4a97bb0

from aegisub.

arch1t3cht avatar arch1t3cht commented on August 14, 2024

The luabins sandbox violation was fixed in 7aa9e19 .

from aegisub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.