Re: [hatari-devel] ASAN linking problem with Previous |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] ASAN linking problem with Previous
- From: Andreas Grabher <andreas_g86@xxxxxxxxxx>
- Date: Sun, 14 Sep 2025 22:40:12 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=zL7yQCL3SCY19Z9F2dXWruAO1R4QUvGkYf4xHFSSQ3k=; h=From:Content-Type:Mime-Version:Subject:Date:To:Message-Id:x-icloud-hme; b=zRyLGJ2+OdvdVWgZA6cP6gKZ0MyaC8tX20pKdujCODQ6Kr0LF6d/73JfTwothf6nantWC7/i+H5YDe4iibvWZckLUddUlivusPPjr7fwuzGb5+ayLTGJU3gzEPuycxCKKrDvCmK6oshC8NkkpUe0vA7W2QzN8aEeHT8z6rUyqvhGGbxhT0EI9cgPY07+X0A6heO3vJtMsF4ydvDFIUSZJvnpg30VQWDPBQ/ND79mmPuh/7uUDFBD+Ixv8CkdDqPTEC5vd7+RnKZCQXhzWxHwE+rh4+NTvng/M3nQsmbuAIrgChfhnI0mHjfbP5WFLGKRPgp3VmjBchOLEVMuM3D14w==
> 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