Bug 103194

Summary: [GTK] Broken build with undefined references to shm_open / shm_unlink
Product: WebKit Reporter: Kalev Lember <kalevlember>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: cgarcia, dbates, dominique-webkit.org, mrobinson, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Description Flags
Patch v2 none

Description Kalev Lember 2012-11-24 18:39:05 PST
Building webkitgtk-1.11.2 for rawhide (Fedora 19):

  CXXLD  Programs/WebKitPluginProcess
/usr/bin/ld: Source/WebKit2/Platform/unix/Programs_WebKitPluginProcess-SharedMemoryUnix.o: undefined reference to symbol 'shm_unlink@@GLIBC_2.2.5'
/usr/bin/ld: note: 'shm_unlink@@GLIBC_2.2.5' is defined in DSO /usr/lib64/librt.so.1 so try adding it to the linker command line
/usr/lib64/librt.so.1: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
Comment 1 Kalev Lember 2012-11-24 18:42:13 PST
Created attachment 175871 [details]
Comment 2 Martin Robinson 2012-11-25 08:45:22 PST
Comment on attachment 175871 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=175871&action=review

> configure.ac:1128
> +       save_LIBS="$LIBS"
> +       AC_SEARCH_LIBS([shm_open], [rt], [SHM_LIBS="-lrt"])
> +       AC_SUBST(SHM_LIBS)
> +       LIBS="$save_LIBS"

What's going on here with save_LIBS?
Comment 3 Kalev Lember 2012-11-25 09:00:29 PST
AC_CHECK_LIB and AC_SEARCH_LIBS write the result to the LIBS variable and I didn't want to clobber the contents of the variable here. I'm using save_LIBS to restore the original LIBS after calling AC_SEARCH_LIBS(). Perhaps it doesn't make much of a difference right here and right now, but it can avoid surprises in the future.

I guess the macros were written with small build systems in mind where only one LIBS variable is sufficient; in webkitgtk with several libraries and executables produced, it seems better to avoid using the global LIBS variable.

For what it's worth, cairo does the same thing with save_LIBS: http://cgit.freedesktop.org/cairo/tree/configure.ac#n796
Comment 4 Kalev Lember 2012-11-25 09:04:40 PST
Or would it be better to do something like this? (untested)

       AC_SEARCH_LIBS([shm_open], [rt])
Comment 5 Martin Robinson 2012-11-26 09:01:26 PST
My preference is that we use this work-around for all instances of AC_SEARCH_LIBS or none of them. So far we haven't had an issue with it. Perhaps we can avoid it here and just be careful not to use a variable named LIBS? Let me know if I'm misunderstanding you.
Comment 6 Kalev Lember 2012-11-26 09:11:41 PST
Created attachment 176015 [details]
Patch v2

Fair enough, uploaded a new version with the save_LIBS workaround removed. I agree, should be fine as long as we avoid using LIBS.
Comment 7 Martin Robinson 2012-11-26 09:13:03 PST
Comment on attachment 176015 [details]
Patch v2

Thanks for fixing this!
Comment 8 WebKit Review Bot 2012-11-26 10:14:02 PST
Comment on attachment 176015 [details]
Patch v2

Rejecting attachment 176015 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
ls/Scripts/update-webkit line 108.

Failed to run "['Tools/Scripts/update-webkit', '--chromium', '--force-update']" exit_code: 2
hile loading dependencies of All.gyp while trying to load All.gyp
Error: 'depot_tools/gclient sync --force --reset --delete_unversioned_trees' failed 3 tries and returned 512 at Tools/Scripts/update-webkit-chromium line 96.
Re-trying 'depot_tools/gclient sync --force --reset --delete_unversioned_trees'
No such file or directory at Tools/Scripts/update-webkit line 108.

Full output: http://queues.webkit.org/results/14986694
Comment 9 Martin Robinson 2012-11-26 14:00:55 PST
Comment on attachment 176015 [details]
Patch v2

Clearing flags on attachment: 176015

Committed r135761: <http://trac.webkit.org/changeset/135761>
Comment 10 Martin Robinson 2012-11-26 14:00:58 PST
All reviewed patches have been landed.  Closing bug.
Comment 11 Alberto Garcia 2013-09-09 05:16:10 PDT
*** Bug 104118 has been marked as a duplicate of this bug. ***