Re: [Mesa-dev] [PATCH shader-db 0/3] Makefile and documentation cleanup

2015-10-12 Thread Rhys Kidd
On 12 October 2015 at 12:09, Matt Turner  wrote:

> On Sun, Oct 11, 2015 at 4:18 PM, Rhys Kidd  wrote:
> > On Sunday, 11 October 2015, Matt Turner  wrote:
> >>
> >> On Sat, Oct 10, 2015 at 10:30 PM, Rhys Kidd  wrote:
> >> > Patchset adds Makefile and documentation improvements.
> >> >
> >> > I aimed to write these as I would have found most helpful when seeking
> >> > to
> >> > understand shader-db's operation, as a new Mesa developer.
> >> >
> >> > First patch resolves the build errors [0] experienced on Ubuntu 15.04
> >> > and
> >> > permit a simple 'make' to work if the dependencies are met. The
> >> > following two
> >> > patches improve the documentation of those dependencies.
> >> >
> >> > [0]
> >> > $ cc --version
> >> > cc (Ubuntu 4.9.2-10ubuntu13) 4.9.2
> >> > ...
> >> > $ make
> >> > cc -g -O2 -march=native -pipe -std=gnu99 -fopenmp  -lepoxy -lgbm
> run.c
> >> > -o run
> >> > /tmp/ccaZrtAC.o: In function `main._omp_fn.0':
> >> > /home/usera/Coding/shader-db/run.c:511: undefined reference to
> >> > `epoxy_eglBindAPI'
> >>
> >> I don't understand. It works fine locally with the exact same cc
> >> command, with every version of gcc I've used since November of last
> >> year.
> >
> >
> > Hello Matt,
> >
> > It is a link ordering issue in the shader-db Makefile prior to this
> change.
> >
> > The key bits of the command are:
> >
> > cc -g -O2 ... -lepoxy -lgbm ... [ ... the *.o file ... ]
> >
> > The problem is that -lepoxy and -lgbm need to come after all the *.o
> files
> > on the command line as passed to the linker, because order matters:
> > libraries are only searched for unresolved symbols from object files that
> > precede them on the command line.
> >
> > This situation is commonly seen when libraries are incorrectly added to
> > LDFLAGS. GNU Make is clear in the manual that LDFLAGS is only for:
> >
> > Extra flags to give to compilers when they are supposed to invoke the
> > linker, 'ld', such as -L. Libraries (-lfoo) should be added to the LDLIBS
> > variable instead.
> >
> > We can of course use any variable, say LIBS, when pulling the libraries
> out
> > of LDFLAGS. The important part though is that the variable is used after
> the
> > *.o files when setting up the command line.
>
> Right. Still, I wonder what is responsible for the difference in
> behavior...
>
> > I'm not disputing that the current approach has worked for you on your
> > setups thus far, just that it is brittle and not guaranteed to work per
> this
> > explanation. I've provided details of at least one (reasonably vanilla)
> > Ubuntu dev environment where breakage has been experienced.
> >
> > I hope this has explained why the approach in the patch should be
> preferred.
>
> How about we just s/LDFLAGS/LDLIBS/? That yields
>
> cc -g -O2 -march=native -pipe -std=gnu99 -fopenmprun.c  -lepoxy -lgbm
> -o run
>
> See if that works on your system.
>
> Thanks,
> Matt
>

Hello Matt,

That approach using s/LDFLAGS/LDLIBS/ also works for me. I like it for
being more terse.

I'll send a v2 of the first of the three patches. Can I add your R-B?

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


Re: [Mesa-dev] [PATCH shader-db 0/3] Makefile and documentation cleanup

2015-10-11 Thread Matt Turner
On Sat, Oct 10, 2015 at 10:30 PM, Rhys Kidd  wrote:
> Patchset adds Makefile and documentation improvements.
>
> I aimed to write these as I would have found most helpful when seeking to
> understand shader-db's operation, as a new Mesa developer.
>
> First patch resolves the build errors [0] experienced on Ubuntu 15.04 and
> permit a simple 'make' to work if the dependencies are met. The following two
> patches improve the documentation of those dependencies.
>
> [0]
> $ cc --version
> cc (Ubuntu 4.9.2-10ubuntu13) 4.9.2
> ...
> $ make
> cc -g -O2 -march=native -pipe -std=gnu99 -fopenmp  -lepoxy -lgbm  run.c   -o 
> run
> /tmp/ccaZrtAC.o: In function `main._omp_fn.0':
> /home/usera/Coding/shader-db/run.c:511: undefined reference to 
> `epoxy_eglBindAPI'

