How to solve ./configure missing package - build

I would like to build Inkscape. I already solved some missing packages but the journey is not finished yet...
This time it's bdw-gc that is missing:
checking for IMAGEMAGICK... no
checking for INKSCAPE... no
configure: error: Package requirements (bdw-gc >= 7.1
cairo >= 1.10
cairomm-1.0 >= 1.9.8
glib-2.0 >= 2.28
glibmm-2.4 >= 2.28
giomm-2.4
gsl
gthread-2.0 >= 2.0
libpng >= 1.2
libxml-2.0 >= 2.6.11
libxslt >= 1.0.15
pango >= 1.24
pangoft2 >= 1.24
sigc++-2.0 >= 2.0.12
) were not met:
No package 'bdw-gc' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
So I downloaded bdwgc-master solve some issues then installed it:
$ make install
make[1]: Entering directory '/usr/src/bdwgc-master'
make[2]: Entering directory '/usr/src/bdwgc-master'
/usr/bin/mkdir -p '/usr/local/lib'
/bin/sh ./libtool --mode=install /usr/bin/install -c libgc.la libcord.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libgc.dll.a /usr/local/lib/libgc.dll.a
libtool: install: base_file=`basename libgc.la`
libtool: install: dlpath=`/bin/sh 2>&1 -c '. .libs/'libgc.la'i; echo cyggc-1.dll'`
libtool: install: dldir=/usr/local/lib/`dirname ../bin/cyggc-1.dll`
libtool: install: test -d /usr/local/lib/../bin || mkdir -p /usr/local/lib/../bin
libtool: install: /usr/bin/install -c .libs/cyggc-1.dll /usr/local/lib/../bin/cyggc-1.dll
libtool: install: chmod a+x /usr/local/lib/../bin/cyggc-1.dll
libtool: install: if test -n '' && test -n 'strip --strip-unneeded'; then eval 'strip --strip-unneeded /usr/local/lib/../bin/cyggc-1.dll' || exit 0; fi
libtool: install: /usr/bin/install -c .libs/libgc.lai /usr/local/lib/libgc.la
libtool: install: /usr/bin/install -c .libs/libcord.dll.a /usr/local/lib/libcord.dll.a
libtool: install: base_file=`basename libcord.la`
libtool: install: dlpath=`/bin/sh 2>&1 -c '. .libs/'libcord.la'i; echo cygcord-1.dll'`
libtool: install: dldir=/usr/local/lib/`dirname ../bin/cygcord-1.dll`
libtool: install: test -d /usr/local/lib/../bin || mkdir -p /usr/local/lib/../bin
libtool: install: /usr/bin/install -c .libs/cygcord-1.dll /usr/local/lib/../bin/cygcord-1.dll
libtool: install: chmod a+x /usr/local/lib/../bin/cygcord-1.dll
libtool: install: if test -n '' && test -n 'strip --strip-unneeded'; then eval 'strip --strip-unneeded /usr/local/lib/../bin/cygcord-1.dll' || exit 0; fi
libtool: install: /usr/bin/install -c .libs/libcord.lai /usr/local/lib/libcord.la
libtool: install: /usr/bin/install -c .libs/libgc.a /usr/local/lib/libgc.a
libtool: install: chmod 644 /usr/local/lib/libgc.a
libtool: install: ranlib /usr/local/lib/libgc.a
libtool: install: /usr/bin/install -c .libs/libcord.a /usr/local/lib/libcord.a
libtool: install: chmod 644 /usr/local/lib/libcord.a
libtool: install: ranlib /usr/local/lib/libcord.a
/usr/bin/mkdir -p '/usr/local/share/gc'
/usr/bin/install -c -m 644 AUTHORS README.md doc/README.DGUX386 doc/README.Mac doc/README.OS2 doc/README.amiga doc/README.arm.cross doc/README.autoconf doc/README.cmake doc/README.cords doc/README.darwin doc/README.environment doc/README.ews4800 doc/README.hp doc/README.linux doc/README.macros doc/README.rs6000 doc/README.sgi doc/README.solaris2 doc/README.symbian doc/README.uts doc/README.win32 doc/README.win64 doc/debugging.html doc/finalization.html doc/gc.man doc/gcdescr.html doc/gcinterface.html doc/leak.html doc/overview.html doc/porting.html doc/scale.html doc/simple_example.html doc/tree.html '/usr/local/share/gc'
/usr/bin/mkdir -p '/usr/local/include'
/usr/bin/install -c -m 644 include/extra/gc.h '/usr/local/include'
/usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
/usr/bin/install -c -m 644 bdw-gc.pc '/usr/local/lib/pkgconfig'
/usr/bin/mkdir -p '/usr/local/include/gc'
/usr/bin/install -c -m 644 include/gc.h include/gc_allocator.h include/gc_backptr.h include/gc_config_macros.h include/gc_disclaim.h include/gc_gcj.h include/gc_inline.h include/gc_mark.h include/gc_pthread_redirects.h include/gc_tiny_fl.h include/gc_typed.h include/gc_version.h include/javaxfc.h include/leak_detector.h include/weakpointer.h include/cord.h include/cord_pos.h include/ec.h '/usr/local/include/gc'
make[2]: Leaving directory '/usr/src/bdwgc-master'
make[1]: Leaving directory '/usr/src/bdwgc-master'
So I have bdw-gc installed in my system, but I still get the error. This kind of problem happen to me very often. I would like to lean how to solve them or at least how to investigate.
I noticed bwdgc was installed on /usr/local/. I also checked that the inkscape ./configure has the right prefix:
$ ./configure --help | grep usr
[/usr/local]
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
--oldincludedir=DIR C header files for non-gcc [/usr/include]
So I am a bit lost with this. What's the next step?

