Patchwork [for-1.4,2/2] configure: Fix build with XFree

login
register
mail settings
Submitter Richard Henderson
Date Feb. 5, 2013, 12:21 a.m.
Message ID <1360023667-7712-2-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/218127/
State New
Headers show

Comments

Richard Henderson - Feb. 5, 2013, 12:21 a.m.
The build is broken on ppc64-linux, possibly only with new binutils:

ld: hw/lm32/../milkymist-tmu2.o: undefined reference to symbol 'XFree'
ld: note: 'XFree' is defined in DSO /lib64/libX11.so.6 so try \
  adding it to the linker command line

So let's follow the linker's advice.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Stefan Weil - Feb. 5, 2013, 7:43 a.m.
Am 05.02.2013 01:21, schrieb Richard Henderson:
> The build is broken on ppc64-linux, possibly only with new binutils:
>
> ld: hw/lm32/../milkymist-tmu2.o: undefined reference to symbol 'XFree'
> ld: note: 'XFree' is defined in DSO /lib64/libX11.so.6 so try \
>   adding it to the linker command line
>
> So let's follow the linker's advice.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 0657b1a..8789324 100755
> --- a/configure
> +++ b/configure
> @@ -2388,7 +2388,7 @@ fi
>  ##########################################
>  # opengl probe, used by milkymist-tmu2
>  if test "$opengl" != "no" ; then
> -  opengl_libs="-lGL"
> +  opengl_libs="-lGL -lX11"
>    cat > $TMPC << EOF
>  #include <X11/Xlib.h>
>  #include <GL/gl.h>

What about using pkg-config to probe for opengl and
get the correct linker options? Then static linking would
also be fixed (it needs more than -lX11):

$ pkg-config --libs gl
-lGL 
$ pkg-config --libs --static gl
-lGL -lm -lXext -lX11 -lpthread -lxcb -lXau -lXdmcp 

(tested on a Debian GNU Linux host)

Regards

Stefan W.
Richard Henderson - Feb. 5, 2013, 3:34 p.m.
On 2013-02-04 23:43, Stefan Weil wrote:
> Am 05.02.2013 01:21, schrieb Richard Henderson:
>> The build is broken on ppc64-linux, possibly only with new binutils:
>>
>> ld: hw/lm32/../milkymist-tmu2.o: undefined reference to symbol 'XFree'
>> ld: note: 'XFree' is defined in DSO /lib64/libX11.so.6 so try \
>>    adding it to the linker command line
>>
>> So let's follow the linker's advice.
>>
>> Signed-off-by: Richard Henderson <rth@twiddle.net>
>> ---
>>   configure | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 0657b1a..8789324 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2388,7 +2388,7 @@ fi
>>   ##########################################
>>   # opengl probe, used by milkymist-tmu2
>>   if test "$opengl" != "no" ; then
>> -  opengl_libs="-lGL"
>> +  opengl_libs="-lGL -lX11"
>>     cat > $TMPC << EOF
>>   #include <X11/Xlib.h>
>>   #include <GL/gl.h>
>
> What about using pkg-config to probe for opengl and
> get the correct linker options? Then static linking would
> also be fixed (it needs more than -lX11):
>
> $ pkg-config --libs gl
> -lGL
> $ pkg-config --libs --static gl
> -lGL -lm -lXext -lX11 -lpthread -lxcb -lXau -lXdmcp
>
> (tested on a Debian GNU Linux host)

That's another issue.  The issue being fixed here is that XFree isn't in 
opengl at all, it's in the base X11 library.


r~

Patch

diff --git a/configure b/configure
index 0657b1a..8789324 100755
--- a/configure
+++ b/configure
@@ -2388,7 +2388,7 @@  fi
 ##########################################
 # opengl probe, used by milkymist-tmu2
 if test "$opengl" != "no" ; then
-  opengl_libs="-lGL"
+  opengl_libs="-lGL -lX11"
   cat > $TMPC << EOF
 #include <X11/Xlib.h>
 #include <GL/gl.h>