I don't understand. It works fine locally with the exact same cc
command, with every version of gcc I've used since November of last
year.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH shader-db 0/3] Makefile and documentation cleanup

2015-10-11 Thread Rhys Kidd
On Sunday, 11 October 2015, Matt Turner  wrote:

> On Sat, Oct 10, 2015 at 10:30 PM, Rhys Kidd  > wrote:
> > Patchset adds Makefile and documentation improvements.
> >
> > I aimed to write these as I would have found most helpful when seeking to
> > understand shader-db's operation, as a new Mesa developer.
> >
> > First patch resolves the build errors [0] experienced on Ubuntu 15.04 and
> > permit a simple 'make' to work if the dependencies are met. The
> following two
> > patches improve the documentation of those dependencies.
> >
> > [0]
> > $ cc --version
> > cc (Ubuntu 4.9.2-10ubuntu13) 4.9.2
> > ...
> > $ make
> > cc -g -O2 -march=native -pipe -std=gnu99 -fopenmp  -lepoxy -lgbm  run.c
>  -o run
> > /tmp/ccaZrtAC.o: In function `main._omp_fn.0':
> > /home/usera/Coding/shader-db/run.c:511: undefined reference to
> `epoxy_eglBindAPI'
>
> I don't understand. It works fine locally with the exact same cc
> command, with every version of gcc I've used since November of last
> year.
>

Hello Matt,

It is a link ordering issue in the shader-db Makefile prior to this change.

The key bits of the command are:

cc -g -O2 ... -lepoxy -lgbm ... [ ... the *.o file ... ]

The problem is that -lepoxy and -lgbm need to come after all the *.o files
on the command line as passed to the linker, because order matters:
libraries are only searched for unresolved symbols from object files that
precede them on the command line.

This situation is commonly seen when libraries are incorrectly added to
LDFLAGS. GNU Make is clear in the manual that LDFLAGS is only for:

Extra flags to give to compilers when they are supposed to invoke the
linker, 'ld', such as -L. Libraries (-lfoo) should be added to the LDLIBS
variable instead.

We can of course use any variable, say LIBS, when pulling the libraries out
of LDFLAGS. The important part though is that the variable is used after
the *.o files when setting up the command line.

I'm not disputing that the current approach has worked for you on your
setups thus far, just that it is brittle and not guaranteed to work per
this explanation. I've provided details of at least one (reasonably
vanilla) Ubuntu dev environment where breakage has been experienced.

I hope this has explained why the approach in the patch should be preferred.

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


Re: [Mesa-dev] [PATCH shader-db 0/3] Makefile and documentation cleanup

