Trouble compiling libtiff 4.0 beta on linux - linux

I'm trying to compile libtiff 4.0 beta to a static library on Ubuntu 10.10 using gcc. It seems to compile the libjpeg and libz fine, which are dependencies. Here is the error I am getting
libtool: link: ( cd ".libs" && rm -f "libtiff.la" && ln -s "../libtiff.la" "libtiff.la" )
\
source='tif_stream.cxx' object='tif_stream.lo' libtool=yes \
DEPDIR=.deps depmode=none /bin/bash ../config/depcomp \
/bin/bash ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -c -o tif_stream.lo tif_stream.cxx
libtool: compile: g++ -DHAVE_CONFIG_H -I. -c tif_stream.cxx -o .libs/tif_stream.o
../libtool: line 990: g++: command not found
Any ideas on how I can fix this?

​Install​ the g++ package​.​

I think that your compile chain is incomplete. On ubuntu, try installing the package called build-essentials. That should pull in all the tools needed to compile c and c++ libraries.

Related

I'm trying to use XROTOR, need to use a Makefile but ifort: command not found

I am about 3 hours new to Linux/Cygwin/virtually anything even borderline computer science. I have been tasked with installing a program for rotors/propellers for research (XROTOR), but I cannot figure out how to run the program. It seems to have been developed in Fortran (maybe?), and came with a README. The README is asking me to build the file, but I have no clue what that means. I have downloaded Cygwin, and have gotten as far as the "make libPLT.a" line. I then cd'ed to the bin folder, and typed in "make xrotor" like the README states, but I keep getting the following error:
$ make
ifort -c -I../src -O -static ../src/xrotor.f
sh: ifort: command not found
make: *** [Makefile:147: xrotor.o] Error 127
I've included the README as well. I don't know what I'm doing, and I figured this was a decent place to start. Any help is GREATLY appreciated!!!
EDIT: Left the README out for whatever reason, sorry. I've written it out here:
General
XROTOR and its plot library should compile on any Unix system
with normal Fortran-77, C, and X-Windows support. So far,
XROTOR has been tested on the following systems:
DEC-5000
Alpha
SGI
* Sun
* RS/6000
* HP-9000
* Pentium/Linux
The systems marked with "*" have peculiar features which require slight
modifications to the Makefiles in the plotlib/ and bin/ directories.
Examine these Makefiles before building the plot library and Xrotor.
Build Sequence
To install, first build the plot library in ./plotlib ...
% cd plotlib
% make libPlt.a
Then build the programs in ./bin ...
% make xrotor
% make jplot
The README is missing some details, but you need to compile the program from sources,
and to do so you need to adjust some variables in the Makefile's
As prerequisite for compiling you need gcc-fortran,make and library libX11-devel
plus the X11 system for the graphic. Installing xinit is a good start.
$ tar -xf Xrotor7.55.tar.tgz
$ cd Xrotor
$ cd plotlib
than modify config.make to set PLTLIB = libPlt.a
I used my preferred editor, but other are also ok
$ vim config.make
To build:
$ make libPlt.a
gfortran -c -O2 -fdefault-real-8 plt_base.f
gfortran -c -O2 -fdefault-real-8 plt_font.f
gfortran -c -O2 -fdefault-real-8 plt_util.f
gfortran -c -O2 -fdefault-real-8 plt_color.f
gfortran -c -O2 -fdefault-real-8 set_subs.f
gfortran -c -O2 -fdefault-real-8 gw_subs.f
gfortran -c -O2 -fdefault-real-8 ps_subs.f
gcc -c -O2 -DUNDERSCORE Xwin.c
gfortran -c -O2 -fdefault-real-8 plt_old.f
gfortran -c -O2 -fdefault-real-8 plt_3D.f
ar r libPlt.a plt_base.o plt_font.o plt_util.o plt_color.o set_subs.o gw_subs.o ps_subs.o Xwin.o plt_old.o plt_3D.o
ar: creating libPlt.a
ranlib libPlt.a
Than moving to program build directory
$ cd ../bin
again modify Makefile.gfortran to set PLTOBJ = ../plotlib/libPlt.a and LIBS = -L/usr/lib -lX11
$ vim Makefile.gfortran
and build all program in one shot
$ make -f Makefile.gfortran
gfortran -c -I../src -O ../src/xrotor.f
gfortran -c -I../src -O ../src/xoper.f
gfortran -c -I../src -O ../src/xdesi.f
gfortran -c -I../src -O ../src/xmodi.f
...
gfortran -c -I../src -O ../src/plotdata.f
gfortran -o xrotor xrotor.o xoper.o xdesi.o xmodi.o xaero.o xjmap.o xio.o xnoise.o xrotpl.o xcasepl.o xbend.o xinte.o xutils.o jputil.o plutil.o modify.o srclin.o spline.o userio.o vortex.o plotdata.o ../plotlib/libPlt.a -L/usr/lib -lX11
gfortran -c -I../src -O ../src/jplot.f
../src/jplot.f:107:72:
PAUSE 'Hit return to see J values'
1
Warning: Deleted feature: PAUSE statement at (1)
../src/jplot.f:112:72:
PAUSE 'Hit return to see CP values'
1
Warning: Deleted feature: PAUSE statement at (1)
gfortran -o jplot jplot.o xutils.o jputil.o userio.o ../plotlib/libPlt.a -L/usr/lib -lX11
gfortran -c -I../src -O ../src/jplote.f
gfortran -o jplote jplote.o xutils.o jputil.o userio.o ../plotlib/libPlt.a -L/usr/lib -lX11
The Warning means that the PAUSE command does not exist anymore so the progran will
likely not pause on the expected locations.
This could explain why it is not working as expected, but probably as the code is very old some code assumptions about the Unix system are not anymore valid.
Running it after starting the Xwindow graphic system from inside a Xterm
$ ./xrotor
=========================
XROTOR Version 7.55
=========================
Note: The following floating-point exceptions are signalling: IEEE_DENORMAL
STOP COLORSPECTRUM: Non-monotonic color axis. Check COLWIDTH.
Need to edit the COLORSPECTRUMTRP subroutine xrotor/plotlib/plt_color.f. Add the following after line 508
COLWIDTH=(/1.0,1.20000005,0.5,1.4,1.0,1.20000005,1.5/)

