unable to build magick for golang - go

I am following this document for building the Go Imagick library.
When i ran the following command
go build -tags no_pkgconfig imagick
It throws the following exception :
# imagick
src/imagick/affine_matrix.go:8:29: fatal error: wand/MagickWand.h: No such file or directory
compilation terminated
Now to resolve that i have also installed the following packages as many people suggested to resolve the error. But it didn't work either.
sudo apt-get install libmagickwand-dev libmagickcore-dev imagemagick
Moreover, when i run go build imagick
It throws the following error :
# imagick
could not determine kind of name for C.FlattenAlphaChannel
could not determine kind of name for C.RemoveAlphaChannel
Output of pkg-config --cflags --libs MagickWand gives the correct output
-fopenmp -I/usr/include/ImageMagick -lMagickWand -lMagickCore
ImageMagick is installed to this path(/usr/include/ImageMagick) only.

Their docs mention that no_pkgconfig must be used with manually set GCO_CFLAGS and CGO_LDFLAGS. So something like this should work:
export CGO_CFLAGS="$(pkg-config --cflags MagickWand)"
export CGO_LDFLAGS="$(pkg-config --libs MagickWand)"
go build -tags no_pkgconfig

As mentioned on #68 of the issue tracker, you are using way too old of a version of ImageMagick, which predates the versions that were tested for the master branch. Your Linux distro is older than the current available stable release.
You should manually install a newer ImageMagick, and remove the, one from apt. Or use some solution that allows you to manage multiple versions.

Related

Why does this VLC Media Player Build Fail?

