Project

General

Profile

tvheadend master git repo compile error

Added by s. steve over 10 years ago

Hello,

I downloaded tvheadend master from github repo and I tried to compile it on opensuse 12.2 32 and 64 bit but I have an error:

[ 64s] src/imagecache.c: In function 'imagecache_image_fetch':
[ 64s] src/imagecache.c:194:15: error: ignoring return value of 'fwrite', declared with attribute warn_unused_result [-Werror=unused-result]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 64s] cc1: all warnings being treated as errors
[ 64s] make: *** [/home/abuild/rpmbuild/BUILD/tvheadend-3.9.git.1401048675/build.linux/src/imagecache.o] Error 1
[ 64s] error: Bad exit status from /var/tmp/rpm-tmp.m1E2Qo (%build)

What is the problem? How can I fix it?

Very interest therefore I tried to compile it on opensuse 13.1 and it built without any error message. But I use opensuse 12.2 because I should compile it on opensuse 12.2.

an someone help me? Thanks.


Replies (20)

RE: tvheadend master git repo compile error - Added by Prof Yaffle over 10 years ago

Sledgehammer... try make WERROR=0 (or some variation). That will disable the -Werror flag ("treat warnings as errors") so it'll compile despite this warning.

Obviously not good practice, but... it might buy you the time to work out what's wrong with OpenSuse...make WERROR=0make WERROR=0

RE: tvheadend master git repo compile error - Added by s. steve over 10 years ago

Thanks, Sledgehammer. I will try it. Will tvheadend work me after compile?

RE: tvheadend master git repo compile error - Added by s. steve over 10 years ago

make WERROR=0 doesn't work. Compile finished same error:

[ 64s] src/imagecache.c: In function 'imagecache_image_fetch':
[ 64s] src/imagecache.c:194:15: error: ignoring return value of 'fwrite', declared with attribute warn_unused_result [-Werror=unused-result]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 64s] cc1: all warnings being treated as errors
[ 64s] make: *** [/home/abuild/rpmbuild/BUILD/tvheadend-3.9.git.1401048675/build.linux/src/imagecache.o] Error 1
[ 64s] error: Bad exit status from /var/tmp/rpm-tmp.m1E2Qo (%build)

RE: tvheadend master git repo compile error - Added by Prof Yaffle over 10 years ago

I'm guessing here, as I have neither OpenSuse nor your version of cc.

http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Warning-Options.html

Try -w or -Wno-error in some way... you'll need to do some digging on your specific system to figure out what precisely to do.

I'm more intrigued by why this builds on other systems, but not OpenSuse 12.2...

RE: tvheadend master git repo compile error - Added by s. steve over 10 years ago

Thank you Yaffle, I tried a lot of options for disable -Werror but anything didn't work.

I tried --disable-werror, -Werror=0, export CFLAG=-Werror and a lot.

What and how can I use an correct options for build? Thanks.

RE: tvheadend master git repo compile error - Added by Prof Yaffle over 10 years ago

Have you looked at what flags are being set in the makefile? It may be that anything you're passing is being over-ridden.

If you're feeling really brave, you could also look at the line that's causing the error in imagecache.c :)

RE: tvheadend master git repo compile error - Added by s. steve over 10 years ago

Yes, I saw flags of make in the log. Here is

[ 86s] cc -MD -MP -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector
-funwind-tables -fasynchronous-unwind-tables -I/usr/include/uriparser
-D_REENTRANT -Wall -Werror -Wwrite-strings
-Wno-deprecated-declarations -Wmissing-prototypes -fms-extensions -g
-funsigned-char -O2 -D_FILE_OFFSET_BITS=64
-I/home/abuild/rpmbuild/BUILD/tvheadend-3.9.git.1401134303/build.linux
-I/home/abuild/rpmbuild/BUILD/tvheadend-3.9.git.1401134303/src
-I/home/abuild/rpmbuild/BUILD/tvheadend-3.9.git.1401134303 -c
-o /home/abuild/rpmbuild/BUILD/tvheadend-3.9.git.1401134303/build.linux/src/imagecache.o src/imagecache.c

Do you recommend that I try to comnent out the -Werror flag in the Makefile?

RE: tvheadend master git repo compile error - Added by Prof Yaffle over 10 years ago

Yes... it's really not good practice (as the warning is valid, and switchign this off will over-ride it for everything) but it should get you closer to working.

And if commenting it out doesn't work, then you're back to -Wno-error and similar...