GCC cross compiler for i686 using cygwin (windows) - fail in building GCC

I am trying to cross compile the gcc for linux - i686-elf platform from windows PC (cygwin). As per the toolchain steps, I have successfully compiled:
binutils using
/binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
basic gcc 1st step using
gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
linux headers using
make headers_install ARCH=i386 CROSS_COMPILE=i386-linux- INDTALL_HDR_PATH=my/path/
glibc using
CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=my/path/
and then, make install-headers
Now, while building 2nd part og GCC using:../gcc-7.4.0/configure --target=$TARGET --prefix=$PREFIX --with-sysroot=$HOME/opt/cross --disable-libssp --disable-libgomp --disable-libmudflap --enable-languages=c,c++ --disable-multilib
I am getting the follwing errors:
make[2]: Entering directory '/home/MyPcUserName/src/build-gcc/i686-elf/libgcc
- If this is the top-level multilib, build all the other multilibs.
ln -s ../../../gcc-7.4.0/libgcc/enable-execute-stack-empty.c enable-execute-stack.c
ln -s ../../../gcc-7.4.0/libgcc/unwind-generic.h unwind.h
ln -s ../../../gcc-7.4.0/libgcc/config/no-unwind.h md-unwind-support.h
ln -s ../../../gcc-7.4.0/libgcc/config/i386/sfp-machine.h sfp-machine.h
ln -s ../../../gcc-7.4.0/libgcc/gthr-single.h gthr-default.h
DEFINES='' HEADERS='' \
../../../gcc-7.4.0/libgcc/mkheader.sh > tmp-libgcc_tm.h
/bin/sh ../../../gcc-7.4.0/libgcc/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
echo timestamp > libgcc_tm.stamp
/home/MyPcUserName/src/build-gcc/./gcc/xgcc -B/home/MyPcUserName/src/build-gcc/./gcc/ -B/home/MyPcUserName/opt/cross/i686-elf/bin/ -B/home/MyPcUserName/opt/cross/i686-elf/lib/ -isystem /home/MyPcUserName/opt/cross/i686-elf/include -isystem /home/MyPcUserName/opt/cross/i686-elf/sys-include -g -O2 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. -I../.././gcc -I../../../gcc-7.4.0/libgcc -I../../../gcc-7.4.0/libgcc/. -I../../../gcc-7.4.0/libgcc/../gcc -I../../../gcc-7.4.0/libgcc/../include -DHAVE_CC_TLS -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../gcc-7.4.0/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
In file included from /home/MyPcUserName/opt/cross/usr/include/bits/libc-header-start.h:33:0,
from /home/MyPcUserName/opt/cross/usr/include/stdio.h:27,
from ../../../gcc-7.4.0/libgcc/../gcc/tsystem.h:87,
from ../../../gcc-7.4.0/libgcc/libgcc2.c:27:
/home/MyPcUserName/opt/cross/usr/include/features.h:474:10: fatal error: gnu/stubs.h: No such file or directory
#include <gnu/stubs.h>
^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:491: _muldi3.o] Error 1
make[2]: Leaving directory '/home/MyPcUserName/src/build-gcc/i686-elf/libgcc'
make[1]: *** [Makefile:11875: all-target-libgcc] Error 2
make[1]: Leaving directory '/home/MyPcUserName/src/build-gcc'
make: *** [Makefile:893: all] Error 2
I have tried --disable-multilib to disable the mulilib so as to ignore this gnu issue on 64-bit PC.
I tried to rebuilt all of it again, but still I am facing this issue.
Please let me know if anyone can help. Thanks a lot for your time
After building the glibc, we shouldn't directly start building 2nd part of GCC. Rather, few more steps should be followed for glibc as indicated below:
$ CC=${TARGET}-gcc ../glibc-2.29/configure --target=$TARGET --host=i686-pc-linux-gnu --prefix=$PREFIX --with-headers=my/path/
$ make install-bootstrap-headers=yes install-headers
$ make -j4 csu/subdir_lib
$ install csu/crt1.o csu/crti.o csu/crtn.o /opt/cross/$TARGET/lib
$ $TARGET-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o /opt/cross/$TARGET/lib/libc.so
$ touch /opt/cross/$TARGET/include/gnu/stubs.h
Then, we can start building the 2nd part of GCC.

