Browse Source

Resolve TTLParseTrace symbol when debug flag is on.

Stefano Cossu 1 year ago
parent
commit
98e6c1209c
4 changed files with 20 additions and 8 deletions
  1. 11 3
      Makefile
  2. 7 3
      setup.py
  3. 1 1
      src/codec/lexer_nt.re
  4. 1 1
      src/codec/lexer_ttl.re

+ 11 - 3
Makefile

@@ -252,16 +252,24 @@ footprint: bin/perftest ## Measure memory footprint by generating and storing 10
 		"massif-visualizer or similar."
 
 
-.PHONY: py_module
-py_module: codec
+.PHONY: py
+py: codec  ## Build and install python library.
 	pip3 install build==0.8.0
 	pip3 uninstall -y lsup_rdf
 	python3 -m build
 	pip3 install --no-index --find-links=dist/ lsup_rdf
 
 
+.PHONY: py_dbg
+py_dbg: codec_dbg  ## Build and install python library with debug symbols.
+	pip3 install build==0.8.0
+	pip3 uninstall -y lsup_rdf
+	DEBUG=1 python3 -m build
+	pip3 install --no-index --find-links=dist/ lsup_rdf
+
+
 .PHONY: pytest
-pytest: py_module ## Run a test suite for the Python package.
+pytest: py_dbg ## Run a test suite for the Python package.
 	python3 test/cpython_test.py
 
 

+ 7 - 3
setup.py

@@ -53,7 +53,10 @@ compile_args = [
 ]
 if debug:
     print("Compiling with debug flags.")
-    compile_args.extend(["-DDEBUG", "-g3", "-O1"])
+    compile_args.extend([
+        "-UNDEBUG", "-U_FORTIFY_SOURCE",
+        "-DDEBUG", "-g3", "-O0"
+    ])
 else:
     compile_args.extend(["-g0", "-O3"])
 
@@ -71,7 +74,8 @@ class LSUPInstallCmd(install):
 
     def run(self):
         print("Generating parsers.")
-        target = "debug" if debug else "codec_dbg"
+        target = "codec_dbg" if debug else "codec"
+        print(f"Making {target}.")
         check_output(["make", target])
 
         install.run(self)
@@ -89,7 +93,7 @@ setup(
     package_dir={"": "."},
     packages=find_packages(where="."),
     include_package_data=True,
-    cmdclass={"install": LSUPInstallCmd},
+    # cmdclass={"install": LSUPInstallCmd},
     classifiers=[
         "Development Status :: 3 - Alpha",
         "Environment :: Console",

+ 1 - 1
src/codec/lexer_nt.re

@@ -68,7 +68,7 @@ void *NTParseAlloc();
 void NTParse();
 void NTParseFree();
 #ifdef DEBUG
-void NTParseTrace(FILE *TraceFILE, char *zTracePrompt);
+void NTParseTrace();
 #endif
 
 // Lexer.

+ 1 - 1
src/codec/lexer_ttl.re

@@ -87,7 +87,7 @@ void *TTLParseAlloc();
 void TTLParse();
 void TTLParseFree();
 #ifdef DEBUG
-void TTLParseTrace(FILE *TraceFILE, char *zTracePrompt);
+void TTLParseTrace();
 #endif
 
 // Lexer.