Handling Missing X Libs Better
Allen Winter
winter at kde.org
Tue Feb 27 23:57:13 CET 2007
On Tuesday 27 February 2007 5:39:09 pm Bill Hoffman wrote:
> Alexander Neundorf wrote:
> > On Tuesday 27 February 2007 21:56, Allen Winter wrote:
> >
> >> On Tuesday 27 February 2007 3:42:22 pm Alexander Neundorf wrote:
> >>
> >>> On Tuesday 27 February 2007 19:20, Allen Winter wrote:
> >>>
> >>>> Howdy,
> >>>>
> >>>> Here's a problem with the buildsystem that I hope a cmake guru can fix.
> >>>> A least twice I've had to help people on $kde4-devel with the following
> >>>> scenario:
> >>>>
> >>>> - user runs cmake && make
> >>>> - compile fails due to missing ICE include files
> >>>> - user installs their distros libICE-devel packages
> >>>> - user runs cmake && make
> >>>> - linking fails (can't find libICE)
> >>>>
> >>>> apparently the fact that libICE can't be found is cached.
> >>>> so the user needs to remove their cmake cache so the
> >>>> search for libICE is re-run and then added to the linker libs list.
> >>>>
> >>>> Should there be an error exit from cmake if libICE can't be found
> >>>> in the first place?
> >>>>
> >>> Where does this happen ?
> >>>
> >> Alex,
> >>
> >> You're forcing me to not be lazy :)
> >>
> >> OK, in FindX11.cmake we see
> >> CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}"
> >> CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
> >> if (CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
> >> set(X11_X_PRE_LIBS -lSM -lICE)
> >> endif (CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
> >>
> >> If not found, then you'll have in CMakeCache.txt:
> >> MAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER:INTERNAL=0
> >> and cmake continues normally.
> >>
> >> then the compile starts and errors when you encounter a file that
> >> looks for an ICE include file.
> >>
> >> then you realize you need the libICE devel package, so you install it.
> >>
> >> then you run cmake again, but CHECK_LIBRARY_EXISTS("ICE".... ) apparently
> >> looks at the cache value of CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER
> >> so you'll never have "-lSM -lICE" added to your X11_LIBS
> >>
> >
> > That feels more like a bug in the cmake module. If the test wasn't successfull
> > it should try again the next time. Apparently it doesn't.
> > I'll have a look.
> >
> > Bye
> > Alex
> >
>
> The problem seems to be that a TRY_COMPILE is being used to find a
> library. Once a try-compile has been done, it never gets re-done. If
> FIND_LIBRARY were used instead, it would not have that problem.
>
Cool! I hope our resident guru (Alex) can fix that then.
But I still think we should exit from the cmake stage with
a nice macro_log_feature() message when a required
package (ICE-devel in this case) cannot be found.
--
KDEPIM Developer
I accept PayPal payments to awinterz at earthlink.net
More information about the Kde-buildsystem
mailing list