# Mythtv-frontend does not build if /usr/X11R6 symlink exists



## robbak (Apr 20, 2014)

I have had a problem with mythtv-frontend not building for a while now, and managed to work it out last night.

The error was 
	
	



```
audio/spdifencoder.h:35: error: 'AVCODEC_MAX_AUDIO_FRAME_SIZE' was not declared in this scope
```
 (Could be a different file in that directory depending on what `make -j` does, full error string below to help searchers find it). I had long ago determined that this was because it was getting the ffmpeg includes from /usr/local/include instead of ../../external/FFmpeg, and that it was doing that because the command line listed `-I/usr/local/include` before `-I../../external/FFmpeg`. What I just worked out was why.

The scripts seem to be finding /usr/X11R6, and using that for the includes instead of /usr/local/. When the individual Makefiles are generated from the .pro files, the .pro files include code to find any instances of /usr/local/include and remove them, but because the entry is /usr/X11R6/include, it doesn't find it. Then a later procedure changes the /usr/X11R6/include to /usr/local/include (resolving the symlink, perhaps?), but that happens too late for the .pro script to remove it.

The simple fix is to remove that /usr/X11R6 symlink. I don't think it has been needed for years.

The locations of the checks are ./mythtv/libs/libmythtv/libmythtv.pro, line 20; and ./mythtv/libs/libmyth/libmyth.pro, line 23. Interestingly, this code looks like it is supposed to shift these declarations to the end of the includes list using a POSTINC list, but this isn't happening.

It's nice when you work things like this out. I have sent an email to the maintainer in case they think that having the /usr/X11R6 link in place is a common enough configuration to require a fix to the port. Probably patching those two files would be the best idea. 

Full error cascade:

```
audio/spdifencoder.h:35: error: 'AVCODEC_MAX_AUDIO_FRAME_SIZE' was not declared in this scope
audio/spdifencoder.h: In member function 'unsigned char* SPDIFEncoder::GetProcessedBuffer()':
audio/spdifencoder.h:22: error: 'm_buffer' was not declared in this scope
audio/spdifencoder.cpp: In constructor 'SPDIFEncoder::SPDIFEncoder(QString, int)':
audio/spdifencoder.cpp:27: error: 'm_buffer' was not declared in this scope
audio/spdifencoder.cpp:75: error: 'CodecID' was not declared in this scope
audio/spdifencoder.cpp:75: error: expected `;' before 'codec_id'
audio/spdifencoder.cpp:78: error: 'ff_codec_id_string' was not declared in this scope
audio/spdifencoder.cpp:78: error: expected primary-expression before '(' token
audio/spdifencoder.cpp:78: error: expected `)' before 'codec_id'
audio/spdifencoder.cpp: In member function 'int SPDIFEncoder::GetData(unsigned char*, int&)':
audio/spdifencoder.cpp:119: error: 'm_buffer' was not declared in this scope
audio/spdifencoder.cpp: In static member function 'static int SPDIFEncoder::funcIO(void*, unsigned char*, int)':
audio/spdifencoder.cpp:158: error: 'class SPDIFEncoder' has no member named 'm_buffer'
gmake[2]: *** [spdifencoder.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
In file included from audio/audiooutputdigitalencoder.h:9,
                 from audio/audiooutputbase.cpp:16:
audio/spdifencoder.h:35: error: 'AVCODEC_MAX_AUDIO_FRAME_SIZE' was not declared in this scope
audio/spdifencoder.h: In member function 'unsigned char* SPDIFEncoder::GetProcessedBuffer()':
audio/spdifencoder.h:22: error: 'm_buffer' was not declared in this scope
In file included from audio/audiooutputbase.cpp:16:
audio/audiooutputdigitalencoder.h: At global scope:
audio/audiooutputdigitalencoder.h:23: error: 'CodecID' has not been declared
audio/audiooutputbase.cpp: In member function 'virtual void AudioOutputBase::Reconfigure(const AudioSettings&)':
audio/audiooutputbase.cpp:645: error: 'CodecID' was not declared in this scope
audio/audiooutputbase.cpp:645: error: 'ff_codec_id_string' was not declared in this scope
gmake[2]: *** [audiooutputbase.o] Error 1
In file included from audio/audiooutputdigitalencoder.h:9,
                 from audio/audiooutputdigitalencoder.cpp:17:
audio/spdifencoder.h:35: error: 'AVCODEC_MAX_AUDIO_FRAME_SIZE' was not declared in this scope
audio/spdifencoder.h: In member function 'unsigned char* SPDIFEncoder::GetProcessedBuffer()':
audio/spdifencoder.h:22: error: 'm_buffer' was not declared in this scope
In file included from audio/audiooutputdigitalencoder.cpp:17:
audio/audiooutputdigitalencoder.h: At global scope:
audio/audiooutputdigitalencoder.h:23: error: 'CodecID' has not been declared
audio/audiooutputdigitalencoder.cpp:95: error: 'bool AudioOutputDigitalEncoder::Init' is not a static member of 'class AudioOutputDigitalEncoder'
audio/audiooutputdigitalencoder.cpp:95: error: 'CodecID' was not declared in this scope
audio/audiooutputdigitalencoder.cpp:95: error: expected primary-expression before 'int'
audio/audiooutputdigitalencoder.cpp:95: error: expected primary-expression before 'int'
audio/audiooutputdigitalencoder.cpp:95: error: expected primary-expression before 'int'
audio/audiooutputdigitalencoder.cpp:95: error: initializer expression list treated as compound expression
audio/audiooutputdigitalencoder.cpp:96: error: expected ',' or ';' before '{' token
gmake[2]: *** [audiooutputdigitalencoder.o] Error 1
```


----------



## SirDice (Apr 20, 2014)

*Re: Mythtv-frontend does not build if /usr/X11R6 symlink exi*



			
				robbak said:
			
		

> The simple fix is to remove that /usr/X11R6 symlink. I don't think it has been needed for years.


There shouldn't be one. As you say it's been removed quite a long time ago. I'm wondering why you have it, I don't have one on any of my systems.


----------



## robbak (Apr 25, 2014)

*Re: Mythtv-frontend does not build if /usr/X11R6 symlink exi*

This system has been source-upgraded since before the switch from xfree68 to xorg. It is probably a good testbed for finding problems triggered by strange configurations - the entropy is fairly high!


----------



## SirDice (Apr 25, 2014)

*Re: Mythtv-frontend does not build if /usr/X11R6 symlink exi*

After the upgrades did you also run `make delete-old` and `make delete-old-libs`? If not there may be a lot of old crap left from the old versions. It might be a good idea to start with a fresh system again.


----------



## SirDice (Apr 25, 2014)

*Re: Mythtv-frontend does not build if /usr/X11R6 symlink exi*

Just for giggles I tried to lookup when XFree86 was removed. XFree86 3.x didn't built on FreeBSD 6.x and was removed from ports in 2006. XFree86 4.x stuck around a little longer but was eventually removed in 2007. The transition from /usr/X11R6/ to /usr/local/ happened somewhere in 2008


----------



## kpa (Apr 25, 2014)

*Re: Mythtv-frontend does not build if /usr/X11R6 symlink exi*

The removal of the /usr/X11R6 symlink should be covered by `make delete-old`, if it isn't that's a clear bug and should be reported.


----------