When building VLC on Ubuntu 18 using the following configure invocation:
First I obtain the source like so:
% git clone git://git.videolan.org/vlc.git
% cd vlc
% ./bootstrap
Then I build like so:
make clean
./configure --disable-lua --disable-swscale --disable-alsa --disable-chromecast --disable-fontconfig
The build fails like so:
codec/jpeg.c: In function ‘DecodeBlock’:
codec/jpeg.c:501:16: warning: variable ‘p_row_pointers’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
JSAMPARRAY p_row_pointers = NULL;
^~~~~~~~~~~~~~
CCLD libjpeg_plugin.la
CC codec/libsdl_image_plugin_la-sdl_image.lo
CCLD libsdl_image_plugin.la
CC codec/libxwd_plugin_la-xwd.lo
CCLD libxwd_plugin.la
CC codec/liblibass_plugin_la-libass.lo
CCLD liblibass_plugin.la
/usr/bin/ld: /root/vlc-3.0.4/contrib/x86_64-linux-gnu/lib/libfontconfig.a(fcxml.o): in function `FcConfigMessage':
/root/vlc-3.0.4/contrib/native/fontconfig/src/fcxml.c:573: undefined reference to `xmlSAX2GetLineNumber'
/usr/bin/ld: /root/vlc-3.0.4/contrib/native/fontconfig/src/fcxml.c:576: undefined reference to `xmlSAX2GetLineNumber'
/usr/bin/ld: /root/vlc-3.0.4/contrib/x86_64-linux-gnu/lib/libfontconfig.a(fcxml.o): in function `IA__FcConfigParseAndLoad':
/root/vlc-3.0.4/contrib/native/fontconfig/src/fcxml.c:3309: undefined reference to `xmlCreatePushParserCtxt'
/usr/bin/ld: /root/vlc-3.0.4/contrib/native/fontconfig/src/fcxml.c:3348: undefined reference to `xmlParseChunk'
/usr/bin/ld: /root/vlc-3.0.4/contrib/native/fontconfig/src/fcxml.c:3362: undefined reference to `xmlFreeParserCtxt'
/usr/bin/ld: /root/vlc-3.0.4/contrib/native/fontconfig/src/fcxml.c:3354: undefined reference to `xmlCtxtGetLastError'
Any ideas what I did wrong here? It seems like the module in question should fail to build in this case as I disabled fontconfig.
Libfontconfig is in fact installed:
root#fuzzbot:~/vlc-3.0.4# apt-get install libfontconfig
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libfontconfig1' instead of 'libfontconfig'
libfontconfig1 is already the newest version (2.13.0-5ubuntu3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root#fuzzbot:~/vlc-3.0.4#
Additional ideas:
I tried in vain to find VLC's official bug tracker for this kind of thing. I found bug trackers for literally every subproject of VLC but the main project that I am trying to build. If anyone knows the proper channels to ask the VLC people about this, let me know.
Additionally if the admins feel that this question better fits on serverfault, or AskUbuntu, feel free to move it. As far as I can tell this is a little too automake specific to be serverfault's bag, and I don't think the issue is unique to Ubuntu, as the official VLC wiki specifies no specific instructions for Ubuntu.
I don't really need all the plugins for my use case. If doing any further --disables in my configure invocation will help, I'm willing to try it.
The errors indicates a problem with linking against "some" xml-library.
most likely libxml2, which you probably have not installed.
./configure is supposed to detect any missing library and prevent your build from failing, but there might be a bug in the configure script itself.
Anyhow, since you are on a Debian-based distribution, you could simply install all the packages that are required to build the official Debian (or Ubuntu) package. (Your personal build might have additional dependencies or lack some of the dependencies of the official package, but it is usually a good starting point).
apt-get build-dep vlc
If you are getting an error like E: You must put some 'source' URIs in your sources.list then you should add deb-src entries to your apt sources-list, e.g. using
find /etc/apt/sources.list /etc/apt/sources.list.d/ \
-type f -name "*.list" -not -name debsrc.list \
-exec echo sed -e 's|^deb |deb-src |' {} + > /etc/apt/sources.list.d/debsrc.list
I followed your post on vlc forum to this SO post.
As people there suggested the libass is the problem, thus I added the option to disable it. Now the configuration command looks like:
./configure --disable-libass \
--disable-lua --disable-swscale --disable-alsa --disable-chromecast --disable-fontconfig
The compilation proceeded without the previous fontconfig error. However it hits a different error:
....upnp....: undefined reference to `pthread_rwlock_wrlock'
A google search turned up another vlc forum thread. People suggesting turning off upnp. Configured it again by adding:
--disable-upnp
Then hit another error:
/libavcodec.a(fft.o): relocation R_X86_64_PC32 against symbol `ff_cos_32' can not be used when making a shared object; recompile with -fPIC
Another google search suggests to turn off chromaprint, adding yet another option:
--disable-chromaprint
Eventually it finishes with a success!
Before running the long configure command at the beginning of this post, I also tried building 3.0.7.1 but hit a problem with missing a liveMedia.hh file. In case anybody else is doing the same, here is the list of packages installed though not all of them are required since disabled a few features on the configure command line:
apt-get install git build-essential pkg-config libtool automake autopoint gettext
apt-get install subversion yasm cvs cmake ragel
apt-get install gperf
apt-get install openjdk-8-jre-headless openjdk-8-jdk-headless
apt-get install ant
apt-get install python3-pip
pip3 install meson
apt-get install nasm
apt-get install protobuf-c-compiler
apt-get install protobuf-compiler
apt-get install libpthread-stubs0-dev
apt-get install libasound2-dev liblivemedia-dev livemedia-utils
Summary
Use the videolan unix compile wiki page as a guide for steps below.
Install supporting packages as the list above shows.
Run cd contrib && mkdir native && cd native && ../bootstrap && make to build libraries.
Run the very long configure command:
./configure --disable-libass \
--disable-lua --disable-swscale --disable-alsa --disable-chromecast --disable-fontconfig \
--disable-upnp --disable-chromaprint
Run make.

Building Valama IDE on Windows using MSYS2 and MingW

I am using MSYS2 to build Valama [the next generation IDE for Vala].
what the GitHub repository says that some dependencies are required.
and they are provided for Ubuntu using this command
sudo apt-get install build-essential valac-0.24 libvala-0.24-dev cmake pkg-config libgtksourceview-3.0-dev libgee-0.8-dev libxml2-dev libgdl-3-dev libgladeui-dev libclutter-gtk-1.0-dev libwebkit2gtk-3.0-dev intltool gnome-icon-theme-symbolic librsvg2-bin
and I started to download these dependencies using
pacman -S [PACKAGE NAME]
but these packages names are not the same in pacman for mingw as they are in apt-get for ubuntu
so I found that pacman supports searching for packages using this command
pacman -sS [PACKAGE NAME substring]
so after every successful installation I tested cmake .. command as in the GitHub repository
until I get stuck with this dependency
gladeui-2.0
and this what the log of cmake look like :
-- Checking for module 'gee-0.8 >= 0.10.5'
-- Found gee-0.8 , version 0.18.1
-- Update files for GtkSourceView 3.14.3
-- Use enhanced gdl-3.0 vapi to support new features with gdl-3.0 >= 3.9.91.
-- Checking for module 'gladeui-2.0'
-- No package 'gladeui-2.0' found
CMake Error at /usr/share/cmake-3.6.2/Modules/FindPkgConfig.cmake:424 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.6.2/Modules/FindPkgConfig.cmake:597 (_pkg_check_modules_internal)
CMakeLists.txt:201 (pkg_check_modules)
-- Configuring incomplete, errors occurred!
See also "/e/valama/build/CMakeFiles/CMakeOutput.log".
See also "/e/valama/build/CMakeFiles/CMakeError.log".
as you can see from the log that [gladeui-2.0] is not found on the MSYS-mingw subsystem, and I failed to find the supported library for it.
what I am asking is what is the command to install the remaining dependencies of valama, or how to build them and install them, including gladeui-2.0.
On the MSYS2 home page there are two GitHub repositories listed for issues with packages. The first is issues for msys2 packages on GitHub and the second is issues for mingw-w64 packages on GitHub. Both of these repositories list packages as sub-directories.
The most interesting are the mingw-w64 packages, which includes mingw-w64-glade and mingw-w64-glade3. So you could try installing either of those. Glade3 is the newer version, but Valarama may be dependent on the older Glade 2.

Installing Cairo on Mac - Could not find libpng in the pkg-config search path

checking whether cairo's PNG functions feature could be enabled... no
I have been following the setup for configuring node canvas. Cairo is needed but i am having issues trying to set it up. https://github.com/Automattic/node-canvas/wiki/Installation---OSX
If libpng fails and you get the error "error: recommended PNG functions feature could not be enabled", try installing this binary and re-running the configure step.
I followed above by installing the binaries on Mac OS 9 and run the configuration command and still no luck. I am running the install shell script in node-canvas repository:
https://github.com/Automattic/node-canvas/blob/master/install
In my /usr/local/lib I currently have:
dtrace libjpeg.8.dylib libpng.a libpng14.a
libfreetype.6.dylib libjpeg.a libpng.dylib libpng14.dylib
libfreetype.a libjpeg.dylib libpng.la libpng14.la
libfreetype.dylib libjpeg.la libpng12.0.dylib libpng15.15.dylib
libfreetype.la libpixman-1.0.dylib libpng12.0.dylib.dSYM libpng15.15.dylib.dSYM
libgif.4.1.6.dylib libpixman-1.a libpng12.a libpng15.a
libgif.4.dylib libpixman-1.dylib libpng12.dylib libpng15.dylib
libgif.a libpixman-1.la libpng12.la libpng15.la
libgif.dylib libpng.3.dylib libpng14.14.dylib node_modules
libgif.la libpng.3.dylib.dSYM libpng14.14.dylib.dSYM pkgconfig
Libpng-1.6.10 has been replaced by libpng-1.6.12.
In your install script, change
LIBPNG="http://downloads.sourceforge.net/project/libpng/libpng16/1.6.10/libpng-1.6.10.tar.gz"
to
LIBPNG="http://downloads.sourceforge.net/project/libpng/libpng16/1.6.12/libpng-1.6.12.tar.gz"
I have a set of detailed instructions for building cairo here:
https://github.com/soegaard/racket-osx-libs
There resulting libraries are here:
https://github.com/soegaard/racket-osx-libs/tree/master/lib

Can not configure Mapnik due to icuuc

Trying to compile Mapnik on OSX 10.8
So after I clone the Github repo, I go to run the configure command like so:
./configure and then get the error:
Checking for C++ library icuuc... no
Could not find required header or shared library for icuuc
and later:
Exiting... the following required dependencies were not found:
- icuuc (ICU C++ library | configure with ICU_LIBS & ICU_INCLUDES or use ICU_LIB_NAME to specify custom lib name | more info: http://site.icu-project.org/)
Looking at the Mapnik troubleshooting area for a solution: https://github.com/mapnik/mapnik/wiki/InstallationTroubleshooting
Says: Solution: If g++ is available then ICU must be in a custom location so set the paths to the libs and includes - ie. ICU_LIBS=/usr/local/lib and ICU_INCLUDES=/usr/local/include.
By running g++ from command line I get: i686-apple-darwin11-llvm-g++-4.2: no input files
So this means that g++ is available, but I have no idea how to go about setting the paths so that configure can find them.
ICU Libraries were installed by default or with homebrew, not sure which.
terminal: brew install icu4c
Warning: icu4c-51.1 already installed
Finding the icu4c install directory:
terminal: mdfind icu4c
/usr/local/Cellar/icu4c
You can add the path of your ICU_LIB/INCLUDE to your configure command:
./configure ICU_INCLUDES=/usr/local/Cellar/icu4c/include ICU_LIBS=/usr/local/Cellar/icu4c/lib
And for more help about configure on what options are accepted do:
./configure --help
For the installation reference, you can check this:
https://github.com/mapnik/mapnik/blob/v2.2.0/INSTALL.md
As per our discussion and my last comment something like the following might work.
export ICU_LIBS=/usr/local/Cellar/icu4c/lib
export ICU_INCLUDES=/usr/local/Cellar/icu4c/include
./configure
If you find same errors:
Checking for C++ library XXX... no
Follow the command
sudo apt-get install g++ libXXX-dev
Using tips (TAB button), you can see what XXX libraries you have available
sudo apt-get install libXXX(press double TAB)

GTK+ installed with brew is not found when I try to compile other applications

I installed GTK with brew install gtk+ as I need it to compile xchat from source on my Mac. When I try to install it tough, it says Cannot find GTK! Not building GTK FrontEnd.
I suspect I should've updated the environment variables once installed gtk+ but I don't know how.
iMac:xchat-2.8.8 Domenico$ brew info gtk+
gtk+: stable 2.24.20
http://gtk.org/
/usr/local/Cellar/gtk+/2.24.20 (1184 files, 52M) * // here is the path!!!
Built from source
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/gtk+.rb
==> Dependencies
Build: pkg-config, xz
Required: glib, jpeg, libtiff, gdk-pixbuf, pango, atk, cairo
Optional: jasper
==> Options
--with-jasper
Build with jasper support
The path is listed in the code above. I tried adding all kind of things related to it (e.g. /usr/local/Cellar/gtk+/2.24.20/bin or /usr/local/Cellar) to $LD_LIBRARY_PATH but it didn't work. Any ideas?
I had smiliar issues with after brew install gtk+. Specifically, I got:
Package xcb-shm was not found in the pkg-config search path.
Perhaps you should add the directory containing `xcb-shm.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xcb-shm', required by 'cairo', not found
app.c:1:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
^
1 error generated.
make: *** [app] Error 1
while running make for my app and this command solved my problem:
export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig
The extended answer on this problem has been already answered here: https://stackoverflow.com/a/23988317/4694621.
This might be an issue since gtk+ depends on these libraries (source):
Glib
Pango
ATK
GDK
GdkPixbuf
Cairo

Resources