2015-10-11 Thread Matt Turner
On Sun, Oct 11, 2015 at 4:18 PM, Rhys Kidd  wrote:
> On Sunday, 11 October 2015, Matt Turner  wrote:
>>
>> On Sat, Oct 10, 2015 at 10:30 PM, Rhys Kidd  wrote:
>> > Patchset adds Makefile and documentation improvements.
>> >
>> > I aimed to write these as I would have found most helpful when seeking
>> > to
>> > understand shader-db's operation, as a new Mesa developer.
>> >
>> > First patch resolves the build errors [0] experienced on Ubuntu 15.04
>> > and
>> > permit a simple 'make' to work if the dependencies are met. The
>> > following two
>> > patches improve the documentation of those dependencies.
>> >
>> > [0]
>> > $ cc --version
>> > cc (Ubuntu 4.9.2-10ubuntu13) 4.9.2
>> > ...
>> > $ make
>> > cc -g -O2 -march=native -pipe -std=gnu99 -fopenmp  -lepoxy -lgbm  run.c
>> > -o run
>> > /tmp/ccaZrtAC.o: In function `main._omp_fn.0':
>> > /home/usera/Coding/shader-db/run.c:511: undefined reference to
>> > `epoxy_eglBindAPI'
>>
>> I don't understand. It works fine locally with the exact same cc
>> command, with every version of gcc I've used since November of last
>> year.
>
>
> Hello Matt,
>
> It is a link ordering issue in the shader-db Makefile prior to this change.
>
> The key bits of the command are:
>
> cc -g -O2 ... -lepoxy -lgbm ... [ ... the *.o file ... ]
>
> The problem is that -lepoxy and -lgbm need to come after all the *.o files
> on the command line as passed to the linker, because order matters:
> libraries are only searched for unresolved symbols from object files that
> precede them on the command line.
>
> This situation is commonly seen when libraries are incorrectly added to
> LDFLAGS. GNU Make is clear in the manual that LDFLAGS is only for:
>
> Extra flags to give to compilers when they are supposed to invoke the
> linker, 'ld', such as -L. Libraries (-lfoo) should be added to the LDLIBS
> variable instead.
>
> We can of course use any variable, say LIBS, when pulling the libraries out
> of LDFLAGS. The important part though is that the variable is used after the
> *.o files when setting up the command line.

Right. Still, I wonder what is responsible for the difference in behavior...

> I'm not disputing that the current approach has worked for you on your
> setups thus far, just that it is brittle and not guaranteed to work per this
> explanation. I've provided details of at least one (reasonably vanilla)
> Ubuntu dev environment where breakage has been experienced.
>
> I hope this has explained why the approach in the patch should be preferred.

How about we just s/LDFLAGS/LDLIBS/? That yields

cc -g -O2 -march=native -pipe -std=gnu99 -fopenmprun.c  -lepoxy -lgbm -o run

See if that works on your system.

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


[Mesa-dev] [PATCH shader-db 0/3] Makefile and documentation cleanup

2015-10-10 Thread Rhys Kidd
Patchset adds Makefile and documentation improvements.

I aimed to write these as I would have found most helpful when seeking to
understand shader-db's operation, as a new Mesa developer.

First patch resolves the build errors [0] experienced on Ubuntu 15.04 and
permit a simple 'make' to work if the dependencies are met. The following two
patches improve the documentation of those dependencies.