How to install/compile lgmask on Ubuntu?

I am trying to install Gmask software form source for Ubuntu: https://sourceforge.net/projects/lgmask/
Normally I can run the following to make this happen:
./configure && make && sudo make install
but for the aforementioned package there's no configure directory so this does not work =(
this tarball does come with a Makefile, you can see make install will install lgmask into /usr/local/bin
cat Makefile
all: gmask umask
CC=gcc
CFLAGS=-O2 -fms-extensions
gmask: libimg/jpeg.o masks.o
$(CC) $(CFLAGS) lgmask.c -o lgmask -lX11 -ljpeg libimg/jpeg.o masks.o
umask: libimg/jpeg.o masks.o
$(CC) $(CFLAGS) unmask.c -o unmask -Wall -ljpeg masks.o libimg/jpeg.o
clean:
rm -f ?*~ libimg/*.o *.o
install: all
install lgmask /usr/local/bin
The author did not include the dependency libimg/* in the tarball... I searched around and found it in his svn repo:
sudo apt-get subversion
svn checkout https://svn.code.sf.net/p/lgmask/code/trunk lgmask-code
now, this code depends on libjpeg, let's install it
sudo apt-get install libjpeg62-dev
from where you checkout the source code:
cd libimg
gcc -c jpeg.c -ljpeg
cd ..
gcc -O2 -fms-extensions lgmask.c -o lgmask -L/usr/lib libimg/jpeg.o masks.o -ljpeg -lX11
you will get some warnings but it will compile lgmask for you
~/tmp/lgmask-code$ ./lgmask
usage: lgmask <image name>
Unfortunately when I tried to run it with several jpeg, it pops up a blank image... I tried to compile it with different version libjpeg but get the same result, let me know how it goes for you.

Cross compiling portAudio for Intel Edison

I am using the cross compile environemt from the Intel Site and have successfully compiled several other libraries using it (libsndfile, alsa, fftw) but when I try to compile portaudio it refuses to link to the proper directories. Here is the error I get:
if test -n " bindings/cpp" ; then for dir in " bindings/cpp"; do make -C $dir all; done ; fi
make[1]: Entering directory '/home/theslat/Downloads/portaudio/bindings/cpp'
Making all in lib
make[2]: Entering directory '/home/theslat/Downloads/portaudio/bindings/cpp/lib'
/bin/sh ../libtool --tag=CXX --mode=link i586-poky-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer --sysroot=/usr/edison/sysroots/core2-32-poky-linux -O2 -pipe -g -feliminate-unused-debug-types -version-info 0:12:0 -no-undefined -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o libportaudiocpp.la -rpath /usr/local/lib BlockingStream.lo CallbackInterface.lo CallbackStream.lo CFunCallbackStream.lo CppFunCallbackStream.lo Device.lo DirectionSpecificStreamParameters.lo Exception.lo HostApi.lo InterfaceCallbackStream.lo MemFunCallbackStream.lo Stream.lo StreamParameters.lo System.lo SystemDeviceIterator.lo SystemHostApiIterator.lo ../../../lib/libportaudio.la
libtool: link: i586-poky-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer --sysroot=/usr/edison/sysroots/core2-32-poky-linux -fPIC -DPIC -shared -nostdlib /usr/edison/sysroots/core2-32-poky-linux/usr/lib/crti.o /usr/edison/sysroots/core2-32-poky-linux/usr/lib/i586-poky-linux/4.9.1/crtbeginS.o .libs/BlockingStream.o .libs/CallbackInterface.o .libs/CallbackStream.o .libs/CFunCallbackStream.o .libs/CppFunCallbackStream.o .libs/Device.o .libs/DirectionSpecificStreamParameters.o .libs/Exception.o .libs/HostApi.o .libs/InterfaceCallbackStream.o .libs/MemFunCallbackStream.o .libs/Stream.o .libs/StreamParameters.o .libs/System.o .libs/SystemDeviceIterator.o .libs/SystemHostApiIterator.o -Wl,-rpath -Wl,/home/theslat/Downloads/portaudio/lib/.libs -Wl,-rpath -Wl,/usr/local/lib ../../../lib/.libs/libportaudio.so -L/usr/edison/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/../../lib/i586-poky-linux/gcc/i586-poky-linux/4.9.1 -L/usr/edison/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/../../lib/i586-poky-linux/gcc -L/usr/edison/sysroots/core2-32-poky-linux/lib -L/usr/edison/sysroots/core2-32-poky-linux/usr/lib/i586-poky-linux/4.9.1 -L/usr/edison/sysroots/core2-32-poky-linux/usr/lib /usr/lib/libstdc++.so -lm -lc -lgcc_s /usr/edison/sysroots/core2-32-poky-linux/usr/lib/i586-poky-linux/4.9.1/crtendS.o /usr/edison/sysroots/core2-32-poky-linux/usr/lib/crtn.o -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign --sysroot=/usr/edison/sysroots/core2-32-poky-linux -O2 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-soname -Wl,libportaudiocpp.so.0 -o .libs/libportaudiocpp.so.0.0.12
/usr/lib/libstdc++.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:311: libportaudiocpp.la] Error 1
make[2]: Leaving directory '/home/theslat/Downloads/portaudio/bindings/cpp/lib'
make[1]: *** [Makefile:333: all-recursive] Error 1
make[1]: Leaving directory '/home/theslat/Downloads/portaudio/bindings/cpp'
make: *** [Makefile:251: all-recursive] Error 2
It seems like it is trying to link against my computers normal libstdc++ and I don't know why. I have tried feedin configure a variaty of LDFLAG with the right directories and have reinstalled the toolchain and all my multilibs but no luck.
I also ran into this issue and the easiest way is to source the environment file again after doing a sudo su on the same command line and then do a make install.
Here are the steps I followed to cross compile portaudio for intel edison:
Download the cross compiler edison-toolchain-20150120-linux64.tar.bz2 and the script toolchain-20140724-linux64.sh from this link
Extract the toolchain, run the script (you can put it in your home directory somewhere if you wish) and set up the cross-compile environment
$ tar -xvf edison-toolchain-20150120-linux64.tar.bz2
$ chmod +x toolchain-20140724-linux64.sh
$ ./toolchain-20140724-linux64.sh
$ source /opt/poky-edison/1.6/environment-setup-core2-32-poky-linux
Check the environment on your shell:
$ echo $CC
$ i586-poky-linux-gcc -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer --sysroot=/opt/poky-edison/1.6/sysroots/core2-32-poky-linux
Configure, compile and install portaudio:
$ ./configure
$ make
$ sudo su
# source /opt/poky-edison/1.6/environment-setup-core2-32-poky-linux
# make install
I am suprised that nobody grabbed this but also that it was difficult to find the proper answer anywhere else despite seeing many other people with similar (unresolved issues). The answer is frankly so simple I am embarrased that I overlooked it, but here it is so maybe someone else can find it.
make install required root privilages if the cross-compile SDK is in /opt or somewhere else you do not own. But... sudo does not preserve the environmental variable I had set up for the toolchain! Very simple, also su -m does not work the way I thought it did. Working solutions as follows:
Just install the SDK somewhere in your home directory. you now have write permissions, problem solved.
Run a single command as root while preserving the environment: su -m <yourUserName> -c '$CC main.cpp -lfoo -lbar ...'
The key in numer 2 is the username after -m, at least on my system leaving out the username there produced no errors but failed to preserve my environment.

My lib_LTLIBRARIES library links, but check_LTLIBRARIES one does not?

I have a new c++ project built with autoconf, automake and libtool. Functionality is divided up into support libraries and user binaries. There is also a set of unittests binaries which link against these libraries, are built and run at make check time, but are not installed.
I said the the project is new. I'm actually just now getting around to extracting the first library that should be installed. Until now the (small amount of) written code was just compiled directly into a unittests.
My attempted Makefile.am snippet looks like this:
lib_LTLIBRARIES += libfoo.la
libfoo_la_SOURCES = foo.cc
In make check, I get this:
/bin/bash ./libtool --tag=CXX --mode=link g++ -Wall -Wextra -Werror -ansi -fprofile-arcs -ftest-coverage -g -O0 -fprofile-arcs -ftest-coverage -L/usr/local/lib -Wl,-rpath /usr/local/lib -o libfoo.la -rpath /usr/local/lib foo.lo -lboost_thread-mt -lboost_system-mt -pthread
libtool: link: g++ -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtbeginS.o .libs/foo.o -L/usr/local/lib -lboost_thread-mt -lboost_system-mt -L/usr/lib/gcc/x86_64-linux-gnu/4.6.1 -L/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crtn.o -fprofile-arcs -O0 -fprofile-arcs -Wl,-rpath -pthread -pthread -Wl,-soname -Wl,libfoo.so.0 -o .libs/libfoo.so.0.0.0
/usr/bin/ld: cannot find libfoo.so.0: No such file or directory
collect2: ld returned 1 exit status
Notice the missing library is precisely the one I'm trying to compile.
(The library is not libfoo, but I am able to reproduce the same error with this stub library. The Makefile.am and error lines above are literal and unedited.)
If I change the automake lines to
check_LTLIBRARIES += libfoo.la
libfoo_la_SOURCES = foo.cc
then the compile looks like this:
/bin/bash ./libtool --tag=CXX --mode=link g++ -Wall -Wextra -Werror -ansi -fprofile-arcs -ftest-coverage -g -O0 -fprofile-arcs -ftest-coverage -L/usr/local/lib -Wl,-rpath /usr/local/lib -o libfoo.la foo.lo -lboost_thread-mt -lboost_system-mt -pthread
libtool: link: ar cru .libs/libfoo.a .libs/foo.o
libtool: link: ranlib .libs/libfoo.a
libtool: link: ( cd ".libs" && rm -f "libfoo.la" && cp -p "../libfoo.la" "libfoo.la" )
..and everything works fine (except my library isn't installed, being in check_.)
Notice the only difference in the command lines is some additional arguments in the 2nd one:
... -Wl,-rpath /usr/local/lib -o libfoo.la -rpath /usr/local/lib foo.lo -lboost_thread-mt ...
I don't know offhand if this new argument shouldn't be there, but it does appear to be causing the problem. Does anyone know what I'm missing?
Some more details:
On osx lion, this works fine (and the command lines are different.) This error manifests on
ubuntu 12.04, possibly other linuxes.
noinst_LTLIBRARIES and EXTRA_LTLIBRARIES work like check_LTLIBRARIES: no extra arguments, and it links. It seems libtool 'convenience' libraries are specifically the ones without these arguments.
automake 1.11.1
autoconf 2.68
libtool 2.4
EDIT
(Manually) dropping -Wl,-rpath /usr/local/lib from the arguments also fixes the problem.
I did it to myself. While bringing in autoconf support for boost, I encountered a bug described here. My work-around followed the suggestion of one post:
diff --git a/m4/boost.m4 b/m4/boost.m4
index 3d4e47c..9dd0c43 100644
--- a/m4/boost.m4
+++ b/m4/boost.m4
## -403,7 +403,7 ## dnl generated only once above (before we start the for loops).
LDFLAGS=$boost_save_LDFLAGS
LIBS=$boost_save_LIBS
if test x"$Boost_lib" = xyes; then
- Boost_lib_LDFLAGS="-L$boost_ldpath -Wl,-R$boost_ldpath"
+ Boost_lib_LDFLAGS="-L$boost_ldpath -Wl,-rpath $boost_ldpath"
Boost_lib_LDPATH="$boost_ldpath"
break 6
else
The -rpath introduced here is the same one apparently causing the issue. If I revert this change, the problem goes away (I am of course left with the first issue, but that's another story.)

Resources