-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: initial support for meson build system #902
base: master
Are you sure you want to change the base?
Conversation
generator( | ||
find_program('cp', 'xcopy'), | ||
output: ['@PLAINNAME@'], | ||
arguments: ['@INPUT@', '@OUTPUT@'], | ||
).process(qjs_hdrs), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is import('fs').copyfile()
for this. Though I'm confused why you're copying the header at all. Although it seems like you're doing this to try to put the header into a unique directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generator puts this into the target's private directory, and i reused that for declare_dependency
to expose only the public headers.
i agree this is dirty. it should be better to change the directory structure, but @saghul might want to comment on this first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the directory structure is not on the table, sorry.
Many users still embed QuickJS by directly referencing the handful of files and we'd like to keep it that way for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understandable.
The other workaroud people will use for this it to have an include/meson.build
that does the copying so that it gets laid out correctly in the working directory. This is a long standing but thorny issue for us (Meson) to fix.
meson.build
Outdated
qjsc_exe = executable( | ||
'qjsc', | ||
qjsc_srcs, | ||
qjs_libc_srcs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause all of these sources to be re-compiled for the executable, but then it seems like you link them back in via the qjs_dep
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qjs_libc_srcs == []
if -Dlibc=true
, since it's already compiled in the main qjs_lib
.
this variable is here to explicitly add quickjs-libc
to required targets. is it better to use qjs_libc_lib = static_library(...)
and then add link_whole: qjs_libc_lib
to qjs_lib
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applied the qjs_libc_lib
thing.
I saw your comments on the wrap proposal, and thought I might take a peak at what you where working on. |
Prior art: #761 |
24aba70
to
42cb912
Compare
I'm the author of mesonbuild/wrapdb#1865 . Then initial motivation is that we do not want to add |
Personally I'm still on the fence about adding Meson support here. If wrapdb is there then users already have a good way forward. |
I'm mildly negative on the changes to the Makefile. A meson build file, okay, but only if I don't have to look at it or think about it too much. For testing it, I'd add a CI job. |
From Meson's perspective we would prefer if meson.build files could live upstream, even with a lower level of support that $main_build_system. WrapDB can still reference projects with upstream meson.build files to make |
LGTM from a meson is correct point of view |
@bnoordhuis whats your appetite towards this? I'm somewhere around -0.5 |
Regarding changes to the |
@chqrlie Please let's keep this about meson. |
I'm okay with merging it provided it's close-to-zero effort to maintain. I don't care for it myself but there's no denying meson is pretty popular nowadays. Having said that, since wrapdb exists, is there a compelling reason to have the build file in this repo? |
Having them upstream means that your users can use git snapshots and git submodules as subprojects, that’s not possible with meson files hosted in wrapdb |
That's a good reason. @saghul, up to you. |
Alright, let's give it a try. I'll give it a deeper look this week. What this PR is missing is a few CI jobs, to make sure this thing works at all :-) |
sure, i will add it |
should I add this to a separate workflow or just |
Same file, new jobs. |
3c67859
to
d5deb43
Compare
clang sanitized builds fail with: |
In quickjs-libc? Any way to get more output from the meson runners? They seem to output to a file. |
Can you try if this helps? diff --git a/quickjs-libc.c b/quickjs-libc.c
index e784878..c8892d2 100644
--- a/quickjs-libc.c
+++ b/quickjs-libc.c
@@ -170,9 +170,15 @@ typedef struct JSThreadState {
static uint64_t os_pending_signals;
+static void *js_std_dbuf_realloc(void *opaque, void *ptr, size_t size)
+{
+ JSRuntime *rt = opaque;
+ return js_realloc_rt(rt, ptr, size);
+}
+
static void js_std_dbuf_init(JSContext *ctx, DynBuf *s)
{
- dbuf_init2(s, JS_GetRuntime(ctx), (DynBufReallocFunc *)js_realloc_rt);
+ dbuf_init2(s, JS_GetRuntime(ctx), js_std_dbuf_realloc);
}
static bool my_isdigit(int c) |
Looks like tests are failing here now: |
Can meson be configured to just print the test output instead of logging it to a file? I don't want to download and unzip a file every time something goes wrong. The test failure suggests somehow the async function job didn't get scheduled, although I have no idea how that could happen. |
@bnoordhuis addressed in c354670 |
I wonder if we simply don't run that test under any sanitizer in the cmake build. |
It's tested under both asan+ubsan and msan and passes successfully. |
@mochaaP does the test fail or pass locally for you? |
Can you spots what do the failed jobs have in common? |
.github/workflows/ci.yml
Outdated
# ASLR with big PIE slides does not work well with [AM]San | ||
- name: disable ASLR | ||
if: ${{ matrix.platform == 'ubuntu-latest' && contains(matrix.mode.name, 'san') }} | ||
run: | | ||
sudo sysctl -w kernel.randomize_va_space=0 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# ASLR with big PIE slides does not work well with [AM]San | |
- name: disable ASLR | |
if: ${{ matrix.platform == 'ubuntu-latest' && contains(matrix.mode.name, 'san') }} | |
run: | | |
sudo sysctl -w kernel.randomize_va_space=0 |
Should not be necessary anymore after 9c25179
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
meson.build
Outdated
# Interrupt test | ||
test( | ||
'interrupt', | ||
executable( | ||
'interrupt-test', | ||
'interrupt-test.c', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was renamed in 22cd6ab.
# Interrupt test | |
test( | |
'interrupt', | |
executable( | |
'interrupt-test', | |
'interrupt-test.c', | |
# API test | |
test( | |
'api', | |
executable( | |
'api-test', | |
'api-test.c', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
'bigint64_arith', | ||
'bigint256_arith', | ||
] | ||
benchmark( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does this run? If the CI doesn't exercise it, it's virtually guaranteed to get out of sync sooner or later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added.
…suppress clang sanitize warnings Co-authored-by: Saúl Ibarra Corretgé <[email protected]>
After a few days of troubleshooting, seems the tests will only fail with -O0 on clang. Should we use debugoptimized instead? |
Initial support for meson build system.
I plan to maintain this port continuously alongside cmake.
suppoted features
removed per request on build: initial support for meson build system #902 (comment)make BUILD_BACKEND=meson
xrefs
mesonbuild/wrapdb#1865
#761
tested