Am Sat, 18 Sep 2021 10:34:49 -0400
schrieb Scott Kostyshak <skost...@lyx.org>:

> > I tried but failed. The problem is that tex2lyx uses
> > libzlibstatic.a, ../../lib/libsupport.a to link with, but these are 
> > compiled with
> > -fsanitize. So the only way is to define dummy versions as Jean-Marc 
> > pointed out.  
> 
> Thank you for trying, Kornel!
> 
> Scott
> 

Actually it was pretty easy. According to the error message,
        undefined reference to `typeinfo for lyx::xml::FontTag'
looked wrong, since it is defined in xml.h. But  src/tex2lyx/dummy_impl.cpp used
FontTag _and_ did not include it xml.h.

So inserting this include cured the compilation for me.

        Kornel
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f36784a858..21ba80083c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -234,10 +234,11 @@ LYX_OPTION(PROFILE              "Build with options for gprof" ${DefaultLyxProfi
 LYX_OPTION(EXTERNAL_BOOST       "Use external boost" ${DefaultExternalLibs} GCC)
 LYX_OPTION(PROGRAM_SUFFIX       "Append version suffix to binaries" ON GCC)
 LYX_OPTION(DEBUG_GLIBC          "Enable libstdc++ debug mode" OFF GCC)
 LYX_OPTION(DEBUG_GLIBC_PEDANTIC "Enable libstdc++ pedantic debug mode" OFF GCC)
 LYX_OPTION(STDLIB_DEBUG         "Use debug stdlib" ${DefaultLyxStdlibDebug} GCC)
+LYX_OPTION(DEBUG_SANITIZE	"Enable sanitize check" OFF GCC)
 
 # MSVC specific
 LYX_OPTION(CONSOLE               "Show console on Windows" ON MSVC)
 LYX_OPTION(VLD                   "Use VLD with MSVC" OFF MSVC)
 LYX_OPTION(WALL                  "Enable all warnings" OFF MSVC)
@@ -724,10 +725,15 @@ else()
 	else()
 		set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Set release flags" FORCE)
 	endif()
 endif()
 
+if (LYX_DEBUG_SANITIZE)
+    set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -fsanitize=undefined")
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
+endif()
+
 if(LYX_ASAN)
     set(CMAKE_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -g ${CMAKE_CXX_FLAGS}")
     message(STATUS)
     message(STATUS "Address sanitizer enabled. Usage:")
     message(STATUS "    wget https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py";)
diff --git a/src/tex2lyx/dummy_impl.cpp b/src/tex2lyx/dummy_impl.cpp
index 961eb9ae0d..9a5fee6355 100644
--- a/src/tex2lyx/dummy_impl.cpp
+++ b/src/tex2lyx/dummy_impl.cpp
@@ -20,10 +20,11 @@
 
 #include "Format.h"
 #include "LaTeXFeatures.h"
 #include "LyXRC.h"
 #include "output_xhtml.h"
+#include "xml.h"
 
 #include "support/Messages.h"
 
 #include <iostream>
 

Attachment: pgpbOzxEQqfmo.pgp
Description: Digitale Signatur von OpenPGP

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to