OpenBSD and librsvg

Hi,

I’ve just recently started using FVWM and OpenBSD,

I’m trying to compile fvwm 2.5.24 with svg support on OpenBSD 4.2, I found the following guide, its a little out of date but the configure line still works for the most part:
bsdlamer.dev-zero.de/index.php?/ … .83.9.html

I would like to add svg support but receive the following message during the configure script

according to the set command, my LD_LIBRARY_PATH is set to /usr/local/lib

When I do locate librsvg I receive the following

when I look at the configure script it looks like its trying to use the rsvg.h

is there a switch or OS variable that I can add/modify to allow the cofigure script to see this?

Looks like it cannot find the correct lib-files.

It might help to create some symlinks…

cd /usr/local/lib
ln -s librsvg-2.so.18.1 librsvg-2.so
ln -s librsvg-2.so.18.1 librsvg-2.so.2

Also make sure that LD_LIBRARY_PATH is exported to the configure-script.

env LD_LIBRARY_PATH=/usr/local/lib ./configure

I created both symlinks and ran “env LD_LIBRARY_PATH=/usr/local/lib ./configure”

but received the same output as above, from the configure script… Failed to run test program.

One thing i’ve noticed ( and i’m not sure it is related) is that if I run

png and iconv are found properly, but if I remove the switches pointing to /usr/local/lib neither are found

Shouldn’t these still be picked up if my LD_LIBRARY_PATH is set to /usr/local/lib ?

I’m just wondering if I need switches like “–with-svg-library=/usr/local/lib” and “–with-svg-includes=/usr/local/include/librsvg-2/librsvg/”

except neither of them exists, as far as I know…

Is your dynamic linker is ignoring LD_LIBRARY_PATH ?

Is it also ignoring LD_PRELOAD ?

env LD_PRELOAD=/usr/local/lib/librsvg-2.so ./configure

What if you copy the lib-files to /usr/lib ?

cp /usr/local/lib/librsvg-2.* /usr/lib/

Here’s what happens when I run 'env LD_PRELOAD=/usr/local/lib/librsvg-2.so ./configure ’ as a user.

I copied the /usr/local/lib/librsvg-2.* files to /usr/lib/ but received the same message as in my first post when I ran configure.

I tried adding an “echo $LIBS” to the configure script, hoping to find out where it was looking

I then ran ./configure and received the following

Which makes me think it is trying to look in /usr/local/lib, but maybe still not named properly… but I’m not sure…

At least something different happened. I don’t know how the dynamic linker works
in openbsd. Maybe you need to specify all the lib-files…

LD_PRELOAD="/usr/local/lib/librsvg-2.so /usr/local/lib/libXrender.so …" ./configure

Where is the linker looking for lib-files by default? The guide you linked to copies
libpng into /usr/X11R6/lib/.

I still think it is some kind of issue with the openbsd runtime linker.

What if you remove the “checking whether a librsvg program compiles and runs…”
test from the configure script ?

I don’t think copying the png stuff matters since its done after the configure script, also I didn’t copy it with version 2.5.23 and png worked fine. This version (2.5.24) will probably compile, and work, the same, but I would like to add svg support, if it’s possible.

I came across this while trying to find how bsd links libraries
linuxmafia.com/faq/Admin/ld-lib-path.html

I would imagine OpenBSD doesn’t use LD_LIBRARY_PATH since it aims to be secure by default.

I’m not sure how to remove the code and still have it add svg support… learning C/C++ is on my todo list still… (hopefully once my exams are done I’ll be able to better focus on this)

from what I found I think the -L command in the $LIBS variable should be telling the script where to read the libraries “-L/usr/local/lib -L/usr/X11R6/lib” but I’m not sure why it can’t find them then since they are in /usr/local/lib directory.

“Specifying the location of dynamic libraries not in /usr/lib” - They mention that solaris has a -R option to specify the run time location of libs. Does openbsd have something like that?

Remove the following code from configure.ac:

