Re: Avoiding compiler warnings/errors with function pointers
On Tue, 5 Jun 2007, Peter O'Gorman wrote: freeBSD has a dlfunc() function that behaves like dlsym but returns a function pointer, last time I looked it was implemented using a union... wait, let me look again...: http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/lib/libc/gen/dlfunc.c?rev=1.3;content-type=text%2Fplain I think it is even in our TODO to have libltdl do this somehow, in the meantime, Reuben can do something similar in his own code. I am on Linux, where I can't see a similar function. -- http://rrt.sc3d.org/ | think tank, n. a safe container for noxious gases ___ http://lists.gnu.org/mailman/listinfo/libtool
Re: Too many libraries --as-needed ?
On Mon, Jun 11, 2007 at 08:27:26AM -0500, Paul Elliott wrote: The sponsor of peless to debian complains that peless links to too many libraries that it does not strictly speaking need: g++ -g -O2 -o peless -L/usr/lib peless-peless.o peless-gmore.o +peless-search.o -pthread -L/opt/gnome/lib -lgtkmm-2.4 -lgdkmm-2.4 -latkmm-1.6 +-lgtk-x11-2.0 -lpangomm-1.4 -lcairomm-1.0 -lgdk-x11-2.0 -latk-1.0 +-lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lfreetype -lz +-lfontconfig -lexpat -lglitz -lpng12 -lXrender -lX11 -lpthread -lXau -lXdmcp +-lgconfmm-2.6 -lglibmm-2.4 -lgconf-2 -lgobject-2.0 -lsigc-2.0 -lORBit-2 -lm +-lgmodule-2.0 -ldl -lgthread-2.0 -lglib-2.0-lboost_filesystem -lboost_regex gtkmm2.4 gconfmm-2.6 and boost* I have specified directly. the others are a result of these configure.ac: PKG_CHECK_MODULES(DEPS, gtkmm-2.4 = 2.4.0 gconfmm-2.6 = 2.6.0) and this line from Makefile.am peless_LDADD=$(DEPS_LIBS) $(BOOST_FILESYSTEM_LIB) $(BOOST_REGEX_LIB) Specificyly $(DEPS_LIBS). 16 of the libraries are said to be not really needed. It is suggested that peless add --as-needed to LDFLAGS. Is this a good idea? The PKG_CHECK_MODULES is the recommended way to build a program using gtkmm and gconfmm. This question concerns Libtool more than Autoconf, so I copied its mailing list. You can remove [EMAIL PROTECTED] from replies. Use Libtool to link this application, and only specify the DEP_LIBS that you use directly. Stock Libtool will add the extra libraries anyway, but Debian patches its Libtool to avoid this. An official GNU Libtool release may perform this optimization, when it can do so portably. You might look at other Debian packages that use gtkmm without incurring excess dependencies, to confirm that they too use this approach. `--as-needed' is not compatible with Libtool[1], and it may not be supported on all architectures[2]. Some C++ code will break with it[3]. [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=347650 [2] http://lists.gnu.org/archive/html/libtool/2005-08/msg00019.html [3] http://ciaranm.org/show_post.pl?post_id=13 ___ http://lists.gnu.org/mailman/listinfo/libtool
Re: Avoiding compiler warnings/errors with function pointers
On Jun 11, 2007, at 12:34 PM, Reuben Thomas wrote: On Tue, 5 Jun 2007, Peter O'Gorman wrote: freeBSD has a dlfunc() function that behaves like dlsym but returns a function pointer, last time I looked it was implemented using a union... wait, let me look again...: http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/lib/libc/gen/ dlfunc.c?rev=1.3;content-type=text%2Fplain I think it is even in our TODO to have libltdl do this somehow, in the meantime, Reuben can do something similar in his own code. I am on Linux, where I can't see a similar function. Hi Reuben, When I reread your email I see my mistake. You can not avoid the warning altogether, somewhere there has to be code that will warn, FreeBSD chose to move that bit of code into libc, you could similarly choose to move the warning code to one file and turn off the strict compilation for that file. Sorry for misleading. Peter -- Peter O'Gorman http://pogma.com ___ http://lists.gnu.org/mailman/listinfo/libtool