Skip to content
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

Prepare for changes in wxWidgets 3.3 #1343

Merged
merged 2 commits into from
May 18, 2024

Conversation

Jertzukka
Copy link
Contributor

wxWidgets 3.3 which is going to be released this autumn according to the roadmap, is going to introduce some ABI breakage. This PR is going to suggest changes that ensure that when 3.3 hits the distro repositories, VeraCrypt will build against it.

Main breakage is caused by our reliance on implicit conversions from wxString, and as of this commit and the commit mentioned in it's message, wxWidgets 3.3 defaults to using STL classes which require explicit conversions, so our implicit conversions won't build anymore.

Another change in 3.3 caused the header for wxScopedPtr not being included anymore through our other includes. wxScopedPtr is deprecated and upstream recommends using STL smart pointers instead, so instead of re-including the header for the deprecated function, we can just change it to std::unique_ptr and avoid the include.

These changes mainly increase verbosity, explicitness and won't affect building against 3.2 which VeraCrypt currently uses. These changes make building against current wxWidgets master branch possible (with few small Makefile changes).

wxScopedPtr was included previously through some header hierarchy which as of 3.3 is
no longer the case causing it to break. But instead of including a header for a deprecated
function explicitly, just move to std::unique_ptr as recommended by upstream.
As of wxWidgets/wxWidgets@35c35c2
wxWidgets defaults to STL classes, which has a side-effect that
some implicit conversions break. This patch converts those conversions
to explicit in anticipation of wxWidgets 3.3 release.
@idrassi
Copy link
Member

idrassi commented May 18, 2024

Thank you for these proactive changes. I'm merging them.

can please share what kind of Makefile changes will be needed?

@idrassi idrassi merged commit 114624b into veracrypt:master May 18, 2024
@Jertzukka
Copy link
Contributor Author

Thank you for these proactive changes. I'm merging them.

can please share what kind of Makefile changes will be needed?

WX_CONFIGURE_FLAGS += --enable-unicode -disable-shared --disable-dependency-tracking --enable-exceptions --enable-std_string --enable-dataobj --enable-mimetype

Parameters --enable-unicode (see wxWidgets/wxWidgets@a60c9b0) and --enable-std_string (see wxWidgets/wxWidgets@be7860c) are removed, which makes wxbuild fail with these options. If I understand the bash mess in the wxWidgets configure correctly, both of these values were already enabled by default in 3.2.2.1, so I don't think removing these options would affect our current build configuration. You should be safe to remove them.

@idrassi
Copy link
Member

idrassi commented May 18, 2024

Thank you for sharing these details, very clear now.

By the way, I'm battling a crash of VeraCrypt GUI build in text mode (--text) when building and running under Ubuntu 24.04 (which ships version 3.2.4). The binary by the command "make" crashes when run with "veracrypt --text --test". gdb shows this:

#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff6a4526e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff6a288ff in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff6a297b6 in __libc_message_impl (fmt=fmt@entry=0x7ffff6bce8d7 "%s\n") at ../sysdeps/posix/libc_fatal.c:132
#6  0x00007ffff6aa8fe5 in malloc_printerr (str=str@entry=0x7ffff6bd1ac0 "double free or corruption (out)")
    at ./malloc/malloc.c:5772
#7  0x00007ffff6aab110 in _int_free_merge_chunk (av=0x7ffff6c03ac0 <main_arena>, p=0x7fffffffd620, size=140736951495520)
    at ./malloc/malloc.c:4676
#8  0x00007ffff6aab42a in _int_free (av=0x7ffff6c03ac0 <main_arena>, p=<optimized out>, have_lock=<optimized out>)
    at ./malloc/malloc.c:4646
#9  0x00007ffff6aadd9e in __GI___libc_free (mem=0x7fffffffd630) at ./malloc/malloc.c:3398
#10 0x00007ffff796bfb9 in UpdatePreferDark (value=value@entry=0x7fffe0002730) at ./src/gtk/settings.cpp:202
#11 0x00007ffff796c136 in wxSystemSettingsModule::OnInit (this=<optimized out>) at ./src/gtk/settings.cpp:1240
#12 wxSystemSettingsModule::OnInit (this=<optimized out>) at ./src/gtk/settings.cpp:1200
#13 0x00007ffff730fe76 in wxModule::Init (this=0x555555b6b410) at ./include/wx/module.h:33
#14 wxModule::DoInitializeModule (module=0x555555b6b410, initializedModules=...) at ./src/common/module.cpp:137
#15 0x00007ffff73106b8 in wxModule::InitializeModules () at ./src/common/module.cpp:168
#16 0x00007ffff72f89dd in DoCommonPostInit () at ./src/common/init.cpp:270
#17 0x00007ffff72f9195 in wxEntryStart (argc=<optimized out>, argv=<optimized out>) at ./src/common/init.cpp:336
#18 0x00007ffff72f9365 in wxInitialize (argc=<optimized out>, argv=<optimized out>) at ./src/common/init.cpp:532
#19 0x00007ffff72f94a0 in wxInitializer::wxInitializer (argv=<optimized out>, argc=<optimized out>, this=<synthetic pointer>)
    at ./include/wx/init.h:92
#20 wxEntry (argc=<optimized out>, argv=<optimized out>) at ./src/common/init.cpp:467
#21 0x0000555555685e09 in main (argc=3, argv=0x7fffffffde18) at Unix/Main.cpp:107

The crash is caused by a double-free inside wxWidgets code but I cannot find the reason. Previous versions of wxWidgets under Ubuntu 23.10 and old didn't cause any issues in text mode for GUI binary.

Any help is more than welcomed.

@Jertzukka
Copy link
Contributor Author

@idrassi I can replicate your issue with 3.2.4 from Ubuntu 24.04 repos and the tarball downloaded from their original 3.2.4 Github release. Though if I build against latest stable, wxWidgets 3.2.5, I'm having no issues. In 3.2.5 they introduced a patch Fix crash with GTK3 if console program is using a GUI wxApp class (#24081). which references wxWidgets/wxWidgets#24081. This commit wxWidgets/wxWidgets@8ea22b5 most likely fixed the crash issue in text mode.

The 3.2.5 release is only a week old, so it might take a while until Ubuntu has it in their repositories. Meanwhile I'd recommend building any new binaries against a self-compiled 3.2.5, and as the 3.2 branch is ABI compatible with eachother, there shouldn't be any problems (?)

I can also see a problem with my own testing and how I didn't notice this issue earlier as the tests are only run in Release mode and I always compile with DEBUG=1.

@idrassi
Copy link
Member

idrassi commented May 20, 2024

Thanks @Jertzukka for the quick feedback. Amazing find!

I agree that using self-compiled wxWidgets is the way to go for Ubuntu 24.04. I will give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants