diff mbox

[i-g-t,1/2] quick-dump: Make quick dump link against libintel_tools

Message ID 1412611225-1224-1-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien Oct. 6, 2014, 4 p.m. UTC
Because quick-dump was only selecting a few files in lib/ and we move
stuff around and/or add new dependencies we were failing to provide the
necessary symbols to the shim library providing python bindings. And so
we had a run-time error:

Traceback (most recent call last):
  File "./tools/quick_dump/quick_dump.py", line 17, in <module>
    import chipset
  File "/home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/chipset.py", line 28, in <module>
    _chipset = swig_import_helper()
  File "/home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/chipset.py", line 24, in swig_import_helper
    _mod = imp.load_module('_chipset', fp, pathname, description)
  File "/usr/lib64/python3.3/imp.py", line 183, in load_module
    return load_dynamic(name, filename, file)
ImportError: /home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/_chipset.so: undefined symbol: kmstest_pipe_name

So, let's simplify maintainance and just link against the library we're
building and using elsewhere.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 tools/quick_dump/Makefile.am          | 17 ++++++++---------
 tools/quick_dump/chipset_macro_wrap.c | 12 ------------
 2 files changed, 8 insertions(+), 21 deletions(-)

Comments

Ville Syrjala Oct. 7, 2014, 10:06 a.m. UTC | #1
On Mon, Oct 06, 2014 at 05:00:24PM +0100, Damien Lespiau wrote:
> Because quick-dump was only selecting a few files in lib/ and we move
> stuff around and/or add new dependencies we were failing to provide the
> necessary symbols to the shim library providing python bindings. And so
> we had a run-time error:
> 
> Traceback (most recent call last):
>   File "./tools/quick_dump/quick_dump.py", line 17, in <module>
>     import chipset
>   File "/home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/chipset.py", line 28, in <module>
>     _chipset = swig_import_helper()
>   File "/home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/chipset.py", line 24, in swig_import_helper
>     _mod = imp.load_module('_chipset', fp, pathname, description)
>   File "/usr/lib64/python3.3/imp.py", line 183, in load_module
>     return load_dynamic(name, filename, file)
> ImportError: /home/damien/gfx/sources/intel-gpu-tools/tools/quick_dump/_chipset.so: undefined symbol: kmstest_pipe_name
> 
> So, let's simplify maintainance and just link against the library we're
> building and using elsewhere.
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  tools/quick_dump/Makefile.am          | 17 ++++++++---------
>  tools/quick_dump/chipset_macro_wrap.c | 12 ------------
>  2 files changed, 8 insertions(+), 21 deletions(-)
> 
> diff --git a/tools/quick_dump/Makefile.am b/tools/quick_dump/Makefile.am
> index 89ac520..4bc5eca 100644
> --- a/tools/quick_dump/Makefile.am
> +++ b/tools/quick_dump/Makefile.am
> @@ -6,15 +6,14 @@ dist_bin_SCRIPTS = quick_dump.py reg_access.py
>  bin_SCRIPTS = chipset.py
>  
>  lib_LTLIBRARIES = I915ChipsetPython.la
> -I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) $(PCIACCESS_LIBS)
> -I915ChipsetPython_la_SOURCES = chipset_wrap_python.c chipset_macro_wrap.c \
> -			       $(top_srcdir)/lib/igt_core.c  \
> -			       $(top_srcdir)/lib/igt_debugfs.c  \
> -			       $(top_srcdir)/lib/intel_os.c  \
> -			       $(top_srcdir)/lib/intel_chipset.c  \
> -			       $(top_srcdir)/lib/intel_reg_map.c  \
> -			       $(top_srcdir)/lib/intel_mmio.c  \
> -			       $(top_srcdir)/lib/intel_iosf.c
> +I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS)
> +I915ChipsetPython_la_SOURCES = chipset_wrap_python.c chipset_macro_wrap.c
> +I915ChipsetPython_la_LIBADD =			\
> +	$(top_srcdir)/lib/libintel_tools.la	\