You may need to install gc library:
http://www.hboehm.info/gc/gc_source/

Related

Cross-compile GCC for x86_64-w64-mingw32 target

I would like to cross-compile GCC 6.3.0 for x86_64-w64-mingw32 target on Ubuntu 16.04.
I'm following the below steps:
Get the source files:
$ wget "http://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v5.0.1.tar.bz2"
$ wget "https://ftpmirror.gnu.org/binutils/binutils-2.27.tar.gz"
$ wget "https://ftpmirror.gnu.org/gcc/gcc-6.3.0/gcc-6.3.0.tar.bz2"
Compile binutils-2.27 with:
$ ./configure --target=x86_64-w64-mingw32 --enable-targets=x86_64-w64-mingw32 --prefix=/home/user/gcc_mingw64/build --with-sysroot=/home/user/gcc_mingw64/build
$ make
$ make install
Compile mingw-w64-v5:
$ mkdir build-headers
$ cd build-headers/
$ ../mingw-w64-headers/configure --host=x86_64-w64-mingw32 --prefix=/home/user/gcc_mingw64/build/x86_64-w64-mingw32
$ make
$ make install
Create soft link to lib:
$ ln -s /home/user/gcc_mingw64/build/x86_64-w64-mingw32 mingw
$ ln -s /home/user/gcc_mingw64/build/x86_64-w64-mingw32/lib lib64
Compile gcc-6.3.0:
$ ./contrib/download_prerequisites
$ mkdir build_gcc
$ cd build_gcc
$ ../configure --target=x86_64-w64-mingw32 --enable-targets=all --disable-werror --disable-shared --enable-version-specific-runtime-libs --with-ld=/home/user/gcc_mingw64/build/bin/x86_64-w64-mingw32-ld --with-as=/home/user/gcc_mingw64/build/bin/x86_64-w64-mingw32-as --enable-languages=c,c++,fortran --prefix=/home/user/gcc_mingw64/build --with-sysroot=/home/user/gcc_mingw64/build
$ make
$ make install
The gcc compilation throw the following error:
checking for ld that supports -Wl,--gc-sections... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
Makefile:11457: recipe for target 'configure-target-libstdc++-v3' failed
make[1]: *** [configure-target-libstdc++-v3] Error 1
Any clue on how to fix this issue?

