Re: [Mesa-dev] [PATCH] glx: Don't hard-code the name "libGL.so.1" in driOpenDriver (v3)

2015-09-28 Thread Kyle Brenneman

On 09/28/2015 11:33 AM, Emil Velikov wrote:

Hi Kyle,

On 25 September 2015 at 21:01, Kyle Brenneman  wrote:

Add a macro GL_LIB_NAME to hold the filename that configure comes up with
based on the --with-gl-lib-name and --enable-mangling options.

In driOpenDriver, use the GL_LIB_NAME macro instead of hard-coding
"libGL.so.1".

v2: Add an #ifndef/#define for GL_LIB_NAME so that non-autoconf builds will
 work.
v3: Fix the library filename in the Makefile.

Did you really come across issues due to this or have you just noticed
it while going through ? I've been dreaming about getting rid of this
hack/workaround, although until that happens (if ever) this commit is
doing the right thing.
I did come across issues from this, although it was from kind of an 
oddball corner case. I was experimenting with writing a wrapper library 
to make an (otherwise unmodified) build of Mesa work with libglvnd, 
using the --enable-mangling and --with-gl-lib-name options, and got 
undefined symbol errors as a result.


Please add your s-o-b and the mesa-stable tag. With those
Reviewed-by: Emil Velikov 

Thanks
Emil


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glx: Don't hard-code the name "libGL.so.1" in driOpenDriver (v3)

2015-09-28 Thread Kyle Brenneman
Add a macro GL_LIB_NAME to hold the filename that configure comes up with
based on the --with-gl-lib-name and --enable-mangling options.

In driOpenDriver, use the GL_LIB_NAME macro instead of hard-coding
"libGL.so.1".

v2: Add an #ifndef/#define for GL_LIB_NAME so that non-autoconf builds will
work.
v3: Fix the library filename in the Makefile.

Signed-off-by: Kyle Brenneman 
Reviewed-by: Emil Velikov 
Cc: "10.6 11.0" 
---
 src/glx/Makefile.am  | 1 +
 src/glx/dri_common.c | 6 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 6e50e09..e64955e 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -46,6 +46,7 @@ AM_CFLAGS = \
$(EXTRA_DEFINES_XF86VIDMODE) \
-D_REENTRANT \
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
+   -DGL_LIB_NAME=\"lib@GL_LIB@.so.1\" \
$(DEFINES) \
$(LIBDRM_CFLAGS) \
$(DRI2PROTO_CFLAGS) \
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index eedcd46..8a56385 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -73,6 +73,10 @@ dri_message(int level, const char *f, ...)
}
 }
 
+#ifndef GL_LIB_NAME
+#define GL_LIB_NAME "libGL.so.1"
+#endif
+
 #ifndef DEFAULT_DRIVER_DIR
 /* this is normally defined in Mesa/configs/default with 
DRI_DRIVER_SEARCH_PATH */
 #define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
@@ -99,7 +103,7 @@ driOpenDriver(const char *driverName)
int len;
 
/* Attempt to make sure libGL symbols will be visible to the driver */
-   glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
+   glhandle = dlopen(GL_LIB_NAME, RTLD_NOW | RTLD_GLOBAL);
 
libPaths = NULL;
if (geteuid() == getuid()) {
-- 
1.9.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glx: Don't hard-code the name "libGL.so.1" in driOpenDriver (v3)

2015-09-28 Thread Emil Velikov
Hi Kyle,

On 25 September 2015 at 21:01, Kyle Brenneman  wrote:
> Add a macro GL_LIB_NAME to hold the filename that configure comes up with
> based on the --with-gl-lib-name and --enable-mangling options.
>
> In driOpenDriver, use the GL_LIB_NAME macro instead of hard-coding
> "libGL.so.1".
>
> v2: Add an #ifndef/#define for GL_LIB_NAME so that non-autoconf builds will
> work.
> v3: Fix the library filename in the Makefile.

Did you really come across issues due to this or have you just noticed
it while going through ? I've been dreaming about getting rid of this
hack/workaround, although until that happens (if ever) this commit is
doing the right thing.

Please add your s-o-b and the mesa-stable tag. With those
Reviewed-by: Emil Velikov 

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glx: Don't hard-code the name "libGL.so.1" in driOpenDriver (v3)

2015-09-25 Thread Kyle Brenneman
Add a macro GL_LIB_NAME to hold the filename that configure comes up with
based on the --with-gl-lib-name and --enable-mangling options.

In driOpenDriver, use the GL_LIB_NAME macro instead of hard-coding
"libGL.so.1".

v2: Add an #ifndef/#define for GL_LIB_NAME so that non-autoconf builds will
work.
v3: Fix the library filename in the Makefile.
---
 src/glx/Makefile.am  | 1 +
 src/glx/dri_common.c | 6 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 6e50e09..e64955e 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -46,6 +46,7 @@ AM_CFLAGS = \
$(EXTRA_DEFINES_XF86VIDMODE) \
-D_REENTRANT \
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
+   -DGL_LIB_NAME=\"lib@GL_LIB@.so.1\" \
$(DEFINES) \
$(LIBDRM_CFLAGS) \
$(DRI2PROTO_CFLAGS) \
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index eedcd46..8a56385 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -73,6 +73,10 @@ dri_message(int level, const char *f, ...)
}
 }
 
