VDR version 1.4.1, pic issue

Message ID 448C3EC1.4020207@gmx.de
State New
Headers

Commit Message

Udo Richter June 11, 2006, 4:03 p.m. UTC
  Prakash Punnoor wrote:
> But If I set flags in Make.conf, the -fPIc doesn't get 
> added for plugins, and I can't seem to make this happen by patching (I don't 
> know much about Makefile syntax) other than adding -fPIC directly into 
> the %.o: %.c rule line in each plugin's Makefile.

This is a fundamental problem, since Make.config is used for VDR core 
*and* plugins. There is currently no mechanism to set CXXFLAGS for 
plugins differently than for core VDR.

Probably the easiest way is to add -fPIC to Make.config anyway, even if 
core VDR doesn't need it. Enforcing the -fPIC flag even if it is not 
part of CXXFLAGS is not the way to go, you cannot expect every compiler 
to understand it.

Implementing something like PLUGINCXXFLAGS for plugins would do the job, 
but since you'll never get all plugins to support it, its not the final 
solution either.

Another good solution would be to do a conditional part in Make.config, 
like this:

The existence of the PLUGIN makefile variable should work for almost all 
plugins. Another way would be to set some marker variable at the 
beginning of the VDR Makefile, or to move the VDRVERSION declaration in 
front of the -include statement. (but of course for core VDR only, not 
for plugin makefiles)

Cheers,

Udo
  

Comments

Klaus Schmidinger June 11, 2006, 9:36 p.m. UTC | #1
Udo Richter wrote:
> Prakash Punnoor wrote:
>> But If I set flags in Make.conf, the -fPIc doesn't get added for 
>> plugins, and I can't seem to make this happen by patching (I don't 
>> know much about Makefile syntax) other than adding -fPIC directly into 
>> the %.o: %.c rule line in each plugin's Makefile.
> 
> This is a fundamental problem, since Make.config is used for VDR core 
> *and* plugins. There is currently no mechanism to set CXXFLAGS for 
> plugins differently than for core VDR.
> 
> Probably the easiest way is to add -fPIC to Make.config anyway, even if 
> core VDR doesn't need it. Enforcing the -fPIC flag even if it is not 
> part of CXXFLAGS is not the way to go, you cannot expect every compiler 
> to understand it.
> 
> Implementing something like PLUGINCXXFLAGS for plugins would do the job, 
> but since you'll never get all plugins to support it, its not the final 
> solution either.
> 
> Another good solution would be to do a conditional part in Make.config, 
> like this:
> --- Make.config.template    2006-05-28 15:08:29.687375000 +0200
> +++ Make.config.template    2006-06-11 17:50:14.467000000 +0200
> @@ -16,6 +16,11 @@
>  CXX      = g++
>  CXXFLAGS = -g -O2 -Wall -Woverloaded-virtual
> 
> +ifdef PLUGIN
> +CFLAGS += -fPIC
> +CXXFLAGS += -fPIC
> +endif
> +
>  ### The directory environment:
> 
>  #DVBDIR   = /usr/src/v4l-dvb/linux
> 
> The existence of the PLUGIN makefile variable should work for almost all 
> plugins. Another way would be to set some marker variable at the 
> beginning of the VDR Makefile, or to move the VDRVERSION declaration in 
> front of the -include statement. (but of course for core VDR only, not 
> for plugin makefiles)

Maybe it would have been better to leave the -fPIC thing as it has been
for so long - as it is now, plugins will actually be compiled _without_
it, which is probably a lot worse than compiling the main program _with_
it...

Klaus
  
Prakash Punnoor June 12, 2006, 3:55 p.m. UTC | #2
Am Sonntag Juni 11 2006 23:36 schrieb Klaus Schmidinger:
> Udo Richter wrote:
[...]
> > Another good solution would be to do a conditional part in Make.config,
> > like this:
> > --- Make.config.template    2006-05-28 15:08:29.687375000 +0200
> > +++ Make.config.template    2006-06-11 17:50:14.467000000 +0200
> > @@ -16,6 +16,11 @@
> >  CXX      = g++
> >  CXXFLAGS = -g -O2 -Wall -Woverloaded-virtual
> >
> > +ifdef PLUGIN
> > +CFLAGS += -fPIC
> > +CXXFLAGS += -fPIC
> > +endif
> > +
> >  ### The directory environment:
> >
> >  #DVBDIR   = /usr/src/v4l-dvb/linux
> >
[...]
>
> Maybe it would have been better to leave the -fPIC thing as it has been
> for so long - as it is now, plugins will actually be compiled _without_
> it, which is probably a lot worse than compiling the main program _with_
> it...

Just to note: Udo's patch works fine here. :-)
  

Patch

--- Make.config.template	2006-05-28 15:08:29.687375000 +0200
+++ Make.config.template	2006-06-11 17:50:14.467000000 +0200
@@ -16,6 +16,11 @@ 
  CXX      = g++
  CXXFLAGS = -g -O2 -Wall -Woverloaded-virtual

+ifdef PLUGIN
+CFLAGS += -fPIC
+CXXFLAGS += -fPIC
+endif
+
  ### The directory environment:

  #DVBDIR   = /usr/src/v4l-dvb/linux