llvm-link: error : expected top-level entity

I'm trying to compile the libpng 1.2.56 file and use a target.cc(same as fuzzer-test-suite to unite all these file in libpng1.2.56 into one LLVM IR bitcode file, named combined.bc.
Here is my compile process, refering build.sh:
[ ! -e libpng-1.2.56.tar.gz ] && wget https://downloads.sourceforge.net/project/libpng/libpng12/older-releases/1.2.56/libpng-1.2.56.tar.gz
[ ! -e libpng-1.2.56 ] && tar xf libpng-1.2.56.tar.gz
build_lib() {
rm -rf BUILD
cp -rf libpng-1.2.56 BUILD
(cd BUILD && ./configure --disable-shared && make -j $JOBS )
}
build_lib || exit 1
mkdir bitcode
clang++-10 -g -flto -std=c++11 ./target.cc -c -o bitcode/target.o -I .
cd bitcode
ar x ../.libs/libpng12.a
llvm-link-10 *.o -o combined.bc
And error is
enter image description here
The bitcode folder:
enter image description here
For modifications like the above, I succeeded on the project json, but not on libpng.
I am a beginner in LLVM and would like to get answers from you all. Thanks a lot!

Trouble building GLEW on Windows using MinGW

I'm trying to build GLEW 2.1.0 on Windows (8.1) using MinGW and have been struggling for a while now.
I tried to follow the instructions for "MSYS/Mingw" on the GLEW GitHub page but when running mingw32-make, I only got a couple errors about missing commands (test and config) as well as the following: Makefile:40: *** "Platform '' not supported". Stop.
Under "Requirements" it says that bash is needed, so I installed git, because that apparently comes with a version of bash. Running mingw32-make (in the directory that all the GLEW files and folders are in) using Git Bash results in a long list of warnings and "undefined reference"s. The latter come from the linker as far as I know, but I have no idea what could cause them. As it's so much text, I'll only include the last few lines here:
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: tmp/mingw/default/shared/glewinfo.o:glewinfo.c:(.text.startup+0x181b): undefined reference to `_imp___iob'
collect2.exe: error: ld returned 1 exit status
Makefile:181: recipe for target 'bin/glewinfo.exe' failed
mingw32-make: *** [bin/glewinfo.exe] Error 1
mingw32-make install has the following output:
$ mingw32-make install
install -d -m 0755 "/usr/include/GL"
install -m 0644 include/GL/wglew.h "/usr/include/GL/"
install -m 0644 include/GL/glew.h "/usr/include/GL/"
install -m 0644 include/GL/glxew.h "/usr/include/GL/"
sed \
-e "s|#prefix#|/usr|g" \
-e "s|#libdir#|/usr/lib|g" \
-e "s|#exec_prefix#|/usr/bin|g" \
-e "s|#includedir#|/usr/include/GL|g" \
-e "s|#version#|2.1.0|g" \
-e "s|#cflags#||g" \
-e "s|#libname#|glew32|g" \
-e "s|#requireslib#|glu|g" \
< glew.pc.in > glew.pc
install -d -m 0755 "/usr/lib"
install -d -m 0755 "/usr/bin"
install -m 0755 lib/glew32.dll "/usr/bin/"
install -m 0644 lib/libglew32.dll.a "/usr/lib/"
install -m 0644 lib/libglew32.a "/usr/lib/"
install -d -m 0755 "/usr/lib/pkgconfig"
install -d -m 0755 "/usr/lib/pkgconfig"
install -m 0644 glew.pc "/usr/lib/pkgconfig/"
And mingw32-make install.all produces another long list of undefined references and the same error that came from running mingw32-make. The first lines however are (about) the same as the result of running mingw32-make install.
As expected with all of the errors, running these commands didn't produce a binary file. I guess it could have something to do with me not having make, which is one of the requirements listed on the GitHub page. However I don't understand how I should install make on Windows and why it is even needed when the instructions say to use mingw32-make.
I've also tried some of the suggestions made in this thread, but that doesn't seem to have worked either.
What could be the problem and what can I do to successfully compile GLEW?
I could never build it with the instructions I found around the internet, so here's how I build glew (using https://downloads.sourceforge.net/project/glew/glew/2.2.0/glew-2.2.0.tgz) under MSYS2 with MinGW-w64:
# change the line below to your desired install path
INSTALLPREFIX=/usr/local
VERSION=2.2.0
gcc -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.o -c src/glew.c &&
gcc -fno-builtin -fno-stack-protector -shared -s -Wl,-soname,libglew32.dll -Wl,--out-implib,lib/libglew32.dll.a -o lib/glew32.dll src/glew.o -Wl,--as-needed -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 -nostdlib &&
ar cr lib/libglew32.a src/glew.o &&
gcc -DGLEW_MX -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.mx.o -c src/glew.c &&
gcc -fno-builtin -fno-stack-protector -shared -s -Wl,-soname,libglew32mx.dll -Wl,--out-implib,lib/libglew32mx.dll.a -o lib/glew32mx.dll src/glew.mx.o -Wl,--as-needed -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 -nostdlib &&
ar cr lib/libglew32mx.a src/glew.mx.o &&
gcc -O2 -c -Iinclude -o src/glewinfo.o src/glewinfo.c &&
gcc -s -o src/glewinfo.exe src/glewinfo.o lib/libglew32.dll.a -Wl,--as-needed -lgdi32 -lopengl32 &&
gcc -O2 -c -Iinclude -o src/visualinfo.o src/visualinfo.c &&
gcc -s -o src/visualinfo.exe src/visualinfo.o lib/libglew32.dll.a -Wl,--as-needed -lgdi32 -lopengl32 -lglu32 &&
sed -e "s?#prefix#?$INSTALLPREFIX?; s?#libdir#?\$\{prefix\}/lib?; s?#version#?$VERSION?; s?#requireslib#?glu?; s?#cflags#??; s?#libname#?glew32?" glew.pc.in > glew.pc &&
sed -e "s?#prefix#?$INSTALLPREFIX?; s?#libdir#?\$\{prefix\}/lib?; s?#version#?$VERSION?; s?#requireslib#?glu?; s?#cflags#?-DGLEW_MX?; s?#libname#?glew32mx?" glew.pc.in > glewmx.pc &&
echo Installing... &&
mkdir -p $INSTALLPREFIX/include $INSTALLPREFIX/lib/pkgconfig $INSTALLPREFIX/bin $INSTALLPREFIX/cmake &&
cp -rf include/GL $INSTALLPREFIX/include/ &&
cp -f lib/*.a $INSTALLPREFIX/lib/ &&
cp -f *.pc $INSTALLPREFIX/lib/pkgconfig/ &&
cp -f lib/*.dll src/*.exe $INSTALLPREFIX/bin/ &&
cp -f build/cmake/*.cmake $INSTALLPREFIX/cmake/ &&
echo Success

link static library with shared library problem

I'm new to Linux, so sorry if this my question is really stupid.
I have shared cross-platform library project, which uses third party static library (Libtorrent).
Windows/Android/macOS - builds and works fine.
But I can't figure out how to build it in Linux (Ubuntu) with GCC.
I'm getting the following linker errors:
/usr/bin/ld: /home/user/Desktop/project/libtorrent-build/prebuilt/linux/lib/libtorrent-rasterbar.a(create_torrent.o): relocation R_X86_64_TPOFF32 against symbol `_ZN5boost4asio6detail15keyword_tss_ptrINS1_10call_stackINS1_15task_io_serviceENS1_27task_io_service_thread_infoEE7contextEE6value_E' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /home/user/Desktop/project/libtorrent-build/prebuilt/linux/lib/libtorrent-rasterbar.a(disk_io_thread.o): relocation R_X86_64_TPOFF32 against symbol `_ZN5boost4asio6detail15keyword_tss_ptrINS1_10call_stackINS1_15task_io_serviceENS1_27task_io_service_thread_infoEE7contextEE6value_E' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /home/user/Desktop/project/libtorrent-build/prebuilt/linux/lib/libtorrent-rasterbar.a(peer_connection.o): relocation R_X86_64_TPOFF32 against symbol `_ZN5boost4asio6detail15keyword_tss_ptrINS1_10call_stackINS1_15task_io_serviceENS1_27task_io_service_thread_infoEE7contextEE6value_E' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /home/user/Desktop/project/libtorrent-build/prebuilt/linux/lib/libtorrent-rasterbar.a(session.o): relocation R_X86_64_TPOFF32 against symbol `_ZN5boost4asio6detail15keyword_tss_ptrINS1_10call_stackINS1_15task_io_serviceENS1_27task_io_service_thread_infoEE7contextEE6value_E' can not be used when making a shared object; recompile with -fPIC
I've tried rebuilding Boost and Libtorrent with -fPIC flag: nothing is changed.
Boost build script:
#!/bin/bash
set -e
BOOST_VERSION=1.63.0
BOOST_VERSION_UNDERSCORES=${BOOST_VERSION//./_}
echo "Boost version $BOOST_VERSION"
echo "Downloading..."
BOOST_ARCH_NAME=boost_${BOOST_VERSION_UNDERSCORES}.tar.gz
curl -O -L https://dl.bintray.com/boostorg/release/$BOOST_VERSION/source/$BOOST_ARCH_NAME
echo "Extracting..."
tar -xvzf $BOOST_ARCH_NAME
BOOST_FOLDER_NAME=boost_${BOOST_VERSION_UNDERSCORES}
cd $BOOST_FOLDER_NAME
chmod +x bootstrap.sh
./bootstrap.sh
chmod +x b2
./b2 headers
./b2 \
--layout=versioned \
--with-thread \
--with-date_time \
--with-filesystem \
--with-chrono \
--with-random \
toolset=gcc \
threading=multi \
link=static \
runtime-link=shared \
variant=release \
threadapi=pthread \
debug-symbols=off \
warnings=off \
warnings-as-errors=off \
architecture=x86 \
address-model=64 \
--stagedir=stage/linux \
cxxflags="-std=gnu++0x -fPIC" \
stage
echo "Copying prebuilt..."
mkdir -p ../prebuilt/linux/lib
cp -rf ./stage/linux/lib ../prebuilt/linux/
cd ../
echo "Cleaning up..."
rm $BOOST_ARCH_NAME
rm -rf $BOOST_FOLDER_NAME
echo "Done."
Libtorrent build script:
#!/bin/sh
set -e
MY_PWD=$PWD
LIBTORRENT_VERSION=1_1_8
LIBTORRENT_NAME=libtorrent-$LIBTORRENT_VERSION
export LIBTORRENT_FOLDER_NAME=libtorrent-$LIBTORRENT_NAME
curl -O -L "https://github.com/arvidn/libtorrent/archive/${LIBTORRENT_NAME}.tar.gz"
echo "Extracting..."
rm -rf ./$LIBTORRENT_FOLDER_NAME
tar xfz "${LIBTORRENT_NAME}.tar.gz"
echo "Building for linux..."
cd $LIBTORRENT_FOLDER_NAME
. ./autotool.sh
mkdir -p lib
if [ ! -d "./include/boost" ]; then
ln -s $PWD/../../boost-build/prebuilt/include/boost $PWD/include/boost
ln -s $PWD/../../boost-build/prebuilt/linux/lib/* $PWD/lib/
fi
if [ ! -d "./include/openssl" ]; then
ln -s $PWD/../../openssl-build/prebuilt/include/openssl $PWD/include/openssl
ln -s $PWD/../../openssl-build/prebuilt/linux/lib/* $PWD/lib/
fi
export CXX=g++
export CC=gcc
export CXXFLAGS="-std=gnu++0x -fPIC -fPIE"
export CPPFLAGS="-I"$PWD"/include"
./configure --enable-debug=no --with-boost-python=no --enable-logging=no \
--enable-tests=no --with-openssl=$PWD \
--with-boost=$PWD \
--enable-shared=no \
--enable-encryption
make -j4
mkdir -p ../prebuilt/linux/lib
cp -rf ./src/.libs/libtorrent-rasterbar.a ../prebuilt/linux/lib/
cd $MY_PWD
echo "cleaning up"
rm -rf $LIBTORRENT_FOLDER_NAME
rm -rf ${LIBTORRENT_NAME}.tar.gz
echo "done"
My shared lib itself is a Qt-based library. I build it using Qt Creator, providing all the required headers and libs in .pro file.
The problem was in Libtorrent build script. I removed -fPIE option and added
export CFLAGS="-fPIC"
Rebuilt and now it links without errors.

How to properly use make with parallel builds?

I am having problems with parallel builds in make, namely having this definition
rmlink:
$(RM) $(ALIB)
$(RM) $(BLIB)
$(RM) $(CLIB)
$(RM) $(DLIB)
$(RM) $(ELIB)
mklink:
ln -sf $(ALIB_WITHPATH) $(ALIB)
ln -sf $(BLIB_WITH_PATH) $(BLIB)
ln -sf $(CLIB_WITH_PATH) $(CLIB)
ln -sf $(DLIB_WITH_PATH) $(DLIB)
ln -sf $(E_LIB) $(ELIB)
and launching build with make I will have those targets build
$ make
/bin/rm -f libA.so
/bin/rm -f libB.so
/bin/rm -f libC.so
/bin/rm -f libD.so
/bin/rm -f libE.so
ln -sf ../libA.so libA.so
ln -sf ../libB.so libB.so
ln -sf ../libC.so libC.so
ln -sf ../libD.so libD.so
ln -sf ../libE.so libE.so
But launching it with parallel build with make -j 2 (or more) I would get :
$ make -j 2
/bin/rm -f libA.so
ln -sf ../libB.so libB.so
/bin/rm -f libB.so
/bin/rm -f libC.so
/bin/rm -f libD.so
ln -sf ../libD.so libD.so
/bin/rm -f libE.so
ln -sf ../libA.so libA.so
ln -sf ../libC.so libC.so
ln -sf ../libE.so libE.so
g++: libB.so: No such file or directory
Which in this particular case would remove my link to libB.so and won't create it again - breaking the build in effect.
How can I fix this to be able to launch parallel builds ?
EDIT
Adding something like this to mklink target seems to fix the issue:
mklink: rmlink
Please comment if this is the correct way.
When considering parallel builds, make decides the order in which to build things solely by the prerequisite lists. If target FOO is not defined as a prerequisite of target BAR, then make will feel free to build both FOO and BAR at the same time.
Remember that having two targets listed as prerequisites to the same target, as in TARGET : FOO BAR, just means that both FOO and BAR must be built before TARGET. It does NOT mean that FOO and BAR have any relationship to each other, at all. So if you have:
foo: rmlink mklink
then make is free to run both rmlink and mklink at the same time. If you want to have rmlink always completed before mklink is started, you have to declare a prequisite relationship between them, like:
mklink: rmlink
And of course, remember you must ensure that the mklink target is a prerequisite of any linker target that needs those links to exist.
There may well be more wrong here but given the parts of the makefile you've shown and the question you asked, that should fix it.