gm convert: FreeType library is not available (/usr/local/share/ghostscript/fonts/n019003l.pfb) - freetype

It's on OS X 10.9. I installed GraphicsMagick with brew, and FreeType v2.5.2. But when I use gm convert in my program, I got this error:
{ [Error: Command failed: gm convert: FreeType library is not available (/usr/local/share/ghostscript/fonts/n019003l.pfb).
] code: 1, signal: null }
My FreeType:
flyn:Font ijse$ freetype-config --libs
-L/usr/local/Cellar/freetype/2.5.2/lib -lfreetype -lz -lbz2 -lpng15
I've been searched on google for a while but got no answer.

You have to investigate a bit more:
1) Which binary is producing that error? Say it's gm. Please post output of
ldd `which gm`
to see if the library is linked directly.
2) if yes, try to add your path to LD_LIBRARY_PATH variable. Look if your path is there (here is how to do it: How to print the ld(linker) search path)
3) if no, have look in the configuration files
EDIT: Run freetype-config --libs. The path behind -L is the real location of the library. Is it anywhere in the output of the following command?
ldconfig -v 2>/dev/null | grep -v ^$'\t'
This command shows where the libraries are looked for. Is the location of your freetype library there? If yes, it is OK. If no, this is the cause of your problem! Try one of these:
make symlinks from one of those directories to your library
set export LD_LIBRARY_PATH=/location/of/your/freetype/libraries in the script that run the program that issues the above error.

Related

gstreamer mac os illegal operation: 4

Compiling the Gstreamer Program works with no issues but when i try to run the output on MacOS it says "Illegal instruction: 4" and I can't figure out why this is happening.
I tried using -mmacosx-version-min=10.x 'x' being 6,7,8,9,10,11 and exported all these values as the same in the MACOSX_DEPLOYMENT_TARGET environment variable. Still running this gives me an error of "Illegal instruction: 4"
gcc basic-tutorial-1.c pkg-config --cflags --libs gstreamer-1.0, also gcc basic-tutorial-1.c pkg-config --cflags --libs gstreamer-1.0 -mmacosx-version-min=10.6 but running ./a.out gives the same error.
Now it's supposed to play the video from "basic-tutorial-1" but it does not play that instead it just drops this error "Illegal Instruction: 4".
Just compiling the application with that MACOSX_DEPLOYMENT_TARGET probably wont help you here. Most likely it is the Gstreamer library itself that has been compiled with an instruction set not available on your machine (SSE/AVX or alike). Is this via macports/brew or the official GStreamer .pkg? If none of the binary distributions support your CPU you may have to rebuild the GStreamer library yourself for your system.
I met this problem and it turned out that the libaries installed using brew were not working properly. For me, I would need to install from Mac pkg files here:
After installing those pkgs, mac would not link the libs automatically for you. So you would need to type the following command to set ENV PKG_CONFIG_PATH so that pkg-config could find the libs:
export PKG_CONFIG_PATH=/Library/Frameworks/GStreamer.framework/Libraries/pkgconfig:$PKG_CONFIG_PATH
You should be able to build with the following command afterwards:
gcc basic-tutorial-1.c -o basic-tutorial-1 `pkg-config --cflags --libs gstreamer-1.0`
However, I found that there is something wrong with mac's video display for basic-tutorial-1. See this.

Generated binary is linked to use system instead of local library