if test x"$with_rsvg" = xyes ; then
   AC_MSG_CHECKING(whether a librsvg program compiles and runs)
   original_CFLAGS="$CFLAGS"
   original_LIBS="$LIBS"
   CFLAGS="$CFLAGS $rsvg_CFLAGS"
   LIBS="$LIBS $rsvg_LIBS"
   AC_TRY_RUN([
      #include <librsvg/rsvg.h>
      #include <librsvg/rsvg-cairo.h>
      int main() {
         RsvgHandle *rsvg;
         g_type_init();
         if(!(rsvg = rsvg_handle_new())) return 1;
         g_object_unref(G_OBJECT(rsvg));
         return 0;
      }
   ], [
      AC_MSG_RESULT(yes)
   ], [
      AC_MSG_RESULT(no)
      AC_MSG_WARN([*** The librsvg test program failed to run. If your system])
      AC_MSG_WARN([*** has shared libraries outside the normal system library])
      AC_MSG_WARN([*** path, you need to make sure that the LD_LIBRARY_PATH])
      AC_MSG_WARN([*** (or the like) environment variable is correctly set.])
      with_rsvg=no
      problem_rsvg=": Failed to run test program"
   ], [echo $ac_n "cross compiling; assumed OK... $ac_c"])
   CFLAGS="$original_CFLAGS"
   LIBS="$original_LIBS"
fi

… and run ./utils/configure_dev.sh.

The -L/usr/local/lib tells the compiler where to find the libs. I think that part is working just fine. The problem is the run time linker. You may need -R/usr/local/lib or something simular.

I removed the code from configure.ac and this is what I get when I run ./utils/configure_dev.sh

I’m probably missing something, since I have a very minimal install of packages. I can provide a list of what I have installed if it will help…

I tried running ldconfig and receive

$ ldconfig
ldconfig: /var/run/ld.so.hints.Zvgkj13684: Permission denied

so I looked at the man page for ldconfig and it says

I tried adding /usr/local/lib as a shlib_dirs in the /etc/rc.conf but no change occured.

Looking at the man page for ld there is a -R switch but I’m not sure how/where to apply it to the configure script

This looks very promising.

LD_RUN_PATH sounds just like what we’ve been looking for:

env LD_RUN_PATH="/usr/local/lib" ./configure

If your system somehow mysteriously also ignores LD_RUN_PATH, you will have to pass the “-R” option to the linker. With gcc, you can use the “-Wl,” option for that. Pass these options to the configure script via the LDFLAGS environment variable. Something like this should do it:

env LDFLAGS="-Wl,-R/usr/local/lib" ./configure

There can be no space between “-Wl,” and “-R”.

I tried both commands and neither worked, I also tried ‘export LD_RUN_PATH="/usr/local/lib"’ and then ./configure, but that also didn’t work.

I just noticed one of the other dependencies had corrected itself though and I just broke it again.

The FreeType version changed to yes at some point, and I didn’t notice… was paying more attention to the png and librsvg section i guess.

This is how I broke it again. As root I ran ldconfig -r to see what was in the hints file and noticed that the librsvg was listed as /usr/lib/librsvg-2.* from when I copied the files there earlier, so I went and deleted those files and then ran ldconfig as root with no switches hoping it would update with the /usr/local/lib path. Then as a user I re-ran the configure script and received a ‘no’ to FreeType again. When i checked the hints file again I realised I went from 206 entries down to 38.

I saved a copy of the output from when I listed the hints, and will try to find out how the entries were added in the first place.

Maybe it’s time to simplify the problem. This is the c code from the configure script:

#include <librsvg/rsvg.h> #include <librsvg/rsvg-cairo.h> int main() { RsvgHandle *rsvg; g_type_init(); if(!(rsvg = rsvg_handle_new())) return 1; g_object_unref(G_OBJECT(rsvg)); return 0; }
Put that code in a file, rsvg_test.c, and figure out how to compile it and run it without errors. I do it like this:

gcc `pkg-config --cflags --libs librsvg-2.0 cairo` rsvg_test.c -o rsvg_test && ./rsvg_test

You may need to pass some additional flags to gcc, like “-Wl,-R/usr/local/lib”. If you get this working, you should then be able to pass the same set of flags to the configure script.

I tried a couple different switches but got the same reply

I just came across this article which probably explains the pthread errors.

onlamp.com/pub/a/bsd/2007/11 … tml?page=2

From the article:

I’m still reading through the article, but I’m thinking I’ll probably have to give up on the svg support for now…

Try

gcc `pkg-config --cflags --libs librsvg-2.0 cairo` -lpthread rsvg_test.c -o rsvg_test && ./rsvg_test

it looks like that worked. I didn’t receive any undefined references with that line, just the warnings.

I ran the following

and it now shows as ‘yes’ for svg support.

Good. Now for the really big question: How to make the configure script detect if -lpthread is needed or not?

the following message during the configure script.
goldenslot ผ่านเว็บ