+#ifndef GL_LIB_NAME
+#define GL_LIB_NAME "libGL.so.1"
+#endif
+
 #ifndef DEFAULT_DRIVER_DIR
 /* this is normally defined in Mesa/configs/default with 
DRI_DRIVER_SEARCH_PATH */
 #define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
@@ -99,7 +103,7 @@ driOpenDriver(const char *driverName)
int len;
 
/* Attempt to make sure libGL symbols will be visible to the driver */
-   glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
+   glhandle = dlopen(GL_LIB_NAME, RTLD_NOW | RTLD_GLOBAL);
 
libPaths = NULL;
if (geteuid() == getuid()) {
-- 
1.9.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glx: Don't hard-code the name "libGL.so.1" in driOpenDriver (v2)

2015-09-25 Thread Kyle Brenneman

On 09/25/2015 11:58 AM, Ilia Mirkin wrote:

On Fri, Sep 25, 2015 at 1:47 PM, Kyle Brenneman  wrote:

Add a macro GL_LIB_NAME to hold the filename that configure comes up with
based on the --with-gl-lib-name and --enable-mangling options.

In driOpenDriver, use the GL_LIB_NAME macro instead of hard-coding
"libGL.so.1".

v2: Add an #ifndef/#define for GL_LIB_NAME so that non-autoconf builds will
 work.
---
  src/glx/Makefile.am  | 1 +
  src/glx/dri_common.c | 6 +-
  2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 6e50e09..8ea81c1 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -46,6 +46,7 @@ AM_CFLAGS = \
 $(EXTRA_DEFINES_XF86VIDMODE) \
 -D_REENTRANT \
 -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
+   -DGL_LIB_NAME=\"lib@GL_LIB@.la\" \

Errr .la? Are you sure? dlopen doesn't know anything about those
libtool archive files afaik -- did you test this?
Ack, sorry about that. I did test it, but since it silently ignores when 
the dlopen call fails, I didn't notice the failure. I'll put together a 
test program that actually fails when it has the wrong name and try this 
again.



 $(DEFINES) \
 $(LIBDRM_CFLAGS) \
 $(DRI2PROTO_CFLAGS) \
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index eedcd46..8a56385 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -73,6 +73,10 @@ dri_message(int level, const char *f, ...)
 }
  }

+#ifndef GL_LIB_NAME
+#define GL_LIB_NAME "libGL.so.1"
+#endif
+
  #ifndef DEFAULT_DRIVER_DIR
  /* this is normally defined in Mesa/configs/default with 
DRI_DRIVER_SEARCH_PATH */
  #define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
@@ -99,7 +103,7 @@ driOpenDriver(const char *driverName)
 int len;

 /* Attempt to make sure libGL symbols will be visible to the driver */
-   glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
+   glhandle = dlopen(GL_LIB_NAME, RTLD_NOW | RTLD_GLOBAL);

 libPaths = NULL;
 if (geteuid() == getuid()) {
--
1.9.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glx: Don't hard-code the name "libGL.so.1" in driOpenDriver (v2)

2015-09-25 Thread Ilia Mirkin
On Fri, Sep 25, 2015 at 1:47 PM, Kyle Brenneman  wrote:
> Add a macro GL_LIB_NAME to hold the filename that configure comes up with
> based on the --with-gl-lib-name and --enable-mangling options.
>
> In driOpenDriver, use the GL_LIB_NAME macro instead of hard-coding
> "libGL.so.1".
>
> v2: Add an #ifndef/#define for GL_LIB_NAME so that non-autoconf builds will
> work.
> ---
>  src/glx/Makefile.am  | 1 +
>  src/glx/dri_common.c | 6 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
> index 6e50e09..8ea81c1 100644
> --- a/src/glx/Makefile.am
> +++ b/src/glx/Makefile.am
> @@ -46,6 +46,7 @@ AM_CFLAGS = \
> $(EXTRA_DEFINES_XF86VIDMODE) \
> -D_REENTRANT \
> -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
> +   -DGL_LIB_NAME=\"lib@GL_LIB@.la\" \

Errr .la? Are you sure? dlopen doesn't know anything about those
libtool archive files afaik -- did you test this?

> $(DEFINES) \
> $(LIBDRM_CFLAGS) \
> $(DRI2PROTO_CFLAGS) \
> diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
> index eedcd46..8a56385 100644
> --- a/src/glx/dri_common.c
> +++ b/src/glx/dri_common.c
> @@ -73,6 +73,10 @@ dri_message(int level, const char *f, ...)
> }
>  }
>
> +#ifndef GL_LIB_NAME
> +#define GL_LIB_NAME "libGL.so.1"
> +#endif
> +
>  #ifndef DEFAULT_DRIVER_DIR
>  /* this is normally defined in Mesa/configs/default with 
> DRI_DRIVER_SEARCH_PATH */
>  #define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
> @@ -99,7 +103,7 @@ driOpenDriver(const char *driverName)
> int len;
>
> /* Attempt to make sure libGL symbols will be visible to the driver */
> -   glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
> +   glhandle = dlopen(GL_LIB_NAME, RTLD_NOW | RTLD_GLOBAL);
>
> libPaths = NULL;
> if (geteuid() == getuid()) {
> --
> 1.9.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glx: Don't hard-code the name "libGL.so.1" in driOpenDriver (v2)

2015-09-25 Thread Kyle Brenneman
Add a macro GL_LIB_NAME to hold the filename that configure comes up with
based on the --with-gl-lib-name and --enable-mangling options.

In driOpenDriver, use the GL_LIB_NAME macro instead of hard-coding
"libGL.so.1".

v2: Add an #ifndef/#define for GL_LIB_NAME so that non-autoconf builds will
work.
---
 src/glx/Makefile.am  | 1 +
 src/glx/dri_common.c | 6 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 6e50e09..8ea81c1 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -46,6 +46,7 @@ AM_CFLAGS = \
$(EXTRA_DEFINES_XF86VIDMODE) \
-D_REENTRANT \
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
+   -DGL_LIB_NAME=\"lib@GL_LIB@.la\" \
$(DEFINES) \
$(LIBDRM_CFLAGS) \
$(DRI2PROTO_CFLAGS) \
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index eedcd46..8a56385 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -73,6 +73,10 @@ dri_message(int level, const char *f, ...)
}
 }
 
