Open nda-cunh opened 2 years ago
What does your Meson build look like?
its a simple meson.build :+1:
project('calculatrice', ['vala', 'c'])
vala_dep = [dependency('gtk4'), dependency('glib-2.0'), dependency('gobject-2.0')]
executable('calculatrice',
'main.vala',
dependencies : vala_dep,
install : true)
and my command compilation is just : valac main.vala --pkg=gtk4
@hydrasho could you provide a symbol dump of your executable? You can use nm
Do you not need to annotate your Vala function with [GtkCallback]
?
He dont work when i add [GtkCallback] in my code :/
@eli-schwartz didn't you recently make a change regarding the default value of gnu_symbol_visibility
? Would that have affected this?
@hydrasho please provide a symbol dump using readelf --syms <my binary>
Wait, this is an undefined symbol issue, we’re probably injecting a command line option to make that happen. What is the command line for vala in the ninja.build file?
Wait, this is an undefined symbol issue, we’re probably injecting a command line option to make that happen. What is the command line for vala in the ninja.build file?
build calculatrice.p/main.c: vala_COMPILER ../main.vala ARGS = -C --debug --debug --pkg gtksourceview-5 --pkg gobject-2.0 --pkg glib-2.0 --pkg gtk4 --color=always --directory calculatrice.p --basedir ../
build calculatrice.p/meson-generated_main.c.o: c_COMPILER calculatrice.p/main.c DEPFILE = calculatrice.p/meson-generated_main.c.o.d DEPFILE_UNQUOTED = calculatrice.p/meson-generated_main.c.o.d ARGS = -Icalculatrice.p -I. -I.. -I/usr/include/gtk-4.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/lzo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/graphene-1.0 -I/usr/lib/graphene-1.0/include -I/usr/include/gio-unix-2.0 -I/usr/include/gtksourceview-5 -I/usr/include/libxml2 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -w -O0 -g -mfpmath=sse -msse -msse2 -pthread -mfpmath=sse -msse -msse2
build calculatrice: c_LINKER calculatrice.p/meson-generated_main.c.o | /usr/lib/libcairo-gobject.so /usr/lib/libcairo.so /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libgio-2.0.so /usr/lib/libglib-2.0.so /usr/lib/libgobject-2.0.so /usr/lib/libgraphene-1.0.so /usr/lib/libgtk-4.so /usr/lib/libgtksourceview-5.so /usr/lib/libharfbuzz.so /usr/lib/libpango-1.0.so /usr/lib/libpangocairo-1.0.so LINK_ARGS = -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group /usr/lib/libgtk-4.so /usr/lib/libpangocairo-1.0.so /usr/lib/libpango-1.0.so /usr/lib/libharfbuzz.so /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libcairo-gobject.so /usr/lib/libcairo.so /usr/lib/libgraphene-1.0.so /usr/lib/libgio-2.0.so /usr/lib/libgobject-2.0.so /usr/lib/libglib-2.0.so /usr/lib/libgtksourceview-5.so -Wl,--end-group
readelf --syms
With Meson
Symbol table '.dynsym' contains 26 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_application_run
2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_print
3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterT[...]
4: 0000000000000000 0 FUNC WEAK DEFAULT UND [...]@GLIBC_2.2.5 (2)
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_signal_connect_data
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __[...]@GLIBC_2.4 (3)
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_present
8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_application_[...]
9: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND [...]@GLIBC_2.2.5 (2)
11: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_return_if_fail[...]
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_css_provider_new
13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_style_contex[...]
14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gdk_display_get_[...]
15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_builder_get_[...]
16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_object_ref
17: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_set_a[...]
18: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_builder_new_[...]
19: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_application_new
20: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_css_provider[...]
21: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_object_unref
22: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMC[...]
23: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_type_check_ins[...]
24: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_set_d[...]
25: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _[...]@GLIBC_2.34 (4)
Symbol table '.symtab' contains 64 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS abi-note.c
2: 000000000000039c 32 OBJECT LOCAL DEFAULT 4 __abi_tag
3: 0000000000000000 0 FILE LOCAL DEFAULT ABS init.c
4: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
5: 00000000000011a0 0 FUNC LOCAL DEFAULT 14 deregister_tm_clones
6: 00000000000011d0 0 FUNC LOCAL DEFAULT 14 register_tm_clones
7: 0000000000001210 0 FUNC LOCAL DEFAULT 14 __do_global_dtors_aux
8: 00000000000040c8 1 OBJECT LOCAL DEFAULT 25 completed.0
9: 0000000000003db0 0 OBJECT LOCAL DEFAULT 20 __do_global_dtor[...]
10: 0000000000001260 0 FUNC LOCAL DEFAULT 14 frame_dummy
11: 0000000000003da8 0 OBJECT LOCAL DEFAULT 19 __frame_dummy_in[...]
12: 0000000000000000 0 FILE LOCAL DEFAULT ABS main.c
13: 0000000000001269 24 FUNC LOCAL DEFAULT 14 _create_window_g[...]
14: 0000000000001281 182 FUNC LOCAL DEFAULT 14 _vala_main
15: 0000000000001359 40 FUNC LOCAL DEFAULT 14 _g_object_ref0
16: 0000000000001381 160 FUNC LOCAL DEFAULT 14 string_get_data
17: 0000000000002260 16 OBJECT LOCAL DEFAULT 16 __func__.0
18: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
19: 0000000000002400 0 OBJECT LOCAL DEFAULT 18 __FRAME_END__
20: 0000000000000000 0 FILE LOCAL DEFAULT ABS
21: 0000000000004000 0 OBJECT LOCAL DEFAULT 23 _GLOBAL_OFFSET_TABLE_
22: 0000000000003db8 0 OBJECT LOCAL DEFAULT 21 _DYNAMIC
23: 0000000000002270 0 NOTYPE LOCAL DEFAULT 17 __GNU_EH_FRAME_HDR
24: 0000000000001337 34 FUNC GLOBAL DEFAULT 14 main
25: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_application_run
26: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_print
27: 00000000000040c8 0 OBJECT GLOBAL HIDDEN 24 __TMC_END__
28: 0000000000001170 38 FUNC GLOBAL DEFAULT 14 _start
29: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterT[...]
30: 000000000000164c 0 FUNC GLOBAL HIDDEN 15 _fini
31: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@G[...]
32: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_signal_connect_data
33: 00000000000040b8 0 NOTYPE GLOBAL DEFAULT 24 __data_start
34: 00000000000040c8 0 NOTYPE GLOBAL DEFAULT 25 __bss_start
35: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __stack_chk_fail[...]
36: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_present
37: 000000000000162f 27 FUNC GLOBAL DEFAULT 14 put_zero
38: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_application_[...]
39: 00000000000040d8 0 NOTYPE GLOBAL DEFAULT 25 _end
40: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
41: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strlen@GLIBC_2.2.5
42: 0000000000001421 526 FUNC GLOBAL DEFAULT 14 create_window
43: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_return_if_fail[...]
44: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_css_provider_new
45: 00000000000040d0 8 OBJECT GLOBAL DEFAULT 25 app
46: 00000000000040c8 0 NOTYPE GLOBAL DEFAULT 24 _edata
47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_style_contex[...]
48: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gdk_display_get_[...]
49: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_builder_get_[...]
50: 0000000000001000 0 FUNC GLOBAL HIDDEN 12 _init
51: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_object_ref
52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_set_a[...]
53: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_builder_new_[...]
54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_application_new
55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_css_provider[...]
56: 00000000000040b8 0 NOTYPE WEAK DEFAULT 24 data_start
57: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_object_unref
58: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMC[...]
59: 00000000000040c0 0 OBJECT GLOBAL HIDDEN 24 __dso_handle
60: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_type_check_ins[...]
61: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_set_d[...]
62: 0000000000002000 4 OBJECT GLOBAL DEFAULT 16 _IO_stdin_used
63: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_mai[...]
Without Meson : (valac main.vala --pkg=gtk4)
Symbol table '.dynsym' contains 37 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_application_run
2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_print
3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterT[...]
4: 0000000000000000 0 FUNC WEAK DEFAULT UND [...]@GLIBC_2.2.5 (2)
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_signal_connect_data
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __[...]@GLIBC_2.4 (3)
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_present
8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_application_[...]
9: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND [...]@GLIBC_2.2.5 (2)
11: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_return_if_fail[...]
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_css_provider_new
13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_style_contex[...]
14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gdk_display_get_[...]
15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_builder_get_[...]
16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_object_ref
17: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_set_a[...]
18: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_builder_new_[...]
19: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_application_new
20: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_css_provider[...]
21: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_object_unref
22: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMC[...]
23: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_type_check_ins[...]
24: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_set_d[...]
25: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _[...]@GLIBC_2.34 (4)
26: 00000000000040b8 0 NOTYPE GLOBAL DEFAULT 24 __data_start
27: 00000000000040d8 0 NOTYPE GLOBAL DEFAULT 25 _end
28: 0000000000001421 526 FUNC GLOBAL DEFAULT 14 create_window
29: 00000000000040c8 0 NOTYPE GLOBAL DEFAULT 24 _edata
30: 0000000000001337 34 FUNC GLOBAL DEFAULT 14 main
31: 0000000000001170 38 FUNC GLOBAL DEFAULT 14 _start
32: 00000000000040c8 0 NOTYPE GLOBAL DEFAULT 25 __bss_start
33: 000000000000162f 27 FUNC GLOBAL DEFAULT 14 put_zero
34: 00000000000040d0 8 OBJECT GLOBAL DEFAULT 25 app
35: 00000000000040b8 0 NOTYPE WEAK DEFAULT 24 data_start
36: 0000000000002000 4 OBJECT GLOBAL DEFAULT 16 _IO_stdin_used
Symbol table '.symtab' contains 64 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS abi-note.c
2: 000000000000039c 32 OBJECT LOCAL DEFAULT 4 __abi_tag
3: 0000000000000000 0 FILE LOCAL DEFAULT ABS init.c
4: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
5: 00000000000011a0 0 FUNC LOCAL DEFAULT 14 deregister_tm_clones
6: 00000000000011d0 0 FUNC LOCAL DEFAULT 14 register_tm_clones
7: 0000000000001210 0 FUNC LOCAL DEFAULT 14 __do_global_dtors_aux
8: 00000000000040c8 1 OBJECT LOCAL DEFAULT 25 completed.0
9: 0000000000003d20 0 OBJECT LOCAL DEFAULT 20 __do_global_dtor[...]
10: 0000000000001260 0 FUNC LOCAL DEFAULT 14 frame_dummy
11: 0000000000003d18 0 OBJECT LOCAL DEFAULT 19 __frame_dummy_in[...]
12: 0000000000000000 0 FILE LOCAL DEFAULT ABS main.vala.c
13: 0000000000001269 24 FUNC LOCAL DEFAULT 14 _create_window_g[...]
14: 0000000000001281 182 FUNC LOCAL DEFAULT 14 _vala_main
15: 0000000000001359 40 FUNC LOCAL DEFAULT 14 _g_object_ref0
16: 0000000000001381 160 FUNC LOCAL DEFAULT 14 string_get_data
17: 0000000000002260 16 OBJECT LOCAL DEFAULT 16 __func__.0
18: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
19: 0000000000002400 0 OBJECT LOCAL DEFAULT 18 __FRAME_END__
20: 0000000000000000 0 FILE LOCAL DEFAULT ABS
21: 00000000000040c8 0 OBJECT LOCAL DEFAULT 24 __TMC_END__
22: 000000000000164c 0 FUNC LOCAL DEFAULT 15 _fini
23: 0000000000004000 0 OBJECT LOCAL DEFAULT 23 _GLOBAL_OFFSET_TABLE_
24: 0000000000003d28 0 OBJECT LOCAL DEFAULT 21 _DYNAMIC
25: 0000000000001000 0 FUNC LOCAL DEFAULT 12 _init
26: 0000000000002270 0 NOTYPE LOCAL DEFAULT 17 __GNU_EH_FRAME_HDR
27: 00000000000040c0 0 OBJECT LOCAL DEFAULT 24 __dso_handle
28: 0000000000001337 34 FUNC GLOBAL DEFAULT 14 main
29: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_application_run
30: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_print
31: 0000000000001170 38 FUNC GLOBAL DEFAULT 14 _start
32: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterT[...]
33: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@G[...]
34: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_signal_connect_data
35: 00000000000040b8 0 NOTYPE GLOBAL DEFAULT 24 __data_start
36: 00000000000040c8 0 NOTYPE GLOBAL DEFAULT 25 __bss_start
37: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __stack_chk_fail[...]
38: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_present
39: 000000000000162f 27 FUNC GLOBAL DEFAULT 14 put_zero
40: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_application_[...]
41: 00000000000040d8 0 NOTYPE GLOBAL DEFAULT 25 _end
42: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
43: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strlen@GLIBC_2.2.5
44: 0000000000001421 526 FUNC GLOBAL DEFAULT 14 create_window
45: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_return_if_fail[...]
46: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_css_provider_new
47: 00000000000040d0 8 OBJECT GLOBAL DEFAULT 25 app
48: 00000000000040c8 0 NOTYPE GLOBAL DEFAULT 24 _edata
49: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_style_contex[...]
50: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gdk_display_get_[...]
51: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_builder_get_[...]
52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_object_ref
53: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_set_a[...]
54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_builder_new_[...]
55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_application_new
56: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_css_provider[...]
57: 00000000000040b8 0 NOTYPE WEAK DEFAULT 24 data_start
58: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_object_unref
59: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMC[...]
60: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_type_check_ins[...]
61: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gtk_window_set_d[...]
62: 0000000000002000 4 OBJECT GLOBAL DEFAULT 16 _IO_stdin_used
63: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_mai[...]
put_zero
is not in the .dynsym
section in the Meson buidl. Not obvious to me what this means.
I don't want to make a Makefile just for that :/
Can you try configuring -Dc_args="-Wl,--export-dynamic"
Executable also has an export_dynamic keyword argument
with: add_project_arguments(['-Dc_args="-Wl,--export-dynamic"'], language: 'c')
still not working
that should be either add_project_link_args('-export-dynamic', language : c')
, or:
executable('calculatrice',
'main.vala',
dependencies : vala_dep,
export_dynamic : true,
install : true)
I recomend the second, as Meson will just Do The Right Thing™
it works now the functions are no longer ignored! thank you
So what is the solution on Meson's part here? Seemingly this used to work and now it doesn't unless you set export_dynamic.
hello, i found a bug in meson.build with vala.
when i give the name of a function in glade then it can call it. the problem is that it gives me the following error in vala with meson. however it is in my code:
Whereas if I compile my vala file manually (valac main.vala --pkg=gtk4) then run it it works. why with meson I have the error?