[0]
$ cc --version
cc (Ubuntu 4.9.2-10ubuntu13) 4.9.2
...
$ make
cc -g -O2 -march=native -pipe -std=gnu99 -fopenmp  -lepoxy -lgbm  run.c   -o run
/tmp/ccaZrtAC.o: In function `main._omp_fn.0':
/home/usera/Coding/shader-db/run.c:511: undefined reference to 
`epoxy_eglBindAPI'
/home/usera/Coding/shader-db/run.c:513: undefined reference to 
`epoxy_eglCreateContext'
/home/usera/Coding/shader-db/run.c:516: undefined reference to 
`epoxy_eglMakeCurrent'
/home/usera/Coding/shader-db/run.c:528: undefined reference to 
`epoxy_eglCreateContext'
/home/usera/Coding/shader-db/run.c:536: undefined reference to 
`epoxy_eglMakeCurrent'
/home/usera/Coding/shader-db/run.c:541: undefined reference to `epoxy_glEnable'
/home/usera/Coding/shader-db/run.c:542: undefined reference to `epoxy_glEnable'
/home/usera/Coding/shader-db/run.c:543: undefined reference to 
`epoxy_glDebugMessageControl'
/home/usera/Coding/shader-db/run.c:545: undefined reference to 
`epoxy_glDebugMessageControl'
/home/usera/Coding/shader-db/run.c:548: undefined reference to 
`epoxy_glDebugMessageCallback'
/home/usera/Coding/shader-db/run.c:642: undefined reference to 
`epoxy_eglDestroyContext'
/home/usera/Coding/shader-db/run.c:643: undefined reference to 
`epoxy_eglDestroyContext'
/home/usera/Coding/shader-db/run.c:644: undefined reference to 
`epoxy_eglReleaseThread'
/home/usera/Coding/shader-db/run.c:585: undefined reference to 
`epoxy_eglMakeCurrent'
/home/usera/Coding/shader-db/run.c:620: undefined reference to 
`epoxy_glGenProgramsARB'
/home/usera/Coding/shader-db/run.c:621: undefined reference to 
`epoxy_glBindProgramARB'
/home/usera/Coding/shader-db/run.c:622: undefined reference to 
`epoxy_glProgramStringARB'
/home/usera/Coding/shader-db/run.c:624: undefined reference to 
`epoxy_glDeleteProgramsARB'
/home/usera/Coding/shader-db/run.c:625: undefined reference to 
`epoxy_glGetError'
/home/usera/Coding/shader-db/run.c:594: undefined reference to 
`epoxy_glCreateProgram'
/home/usera/Coding/shader-db/run.c:611: undefined reference to 
`epoxy_glAttachShader'
/home/usera/Coding/shader-db/run.c:612: undefined reference to 
`epoxy_glDeleteShader'
/home/usera/Coding/shader-db/run.c:597: undefined reference to 
`epoxy_glCreateShader'
/home/usera/Coding/shader-db/run.c:598: undefined reference to 
`epoxy_glShaderSource'
/home/usera/Coding/shader-db/run.c:599: undefined reference to 
`epoxy_glCompileShader'
/home/usera/Coding/shader-db/run.c:602: undefined reference to 
`epoxy_glGetShaderiv'
/home/usera/Coding/shader-db/run.c:606: undefined reference to 
`epoxy_glGetShaderInfoLog'
/home/usera/Coding/shader-db/run.c:615: undefined reference to 
`epoxy_glLinkProgram'
/home/usera/Coding/shader-db/run.c:616: undefined reference to 
`epoxy_glDeleteProgram'
/home/usera/Coding/shader-db/run.c:517: undefined reference to `epoxy_glEnable'
/home/usera/Coding/shader-db/run.c:518: undefined reference to `epoxy_glEnable'
/home/usera/Coding/shader-db/run.c:519: undefined reference to 
`epoxy_glDebugMessageControl'
/home/usera/Coding/shader-db/run.c:521: undefined reference to 
`epoxy_glDebugMessageControl'
/home/usera/Coding/shader-db/run.c:525: undefined reference to 
`epoxy_glDebugMessageCallback'
/tmp/ccaZrtAC.o: In function `main':
/home/usera/Coding/shader-db/run.c:334: undefined reference to 
`epoxy_eglQueryString'
/home/usera/Coding/shader-db/run.c:354: undefined reference to 
`gbm_create_device'
/home/usera/Coding/shader-db/run.c:361: undefined reference to 
`epoxy_eglGetPlatformDisplayEXT'
/home/usera/Coding/shader-db/run.c:369: undefined reference to 
`epoxy_eglInitialize'
/home/usera/Coding/shader-db/run.c:379: undefined reference to 
`epoxy_eglQueryString'
/home/usera/Coding/shader-db/run.c:395: undefined reference to 
`epoxy_eglChooseConfig'
/home/usera/Coding/shader-db/run.c:659: undefined reference to 
`epoxy_eglTerminate'
/home/usera/Coding/shader-db/run.c:661: undefined reference to 
`gbm_device_destroy'
/home/usera/Coding/shader-db/run.c:401: undefined reference to 
`epoxy_eglBindAPI'
/home/usera/Coding/shader-db/run.c:412: undefined reference to 
`epoxy_eglCreateContext'
/home/usera/Coding/shader-db/run.c:415: undefined reference to 
`epoxy_eglMakeCurrent'
/home/usera/Coding/shader-db/run.c:462: undefined reference to 
`epoxy_eglCreateContext'
/home/usera/Coding/shader-db/run.c:470: undefined reference to 
`epoxy_eglMakeCurrent'
/home/usera/Coding/shader-db/run.c:475: undefined reference to 
`epoxy_glGetString'
/home/usera/Coding/shader-db/run.c:478: undefined reference to 
`epoxy_glGetString'
/home/usera/Coding/shader-db/run.c:417: undefined reference to