Re: [hatari-devel] ASAN linking problem with Previous

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]



> Am 14.09.2025 um 19:33 schrieb Thomas Huth <th.huth@xxxxxxxxx>:
> 
> Am Sat, 13 Sep 2025 21:15:54 +0200
> schrieb Andreas Grabher <andreas_g86@xxxxxxxxxx>:
> 
>>> Am 13.09.2025 um 20:51 schrieb Thomas Huth <th.huth@xxxxxxxxx>:
>>> 
>>> Am Sat, 13 Sep 2025 09:01:10 +0200
>>> schrieb Andreas Grabher <andreas_g86@xxxxxxxxxx>:
>>> 
>>>> Hello all,
>>>> 
>>>> it seems Previous is having a linking problem if ASAN is enabled. When I try to compile I get lots of error from this kind (see below). This happens although I added enable_testing() just like Hatari does.
>>>> 
>>>> Does anyone have an idea what I might do wrong? If I apply the appended patch it seems to work. No problems when compiling Hatari.  
>>> 
>>> No clue ... it seems to work when I compile Previous on Linux, so likely
>>> something specific to macOS?
>>> 
>>> Thomas
>>> 
>> Interesting! Did you compile trunk?
> 
> Ah, well, no, I compiled your softloat branch, out of habit. But looks like
> you already commit your fix there. When I compile trunk on Linux, I also
> get these linking errors.
> 
> I guess it's because you're using C++ code in Previous, so the linking is
> done in C++ mode. But the logic in CMakeLists.txt currently only adds the
> flag to the CFLAGS, not to the CXXFLAGS.
> 
> A patch like this seems to fix the issue, too:
> 
> --- CMakeLists.txt	(Revision 1727)
> +++ CMakeLists.txt	(Arbeitskopie)
> @@ -216,6 +216,7 @@
> 	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all")
> 	# enable AddressSanitizer with global variable tracking
> 	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-common")
> +	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
> endif(ENABLE_ASAN)
> 
> # GCC/Clang undefined behavior debugging
> 
> HTH,
>  Thomas
> 
Thank you very much for finding the problem! It works now.

I already translated most of the C++ code to C. I may do that for the remaining C++ parts at some point.

Andreas





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/