Hide Forgot
Description of problem: When F15 updated to js 1.8.5 it broke building of avidemux[1]. It is understood that there is no requirement to fix js due to a 3rd party package. The purpose of this bug report is to determine which package (js or avidemux) is at fault. At this time the problem looks to be in jsutil.h. Although both js versions 1.70 and 1.8.5 have the header jsutil.h only the new version (1.8.5) includes it in the main header jsapi.h. caillon mentioned that the build flags seemed to be significantly different than what Fedora uses[2] but the package is being built under mock using the standard rpmbuild cmake macro. Version-Release number of selected component (if applicable): js-1.8.5-4 How reproducible: avidemux will not build Actual results: build.log excerpt: In file included from /usr/include/jsval.h:48:0, from /usr/include/jspubtd.h:47, from /usr/include/jsapi.h:49, from /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_JSAvidemux.h:8, from /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_JSAvidemux.cpp:17: /usr/include/jsutil.h:213:5: error: stray '#' in program /usr/include/jsutil.h:217:5: error: stray '#' in program /usr/include/jsutil.h:221:5: error: stray '#' in program /usr/include/jsutil.h:225:5: error: stray '#' in program In file included from /usr/include/jsval.h:48:0, from /usr/include/jspubtd.h:47, from /usr/include/jsapi.h:49, from /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_JSAvidemux.h:8, from /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_JSAvidemux.cpp:17: /usr/include/jsutil.h: In function 'void* js_malloc(size_t)': /usr/include/jsutil.h:213:24: error: 'error' was not declared in this scope /usr/include/jsutil.h: In function 'void* js_calloc(size_t)': /usr/include/jsutil.h:217:27: error: 'error' was not declared in this scope /usr/include/jsutil.h: In function 'void* js_realloc(void*, size_t)': /usr/include/jsutil.h:221:28: error: 'error' was not declared in this scope /usr/include/jsutil.h: In function 'void js_free(void*)': /usr/include/jsutil.h:225:11: error: 'error' was not declared in this scope Expected results: Good build. Additional info: [1] https://bugzilla.rpmfusion.org/show_bug.cgi?id=1756#c4 [2] https://admin.fedoraproject.org/updates/js-1.8.5-4.fc15
As I mentioned, I suspect this is likely due to avidemux using different compiler options. There are no stray # in jsutil.h or anywhere that I can find, so something in the way avidemux is being built is causing the (pre-processed) source to look different.
The offending snippet is this: static JS_INLINE void* js_malloc(size_t bytes) { return malloc(bytes); } static JS_INLINE void* js_calloc(size_t bytes) { return calloc(bytes, 1); } static JS_INLINE void* js_realloc(void* p, size_t bytes) { return realloc(p, bytes); } static JS_INLINE void js_free(void* p) { free(p); } Something somewhere must be #define-ing the malloc, calloc, realloc and free functions to #error something.
Hey Kevin! I was hoping you'd pop in! As usual you've given me just enough to dig in but not enough to understand exactly what you mean. :) I didn't find any "#define ..." for those functions(?). Is that the problem? Thanks, Richard
> I didn't find any "#define ..." for those functions(?). Is that the problem? No. They must be getting #defined somewhere, otherwise there's no place the "#" and "error" tokens GCC is complaining about could come from. You just haven't found the place.
Try searching in the other library headers avidemux is #include-ing, this sounds like a conflict between different libraries. (If so, #undef statements can probably work around it.) In fact, even without searching for the location of the #define, you can try the following workaround: Everywhere where jsapi.h is included, immediately above the #include <jsapi.h> line, add the following lines: #undef malloc #undef calloc #undef realloc #undef free
Ok, I may have to use your suggestion. I can't find the #define anywhere. I'm on F14 so I used mock to create a F15 chroot (which is what buildsys is doing anyway, right?) I installed the avidemux source and all of it's dependencies and tried the following: # grep -r js_malloc /usr/include /usr/include/jstl.h: void *malloc(size_t bytes) { return js_malloc(bytes); } /usr/include/jsnum.h: char *dbuf; /* must be allocated with js_malloc() */ /usr/include/jscntxt.h: void *p = ::js_malloc(bytes); /usr/include/jsutil.h:static JS_INLINE void* js_malloc(size_t bytes) { /usr/include/jsutil.h: void *memory = js_malloc(sizeof(t)); \ /usr/include/jsutil.h: void *memory = js_malloc(numBytes); # grep -r js_malloc builddir/build/BUILD/avidemux_2.5.4/ <no results> I don't know where else to look. I'm "rm -f"-ing the built in js in the spec file but it doesn't matter because those functions don't exist in the bundled version. It's used in 12 places in the avidemux code. How about a good sed find and replace? :) I'll have to figure out how to add a newline.
> I installed the avidemux source and all of it's dependencies and tried the > following: > > # grep -r js_malloc /usr/include It's not js_malloc which is getting #defined, but malloc itself!
> It's used in 12 places in the avidemux code. How about a good sed find and > replace? :) I'll have to figure out how to add a newline. Just use \n in the replacement string. (At least GNU sed, which is what we're using, understands that.)
Looking at pre-processed source would also help figure out where the bad #define is coming from.
Kevin, This is all I could find: grep -ir "define malloc" /usr/include /usr/include/X11/Xlibint.h: * define MALLOC_0_RETURNS_NULL. This is necessary because some /usr/include/js-confdefs.h:#define MALLOC_H <malloc.h> Am I getting warmer? Christopher, Is there something I can do/run to get you more info? Thanks, Richard
(In reply to comment #5) > In fact, even without searching for the location of the #define, you can try > the following workaround: Everywhere where jsapi.h is included, immediately > above the #include <jsapi.h> line, add the following lines: > #undef malloc > #undef calloc > #undef realloc > #undef free Ok, tried that and it got rid of the errors in the original log snippet, but others are still there plus more (probably because it got further in the build). First: In file included from /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_editor/../ADM_editor/../ADM_audio/aviaudio.hxx:72:0, from /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_editor/../ADM_editor/ADM_Video.h:27, from /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_editor/ADM_edit.hxx:32, from /builddir/build/BUILD/avidemux_2.5.4/avidemux/avi_vars.h:5, from /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_JSAvidemuxAudio.h:15, from /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_Avidemux.h:13, from /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_JSAvidemux.h:13, from /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_JSAvidemux.cpp:17: /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_editor/../ADM_editor/../ADM_audio/../ADM_audiocodec/ADM_audiocodec.h: In constructor 'ADM_Audiocodec::ADM_Audiocodec(uint32_t)': /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_editor/../ADM_editor/../ADM_audio/../ADM_audiocodec/ADM_audiocodec.h:31:29: warning: the address of 'fourcc' will never be NULL [-Waddress] /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_JSAvidemux.cpp: At global scope: /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_JSAvidemux.cpp:73:1: error: too many initializers for 'JSFunctionSpec' ... (several more lines, same line number) /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_JSAvidemux.cpp:73:1: error: invalid conversion from 'JSBool (*)(JSContext*, JSObject*, uintN, jsval*, jsval*)' to 'JSNative' [-fpermissive] ... (several more lines, same line number) Then later: /builddir/build/BUILD/avidemux_2.5.4/avidemux/ADM_script/ADM_JSAvidemux.cpp:241:74: error: 'JS_GetStringBytes' was not declared in this scope ... (several more, different line numbers) I'm starting to think in this case going back to the bundled JS would be easier :)
Well, you solved the easiest problem, but now somebody needs to actually port the code for the API changes. I guess building with the bundled JS might be a quick way to get something built, but not that great a long-term solution…
What the errors mean: * "error: too many initializers for 'JSFunctionSpec'" basically means what it says. The code is initializing structures of type 'JSFunctionSpec' with more members than the structure actually has. Some member must have been dropped in the new version, you'll have to remove it from the initializers. * "error: invalid conversion from 'JSBool (*)(JSContext*, JSObject*, uintN, jsval*, jsval*)' to 'JSNative' [-fpermissive]" means the functions being passed as function pointers here do not have the correct prototypes. You have to look up what the current prototype for JSNative is and then update all the functions used here to match that prototype. * "error: 'JS_GetStringBytes' was not declared in this scope" means the code is trying to use a function which does not exist, you have to find out how the replacement is called. The fact that there are only 3 distinct errors lets me hope that not too many changes would be required. (Hopefully those errors aren't just the tip of the iceberg, there could in principle be a flood of errors in some other file which gets compiled later.)
I really need avidemux and devede. I used to work with them on F13-F14. Unfortunately ,with the F15 I can't use the 1st one and I have serious problems with the sound on the 2nd one ! So, if you believe that there is no future with these 2 major applications (for me) , please tell me something to change my Operating System. Thanks a lot.
Kevin, That's for the insight as usual but that sounds like an upstream job. I understand what you're saying but not well enough to implement it without a lot of work and I just don't have the time right now. I'm going to go ahead and make the call and re-enable the built-in js. I'll report the problem upstream and see if they have (or are working on) a solution. Thanks, Richard
I'm going to assume that there's nothing wrong with the new version of js other than it's currently incompatible with avidemux. This bug will be closed and all further updates will be posted to the rpmfusion bug: https://bugzilla.rpmfusion.org/show_bug.cgi?id=1756