RE: tvheadend master git repo compile error - Added by s. steve over 10 years ago

I don't understand what happened but I tried to use -Wno-error and I have got an other error. I used this

make V1 -Wno-error

then I tried this

export CFLAGS = '-Wno-error'
make V1

I have got an error

[ 39s] /var/tmp/rpm-tmp.sO1WuV: line 30: export: `-Wno-error': not a valid identifier

I don't know how I can modify the Makefile because I download directly tvheadend from github and I use suse build service for compile it. I don't build the rpm on my pc locally.

RE: tvheadend master git repo compile error - Added by Prof Yaffle over 10 years ago

I can't help, then, I'm afraid - it's a compiler issue, not a tvheadend issue (despite that being where the error is evidently coming from!).

Unless someone with a similar environment wanders in, you may be better off asking in a Suse forum.

RE: tvheadend master git repo compile error - Added by s. steve over 10 years ago

Thanks for your help. Yes, I know that it isn't a tvheadend problem.
I hoped that someone can help in the forum here but I try to get some help from suse forums too...

RE: tvheadend master git repo compile error - Added by s. steve over 10 years ago

I created a patch file and applied it successfully. I could compile tvheadend master from github for opensuse 12.2.

Thanks for advices and tips.

RE: tvheadend master git repo compile error - Added by Prof Yaffle over 10 years ago

My only other throwaway - and I'm not a C programmer, so this may dissolve your house, eat your children, destroy everything you own, on your own head be it, you understand and accept the risks - is to change that offending line. In imagecache.c, change:

fwrite(hc->hc_data, hc->hc_data_size, 1, fp);

to

int throwaway = fwrite(hc->hc_data, hc->hc_data_size, 1, fp);

And see if that helps.

I can't promise it'll work - I can't promise it won't break something - and I can't promise that some other error won't still appear and stop you from compiling. But it might be worth a go.

RE: tvheadend master git repo compile error - Added by s. steve over 10 years ago

I tested -Wno-error patch. The patch worked but rpm didn't build properly and tvheadend master didn't work on suse 12.2. :(

I don't like to change imagecache.c because I don't know what will be wrong...

Something other?

RE: tvheadend master git repo compile error - Added by Prof Yaffle over 10 years ago

Nope, not from me, sorry - I don't have the same setup as you so really can't try anything else.

Personally, I'd hack the code... YMMV. Actually, I'd change operating system, but that's a different story :)

RE: tvheadend master git repo compile error - Added by s. steve over 10 years ago

I have got some courage and I tried what you recommend for a compile but it couldn't compile:

[ 62s] src/imagecache.c: In function 'imagecache_image_fetch':
[ 62s] src/imagecache.c:194:13: error: unused variable 'throwaway' [-Werror=unused-variable]

RE: tvheadend master git repo compile error - Added by Prof Yaffle over 10 years ago

Jeez...

Okay, a search for "Opensuse 12.2 suppress -Werror" turns up adding -disable-werror to the flags. Try adding this at ./configure time, or adding it to the makefile flags.

If that doesn't work, I guess you'll need to use that variable in some way, since that's what -Werror=unused-variable suggests to me. You may be able to suppress it with -Wno-unused-variable or similar - but, again, I'm just Googling and have neither your OS nor compiler on which to test.

You could try adding throwaway = NULL; as the next line, or something like that. I genuinely have no idea if that'd work, and I'm asking you to dig a deeper and deeper hole - finding out how to switch off warning on your compiler is probably the the right answer - so it's up to you.

I'll leave you to do your own research now, as there are pages of forum posts about getting rid of this kind of error :)

RE: tvheadend master git repo compile error - Added by s. steve over 10 years ago

I don't think that is suse 12.2 trouble. I suspect , it is an c compiler problem on suse 12.2 but I don't know what is the version.

I read that ./configure --disable-werror hasn't any effect to make CFLAGS amd found that I should use make CFLAGS = -Wno-error. It works I haven't got any error message during the compilation but the compiled tvheadend master doesn't work properly on suse 12.2.

What do you recommend I add throwaway = NULL to imagecache.c?

RE: tvheadend master git repo compile error - Added by Prof Yaffle over 10 years ago

No. Hacking the code was just an attempt to get it to compile - if you've found how to suppress the "treat warnings as errors" flag then you should revert the code changes (int throwaway =) and go back to the real code base, there's no reason for changes any more.

After that, we're into what you mean by "doesn't work properly", you haven't given a lot to go on here...

    (1-20/20)