My build system has libtiff installed in this path:
/usr/lib/x86_64-linux-gnu/libtiff.so.5.2.4
And I have built a custom libtiff in a local path:
/home/user/libtiff/usr/local/lib/libtiff.so.3.8.2
I want to build a binary linked with libtiff installed on my local path. To do that, I use this command:
cc -o binary \
obj1.o ... objn.o \
-L /home/user/libtiff/usr/local/lib/ \
-Wl,-rpath,L/home/user/libtiff/usr/local/lib/ \
-ltiff
The problem is after linking and generating the binary, ldd shows the binary is not using the local libtiff, but the library installed on the build system:
$ ldd binary | grep libtiff
libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007fbaf9ad6000)
I don't understand why the linker is not using the local library.
I have read some related posts talking about setting LD_LIBRARY_PATH, LD_PRELOAD or LIBRARY_PATH, but none of them works as expected.
Modifiying /etc/ld.so.conf is not a nice option.
Remove the spurious L in front of the root slash:
-Wl,-rpath,L/home/user/libtiff/usr/local/lib/
#yugr, thank you for this -verbose tip. It helped me to fix the issue. The problem was with another library compiled locally (spandsp) that depends on libtiff. The configure script of the spandsp was deciding to use libtiff.so.5 (build system) instead of libtiff.so.3 (compiled locally). That was because LDFLAGS was not properly defined before executing the configure script. Defining LDFLAGS as -L/home/user/usr/local/lib/ -Wl,-rpath-link,/home/user/usr/local/lib/ fixed the issue. Thank you very much for your interest in helping with this issue! :)

pkg-config: command not found, using cygwin on windows 7

I'm using Cygwin on windows to run this command:
g++ `pkgconfig --libs --cflags opencv` -I. -o mergevec mergevec.cpp ....
But I get an error:
-bash: pkg-config: command not found
I've installed cygwin directly on C:. I've added to the PATH environment variable the following:
C:\cygwin64\bin;
C:\cygwin64\lib
I've run cygcheck -c and it gives me a whole list of packages, but pkg-config isn't in that list.
There is a folder called pkgconfig in C:\cygwin64\lib though.
How do I fix this error?
pkg-config is a piece of software that allow your computer to check installed libraries for source compilation. It may not be installed on Windows so in last scenario please check for install.
However in your case i think it is installed, but not set on the right path for linux commands. Try to type in cygwin:
$ export PKG_CONFIG_PATH=c:\\cygwin\\usr\\local\\lib\\pkgconfig
as stated in this post.
Otherwise just abandon Windows and try to compile mergevec on an Linux VM, which is really easier (it was made for it). The only down point of this method is that you will have to do the mergevec operation (and the ones before, otherwise you may have encoding problems) under your linux space. See my previous answer for this manipulation.
If any problem don't hesitate.
run cgywin setup and in package search type pkg-config then make sure that pkg-config utility is installed.
it should solve the not found command problem.
I think that in this case it has nothing to do with the PKG_CONFIG_PATH, because the user complains on the "command not found" error message.
The user probably mixes up pkg-config as a tool (with -) and pkgconfig (without -) as a directory as I see from the command. If I run it without dash on my system I get the same error message of course:
$ pkgconfig --libs --cflags opencv
-bash: pkgconfig: command not found
On Cygwin there is pkgconf.exe as a tool, pkg-config as a symlink to it and pkgconfig as a directory. There is no tool pkgconfig.
If it is not found as pkg-config then it means that pkg-config tool is missing in the Cygwin installation (the solution is to upgate Cygwin tools and select it in the checkbox) or it is probably the symlink problem which I described in https://stackoverflow.com/a/66037850/4807875 (the solution in this case is to use the indeed Cygwin console instead of the native cmd.exe with C:\Cygwin64\bin in PATH in it, or to call explicitly pkgconf.exe).

ld: library not found for -lgsl

I'm working in OSX and I'm attempting to run a make file and when I try I get the following:
ld: library not found for -lgsl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [harm] Error 1
Earlier I found out the I needed to get the gsl library and I used mac ports and typed:
sudo port install gsl
into my command line window and it seemed to isntall okay. Is the missing lgsl not configured correctly or does it not come with gsl? I tried googling lgsl but didn't get much. I've only been at programming a few days and I don't know if I was supposed to set a path, or even really how to do that.
Thanks for any help you guys could offer.
I just wanted to say that I had the exact problem on OSX. Rather than setting an environment variable, I used an additional compiler flag -L/opt/local/lib, which then lets one use -lgsl. I reference this answer.
I got the same issue and here is how I fixed it:
export LIBRARY_PATH=/usr/local/Cellar/gsl/1.16/lib/
I had previously installed gsl using:
brew install gsl
You need to add the path for where the macports installed the gsl library to your LD_LIBRARY_PATH environment variable (or most likely into the build script environment). I believe macports stores things in /opt/local/lib