top_builddir

> +	$(PCIACCESS_LIBS)			\
> +	$(DRM_LIBS)				\
> +	$(CAIRO_LIBS)				\
> +	$(NULL)
>  
>  chipset_wrap_python.c chipset.py: chipset.i
>  	$(AM_V_GEN)$(SWIG) $(AX_SWIG_PYTHON_OPT) -I/usr/include -I$(top_srcdir)/lib -o $@ $<
> diff --git a/tools/quick_dump/chipset_macro_wrap.c b/tools/quick_dump/chipset_macro_wrap.c
> index 8bba9f7..862281e 100644
> --- a/tools/quick_dump/chipset_macro_wrap.c
> +++ b/tools/quick_dump/chipset_macro_wrap.c
> @@ -38,15 +38,3 @@ unsigned short pcidev_to_devid(struct pci_device *pdev)
>  {
>  	return pdev->device_id;
>  }
> -
> -bool igt_check_boolean_env_var(const char *env_var, bool default_value)
> -{
> -	char *val;
> -
> -	val = getenv(env_var);
> -	if (!val)
> -		return default_value;
> -
> -	return atoi(val) != 0;
> -}
> -
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Lespiau, Damien Oct. 8, 2014, 9:21 a.m. UTC | #2
On Tue, Oct 07, 2014 at 01:06:32PM +0300, Ville Syrjälä wrote:
> > +	$(top_srcdir)/lib/libintel_tools.la	\
> 
> top_builddir

Yes, caught it just before merging :) good eye though!
diff mbox

Patch

diff --git a/tools/quick_dump/Makefile.am b/tools/quick_dump/Makefile.am
index 89ac520..4bc5eca 100644
--- a/tools/quick_dump/Makefile.am
+++ b/tools/quick_dump/Makefile.am
@@ -6,15 +6,14 @@  dist_bin_SCRIPTS = quick_dump.py reg_access.py
 bin_SCRIPTS = chipset.py
 
 lib_LTLIBRARIES = I915ChipsetPython.la
-I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) $(PCIACCESS_LIBS)
-I915ChipsetPython_la_SOURCES = chipset_wrap_python.c chipset_macro_wrap.c \
-			       $(top_srcdir)/lib/igt_core.c  \
-			       $(top_srcdir)/lib/igt_debugfs.c  \
-			       $(top_srcdir)/lib/intel_os.c  \
-			       $(top_srcdir)/lib/intel_chipset.c  \
-			       $(top_srcdir)/lib/intel_reg_map.c  \
-			       $(top_srcdir)/lib/intel_mmio.c  \
-			       $(top_srcdir)/lib/intel_iosf.c
+I915ChipsetPython_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS)
+I915ChipsetPython_la_SOURCES = chipset_wrap_python.c chipset_macro_wrap.c
+I915ChipsetPython_la_LIBADD =			\
+	$(top_srcdir)/lib/libintel_tools.la	\
+	$(PCIACCESS_LIBS)			\
+	$(DRM_LIBS)				\
+	$(CAIRO_LIBS)				\
+	$(NULL)
 
 chipset_wrap_python.c chipset.py: chipset.i
 	$(AM_V_GEN)$(SWIG) $(AX_SWIG_PYTHON_OPT) -I/usr/include -I$(top_srcdir)/lib -o $@ $<
diff --git a/tools/quick_dump/chipset_macro_wrap.c b/tools/quick_dump/chipset_macro_wrap.c
index 8bba9f7..862281e 100644
--- a/tools/quick_dump/chipset_macro_wrap.c
+++ b/tools/quick_dump/chipset_macro_wrap.c
@@ -38,15 +38,3 @@  unsigned short pcidev_to_devid(struct pci_device *pdev)
 {
 	return pdev->device_id;
 }
-
-bool igt_check_boolean_env_var(const char *env_var, bool default_value)
-{
-	char *val;
-
-	val = getenv(env_var);
-	if (!val)
-		return default_value;
-
-	return atoi(val) != 0;
-}
-