Fix the dvisvgm-1.0.8.ebuild


Please note that this blog has been moved.

Now it has its own domain: mynixworld.info🙂

If you want to read the latest version of this article (recommended) please click here and I open the page for you.

Today I had to install some Gentoo’s package which depends on the app-text/dvisvgm package. No problem, this happens all the time, right?

Well, sometimes (especially when you are not in the mood for such things) it happens that to compile/build a package it’s not that easy. Just a small typo in a Makefile and everything turns against you:

x86_64-pc-linux-gnu-g++ -Wall -Wnon-virtual-dtor -O2 -pipe -march=native -mtune=native -fomit-frame-pointer -fno-var-tracking -m64 -fpic -I/usr/include/freetype2  -Wl,-O1 -Wl,--as-needed -lfreetype   -o dvisvgm dvisvgm.o gzstream.o libdvisvgm.a  ../potracelib/libpotrace.a  -lz -lgs -lkpathsea 
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../x86_64-pc-linux-gnu/bin/ld: libdvisvgm.a(FontEngine.o): undefined reference to symbol 'FT_Init_FreeType'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../x86_64-pc-linux-gnu/bin/ld: note: 'FT_Init_FreeType' is defined in DSO /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libfreetype.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/../../../../lib64/libfreetype.so: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [dvisvgm] Error 1

That’s not a real problem if this is not the first time when you fix such things.

First of all, the source of the problem, like the command line error says, is regarding the libfreetype library that, if even it’s installed and working well on your system, it cannot be found by the GNU linker (ld) because that command line that invoked the linker it’s not properly set.

If something like this happened to you then go to your /var/tmp/portage/app-text/dvisvgm-1.0.8/work/dvisvgm-1.0.8/src and edit the Makefile file such as replace the reference to -lfreetype with FREETYPE_{CFLAGS,LIBS} :

...
FREETYPE_CFLAGS = -I/usr/include/freetype2
FREETYPE_LIBS = -FREETYPE_{CFLAGS,LIBS}
...
LDFLAGS = -Wl,-O1 -Wl,--as-needed -FREETYPE_{CFLAGS,LIBS}
...

Now that you found the source of your problem you know what have to be patched. But how? I must repeat myself that this is not a real problem if this is not the first time when you fix such things.

  1. fetch and unpack the ebuild
ebuild /usr/portage/app-text/dvisvgm/dvisvgm-1.0.8.ebuild clean fetch unpack
  1. edit your Makefile as described above
  2. compile and if everything is fine then install and qmerge them with ebuild
ebuild /usr/portage/app-text/dvisvgm/dvisvgm-1.0.8.ebuild compile install qmerge

and you are done😉

About Eugen Mihailescu

Always looking to learn more about *nix world, about the fundamental concepts of arithmetic, algebra and geometry. I am also passionate about programming, database and systems administration.
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s