configure: error: leptonica library missing (when building tesseract-ocr-3.01 on MinGW)

When running configure it fails with
checking for leptonica... yes
checking for pixCreate in -llept... no
configure: error: leptonica library missing
But I have leptonica 1.69 built (downloaded source and ran ./configure && make install)
Edit
I think configure: error: leptonica library missing is a bit misleading, please note that it first says checking for leptonica... yes, and then fails on checking for pixCreate in -llept... no. So maybe the problem is not that the library is missing, but something else.
I finally managed to make it compile, after reading this and this thread. The proper steps for were:
./autogen.sh
export LIBLEPT_HEADERSDIR=/local/include
./configure --with-extra-libraries=/local/lib
make install
for leptonica 1.69, lib renamed to .libs, so, parameters are
export LIBLEPT_HEADERSDIR=<your_path>/leptonica-1.69/src
./autogen.sh
./configure --prefix= --with-extra-libraries=<your_path>/leptonica-1.69/src/.libs
and so on
Maybe this could solve the issue:
export LIBLEPT_HEADERSDIR=/usr-or-other/local/include
I am working on redhat linux 7.2 . None of the solution worked for me I was getting following errors in config.log. Package lept was not found in the pkg-config search path.
Perhaps you should add the directory containing `lept.pc'
to the PKG_CONFIG_PATH environment variable PKG_CONFIG_PATH
configure script uses pkg-config utility to check for packages . It was not able to find lept package ( although i had installed leptonica seperately ) By setting PKG_CONFIG_PATH pointing to the directory where lept.pc is present , i was able to resolve the issue . export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
The FAQ addresses this issue and worked for me with tesseract 3.02.02 on Mac OSX 10.6.8.
Apart from the Leptonica library, png, jpeg, tiff libraries had to passed to the configure script with CXX and CPP flags.
To run configure as non-root -
1. LIBLEPT_HEADERSDIR=; export LIBLEPT_HEADERSDIR;
2. CXXFLAGS="-ltiff -lpng -ljpeg" CPPFLAGS="-ltiff -lpng -ljpeg" ./configure --prefix= --with-extra-libraries=
In my case, this issue was caused by a missing compiler. Searching config.log revealed the following:
./configure:17287: g++ -o conftest -I/Usr/local/include/leptonica -L/usr/local/lib conftest.cpp -llept >&5
./configure: line 2040: g++ command not found
Running apt-get install g++ solved the problem. There is an issue in the tesseract issue tracker about this.
In my case (for Ubuntu/Debian) I downloaded the latest leptonica version and the error was not fixed.
To fix it I removed the package "leptonica-dev" with sudo apt-get remove libleptonica-dev and then tesseract found the leptonica version installed from the source code.
Hope it helps!
The answer is going to be slightly different for everyone, depending on the state of your system.
At a high level, the pkg-config software needs to know that leptonica is installed. It searches paths for a .pc file that has the definition for the leptonica package. That file will be in different locations for different people.
You can find it using the Linux locate utility at the command line. locate lept.pc. (If you've done some recent installing/uninstalling, you may need to refresh the locate utilities database with the command updatedb.)
Whichever directory locate finds the file in, export PKG_CONFIG_PATH as that directory (export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig for example).
Then you can continue your configure/build.
i had a similar problem with trying to compile from source, but did not experience it with
apt-get to install tesseract
sudo apt-get install tesseract-ocr
export LIBLEPT_HEADERSDIR=$dir/letonica168/include
./autogen.sh
./configure --prefix=$anotherdir --with-extra-libraries=/$dir/letonica168/lib
make
make install

Resources