libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unhelpful error message in libltdl


From: John Bytheway
Subject: Unhelpful error message in libltdl
Date: Tue, 29 Jan 2008 23:54:05 +0200
User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)

I've been using libtool and libltdl to load libraries at runtime in a project I'm working on, and encountered circumstances where the error messages are less helpful than they might be.

Looking at CVS HEAD, The problem is in find_module. It calls tryall_dlopen_module in one of two "normal" ways first, and if they fail, tries another way on the off chance it was moved to another directory. If the first attempt fails due, e.g., to an undefined symbol, then the second attempt leaves the error message saying "file not found". It would be more helpful to have the message about the undefined symbol.

A similar problem exists in lt_dlopenadvise, and mimicking the solution from that seems like the best answer. I've made my best shot at this, and a diff on CVS HEAD is attached. I've run the tests with this change and everything seems OK.

John
--- ltdl.c      5 Sep 2007 14:48:54 -0000       1.265
+++ ltdl.c      29 Jan 2008 21:46:28 -0000
@@ -537,18 +537,30 @@
       if (installed && libdir)
        {
          if (tryall_dlopen_module (handle, (const char *) 0,
                                    libdir, dlname, advise) == 0)
            return 0;
+
+         /* If we found FILENAME, stop searching -- whether we were able to
+            load the file as a module or not.  If the file exists but loading
+            failed, it is better to return an error message here than to
+            report FILE_NOT_FOUND when the alternative below fails.  */
+         if (!file_not_found())
+           return 1;
        }
 
       /* try to open the not-installed module */
       if (!installed)
        {
          if (tryall_dlopen_module (handle, dir, objdir,
                                    dlname, advise) == 0)
            return 0;
+
+         /* As before, if the file was found but loading failed, return now
+            with the current error message.  */
+         if (!file_not_found())
+           return 1;
        }
 
       /* maybe it was moved to another directory */
       {
          if (dir && (tryall_dlopen_module (handle, (const char *) 0,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]