+#ifndef GL_LIB_NAME
+#define GL_LIB_NAME "libGL.so.1"
+#endif
+
 #ifndef DEFAULT_DRIVER_DIR
 /* this is normally defined in Mesa/configs/default with 
DRI_DRIVER_SEARCH_PATH */
 #define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
@@ -99,7 +103,7 @@ driOpenDriver(const char *driverName)
int len;
 
/* Attempt to make sure libGL symbols will be visible to the driver */
-   glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
+   glhandle = dlopen(GL_LIB_NAME, RTLD_NOW | RTLD_GLOBAL);
 
libPaths = NULL;
if (geteuid() == getuid()) {
-- 
1.9.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glx: Don't hard-code the name "libGL.so.1" in driOpenDriver.

2015-09-25 Thread Ilia Mirkin
This will break non-autoconf builds... how about #ifndef GL_LIB_NAME
#define GL_LIB_NAME "libGL.so.1"?

On Fri, Sep 25, 2015 at 12:43 PM, Kyle Brenneman  wrote:
> Add a macro GL_LIB_NAME to hold the filename that configure comes up with
> based on the --with-gl-lib-name and --enable-mangling options.
>
> In driOpenDriver, use the GL_LIB_NAME macro instead of hard-coding
> "libGL.so.1".
> ---
>  src/glx/Makefile.am  | 1 +
>  src/glx/dri_common.c | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
> index 6e50e09..8ea81c1 100644
> --- a/src/glx/Makefile.am
> +++ b/src/glx/Makefile.am
> @@ -46,6 +46,7 @@ AM_CFLAGS = \
> $(EXTRA_DEFINES_XF86VIDMODE) \
> -D_REENTRANT \
> -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
> +   -DGL_LIB_NAME=\"lib@GL_LIB@.la\" \
> $(DEFINES) \
> $(LIBDRM_CFLAGS) \
> $(DRI2PROTO_CFLAGS) \
> diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
> index eedcd46..c30db8f 100644
> --- a/src/glx/dri_common.c
> +++ b/src/glx/dri_common.c
> @@ -99,7 +99,7 @@ driOpenDriver(const char *driverName)
> int len;
>
> /* Attempt to make sure libGL symbols will be visible to the driver */
> -   glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
> +   glhandle = dlopen(GL_LIB_NAME, RTLD_NOW | RTLD_GLOBAL);
>
> libPaths = NULL;
> if (geteuid() == getuid()) {
> --
> 1.9.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glx: Don't hard-code the name "libGL.so.1" in driOpenDriver.

2015-09-25 Thread Kyle Brenneman
Add a macro GL_LIB_NAME to hold the filename that configure comes up with
based on the --with-gl-lib-name and --enable-mangling options.

In driOpenDriver, use the GL_LIB_NAME macro instead of hard-coding
"libGL.so.1".
---
 src/glx/Makefile.am  | 1 +
 src/glx/dri_common.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 6e50e09..8ea81c1 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -46,6 +46,7 @@ AM_CFLAGS = \
$(EXTRA_DEFINES_XF86VIDMODE) \
-D_REENTRANT \
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
+   -DGL_LIB_NAME=\"lib@GL_LIB@.la\" \
$(DEFINES) \
$(LIBDRM_CFLAGS) \
$(DRI2PROTO_CFLAGS) \
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index eedcd46..c30db8f 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -99,7 +99,7 @@ driOpenDriver(const char *driverName)
int len;
 
/* Attempt to make sure libGL symbols will be visible to the driver */
-   glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
+   glhandle = dlopen(GL_LIB_NAME, RTLD_NOW | RTLD_GLOBAL);
 
libPaths = NULL;
if (geteuid() == getuid()) {
-- 
1.9.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev