Issues in compiling my first program in Opensuse 11.3

Hello everybody

I was reading the following forum guide:

openSUSE software installation hints

So I decide to install from the souce code the following webcam application:

GTK+ UVC Viewer

In order to avoid problems ( it is my first installation from souce code) I downloaded and unpacked everything in an USB key and I worked from, as the guide said, from the Linux terminal.

Once I was in the right directory and I compute the command:

./configure

I got the following issues:

golem@linux-hchb:/media/LEXAR/Test/guvcview-src-1.4.3> ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... none
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... none
checking for library containing strerror... none required
checking for gcc... (cached) gcc                                                                                                                                                                           
checking whether we are using the GNU C compiler... (cached) yes                                                                                                                                           
checking whether gcc accepts -g... (cached) yes                                                                                                                                                            
checking for gcc option to accept ISO C89... (cached) none needed                                                                                                                                          
checking dependency style of gcc... (cached) none                                                                                                                                                          
checking how to run the C preprocessor... gcc -E                                                                                                                                                           
checking for grep that handles long lines and -e... /usr/bin/grep                                                                                                                                          
checking for egrep... /usr/bin/grep -E                                                                                                                                                                     
checking for ANSI C header files... yes                                                                                                                                                                    
checking if you specifically want to enable debug-code -g... no                                                                                                                                            
checking for sys/types.h... yes                                                                                                                                                                            
checking for sys/stat.h... yes                                                                                                                                                                             
checking for stdlib.h... yes                                                                                                                                                                               
checking for string.h... yes                                                                                                                                                                               
checking for memory.h... yes                                                                                                                                                                               
checking for strings.h... yes                                                                                                                                                                              
checking for inttypes.h... yes                                                                                                                                                                             
checking for stdint.h... yes                                                                                                                                                                               
checking for unistd.h... yes                                                                                                                                                                               
checking locale.h usability... yes                                                                                                                                                                         
checking locale.h presence... yes                                                                                                                                                                          
checking for locale.h... yes
checking for LC_MESSAGES... yes
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking for ngettext in libc... yes
checking for dgettext in libc... yes
checking for bind_textdomain_codeset... yes
checking for msgfmt... /usr/bin/msgfmt
checking for dcgettext... yes
checking if msgfmt accepts -c... yes
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... no
checking for catalogs to be installed...  pt pt_BR de es fr da tr cs ja ru nl he eu zh_TW
./configure: line 5552: ./po/POTFILES.in: No such file or directory
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for DEPS... no
configure: error: Package requirements (gtk+-2.0 >= 2.14.0 glib-2.0 >= 2.10.0 gthread-2.0 gdk-2.0 >= 2.10.0 gdk-pixbuf-2.0 sdl >= 1.2.10 portaudio-2.0 libpng libavcodec libv4l2 libudev) were not met:

No package 'gtk+-2.0' found
No package 'glib-2.0' found
No package 'gthread-2.0' found
No package 'gdk-2.0' found
No package 'gdk-pixbuf-2.0' found
No package 'sdl' found
No package 'portaudio-2.0' found
No package 'libpng' found
No package 'libavcodec' found
No package 'libv4l2' found
No package 'libudev' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables DEPS_CFLAGS
and DEPS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

However there is something strange: I have checked if these libraries were installed or note and by querying the software database I got:

  1. gtk2
  2. glib2
  3. portaudio
  4. libpng12-0
    libpng14-0
    libpng14-14-32bit
  5. libavcodec52
  6. libdev4l2-0
  7. libudev0

Were installed, but it seems that the installation program did not recognize them correctly.

However it was not possible to find the following ones in any repository:

  1. gthread-2.0
  2. gtk-2.0
  3. gdk-pixbuf-2.0
  4. sdl

Where dit I get this wrong? Any idea??

Thank you in advance for your advices

When you install a package called foo, it generally contains just the files to run foo or the runtime libraries for foo. If you are doing development, you will usually need a package called foo-devel which contain include files for your application to successfully compile. E.g. gtk2-devel.

In addition, the package names are not necessarily the same as the library names in many cases. The development library may be contained in another package. You have to do a more comprehensive search that looks at the contents of packages.

Sorry but I am not getting your point.

What I am trying to do here is to build a “dirty” rpm file in order to install the application(in this way it can be tracked down by the rpm database and I will be able to install it).

I know that the devel libraries are the development ones but here the system is requiring something different.

Before I proceed I have to mention that I have installed the KDE enviroment and here I am seeing :gtk2,gthread,glib2 and so on, that ,unless I am mistaken, are linke to the Gnome enviroment.

It can be a “mismatch issue” a not compatibility between the two graphics enviroment?

Thanks for your attention

You are compiling from source and therefore you need the *-devel packages. This is true even if you make a package later on.

No package 'gtk+-2.0' found
No package 'glib-2.0' found
No package 'gthread-2.0' found
No package 'gdk-2.0' found
No package 'gdk-pixbuf-2.0' found
No package 'sdl' found
No package 'portaudio-2.0' found
No package 'libpng' found
No package 'libavcodec' found
No package 'libv4l2' found
No package 'libudev' found

Make sure that you have *-devel packages installed for those. Have a look at the packman repo to find them. (This is the reason why there is no “official” openSUSE package of guvcview; it depends on some libraries which have legal issues and are only in packman).

In case you have problems to find requred prerequisites come back here. We will be glad to help you.

On 2010-12-06 17:06, FabrizioS wrote:

> Before I proceed I have to mention that I have installed the KDE
> enviroment and here I am seeing :gtk2,gthread,glib2 and so on, that
> ,unless I am mistaken, are linke to the Gnome enviroment.

You are compiling a gtk app, so you need gnome libraries, plus the -devel
version of those packages.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

The situation has improved, but unfortunately I am not able to find all the libraries I need.

I post below the result I got once I have computed the command: ./configure

configure:5732: error: Package requirements (gtk+-2.0 >= 2.14.0 glib-2.0 >= 2.10.0 gthread-2.0 gdk-2.0 >= 2.10.0 gdk-pixbuf-2.0 sdl >= 1.2.10 portaudio-2.0 libpng libavcodec libv4l2 libudev) were not met:

No package 'sdl' found
No package 'portaudio-2.0' found
No package 'libavcodec' found
No package 'libv4l2' found

So the following libraries

No package ‘sdl’ found
No package ‘portaudio-2.0’ found
No package ‘libavcodec’ found
No package ‘libv4l2’ found

Are still missing.I tried to check all the “devel” libraries related with these names (sdl,portaudio etc…) in the Packman repository, but unfortunately I could not find anything.

Please, could you tell me in which devel files are contained the above libraries??

AFAICS you need:

libSDL-devel
portaudio-devel
libffmpeg-devel
libv4l-devel

There is a src.rpm available for Fedora: guvcview-1.4.3-1.fc14.src RPM
It would probably be easier to install that one, modify guvcview.spec for openSUSE and compile/build with rpmbuild.

On 2010-12-08 10:06, FabrizioS wrote:
>
> The situation has improved, but unfortunately I am not able to find all
> the libraries I need.
>
> I post below the result I got once I have computed the command:
> /configure
>
>
> Code:
> --------------------
> configure:5732: error: Package requirements (gtk±2.0 >= 2.14.0 glib-2.0 >= 2.10.0 gthread-2.0 gdk-2.0 >= 2.10.0 gdk-pixbuf-2.0 sdl >= 1.2.10 portaudio-2.0 libpng libavcodec libv4l2 libudev) were not met:
>
> No package ‘sdl’ found
> No package ‘portaudio-2.0’ found
> No package ‘libavcodec’ found
> No package ‘libv4l2’ found
>
> --------------------

With webpin (in my 11.2) I see:

  • portaudio-devel: Development package for the portaudio library
  • 19 [suse-oss | multimedia:/libs | home:/jervine:/oolite]

sdl. Could it be libSDL-devel? It is in suse-oss.

  • portaudio-devel: Development package for the portaudio library
  • 19 [suse-oss | multimedia:/libs | home:/jervine:/oolite]

libavcodec, libv4l2 - dunno.

I think there is a mail list on packman, you should ask them. I don’t know
what they do about -devel packages. You could use webpin searching for a
package that exists only in the devel package, typically a header file - I
think you can do that analyzing the output of configure, there is a log
file where perhaps you can find out that info.

For example, I take “rpm -ql postgresql-devel” that I have installed. I see
some files I could use:

/usr/include/pgsql/ecpg_config.h

/usr/lib64/libpgport.a
/usr/lib64/libpgtypes.so
/usr/lib64/libpq.so

I run:

cer@Telcontar:~> webpin ecpg_config.h
… performing request on
http://software.opensuse-community.org/ws/searchservice/Search/Simple/openSUSE_112/ecpg_config.h
ERROR: caught exception while connecting and sending request to server:
connection timed out after 60 seconds

Gosh :frowning:
I was not expecting that.

Then, I don’t know.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

At last I succeeded in compiling my first program in Linux!!!

I have to say that it was a bit tricky:first of all because understand where I had to find the libraries was no easy at all.

Once I created my “dirty” rpm I could install guvcview with no problem. The only drawback is that I have to launch the application using Run because no icon has been created in the desktop or in the menu.

As far as compiling is concerned I would like to ask you:

  1. Everytime I have to compile a program starting from the source code
    do I have always to compute the following command:

./configure
make
su
make install
checkinstall

in order to compile and create a rpm or there are other procedures?
I am asking this because few years ago I read that sometime was necessary to give some directive directly to the compiler (gcc or gcc++).

  1. Looking for a specific library has been a very long process. Doesn’t exist any database to query where it’s possible, starting from a package name, understand in which library is included?

Thank you for you precious support!!!

On 2010-12-10 11:06, FabrizioS wrote:
>
> At last I succeeded in compiling my first program in Linux!!!

For a first one, it was quite difficult. It is easier if all the libraries
exist in oss/non-oss.

> I have to say that it was a bit tricky:first of all because understand
> where I had to find the libraries was no easy at all.

It becomes easier the fourth time :wink:

> Once I created my “dirty” rpm I could install guvcview with no problem.
> The only drawback is that I have to launch the application using Run
> because no icon has been created in the desktop or in the menu.

Ah, yes. I think they have to prepare a desktop file valid for the desktops
in use, and put them in the paths that the desktops see them. I don’t know
who makes those files, the devs or the packagers.

> As far as compiling is concerned I would like to ask you:
>
> 1) Everytime I have to compile a program starting from the source code
> do I have always to compute the following command:
>
> /CONFIGURE
> MAKE
> SU
> MAKE INSTALL
> CHECKINSTALL

Yep.

In theory, the “make install” phase should not be necessary, because
checkinstall does it. However, checkinstall has a bug (more than one,
actually). The bug causes it to not be able to create directories and fail;
thus the trick is precisely to run make install before so that it creates
all directories.

> in order to compile and create a rpm or there are other procedures?
> I am asking this because few years ago I read that sometime was
> necessary to give some directive directly to the compiler (gcc or
> gcc++).

No, that should not be necessary, all directives should be given by make.

> 2) Looking for a specific library has been a very long process. Doesn’t
> exist any database to query where it’s possible, starting from a package
> name, understand in which library is included?

No, there is no such a database.

What I do normally is use “pin”, the predecessor of “webpin”. It greps a
long file (/var/lib/pin/ARCHIVES.gz) that lists all the files in all
packages that can be installed in the system. Actually, those in the DVD
only. It works better if you can join the archive from both the oss and non
oss repos making a combined, complete archive.

With that, knowing what particular file is the ./configure testing for, you
can learn what package contains it most of the times.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Hello Fabrizio

Good to hear that you had a success. guvcview is not easy as a first “hello world” program, but it’s easy in the sense that it compiles well with no errors/warnings and does not need to be patched.

I have to say that it was a bit tricky:first of all because understand where I had to find the libraries was no easy at all.

The software installation module of yast offers a search function. In addition to yast I use the openSUSE packet search software.opensuse.org: Download openSUSE 11.3 and Webpin to locate libraries and packages. For packages not available from openSUSE I open Packman in my browser and use the ^F search function.

The only drawback is that I have to launch the application using Run because no icon has been created in the desktop or in the menu.

Some packages (like guvcview) offer a *.desktop file and the required icons. You have to install those and disable the “debian” mode during the ./configure step. But for many apps you have to create/write your own desktop file.

in order to compile and create a rpm or there are other procedures?

Not all packages are using automake/make. Some use cmake or qmake. Then the procedure may be different. In any case you have to look for a file named INSTALL or README in the source, containing a description how to compile. In most cases the necessary dependencies are listed as well.

Creating a local package with build

There is another possibility to build a local package on your computer, offering some advantages: Install the “build” package. This is a script which will check for dependencies, install all required packages, unpack your source, compile it and build a package. You have to write a spec file containing all required specifications how to do this. I will give you a HOWTO for the example of guvcview:

  1. Unpack the guvcview source and repack it with bzip2:
tar xvzf guvcview-src-1.4.3.tar.gz
mv guvcview-src-1.4.3 guvcview-1.4.3
tar cf - guvcview-1.4.3 | bzip2 -9 > guvcview-1.4.3.tar.bz2
  1. Now create a directory with the openSUSE repositories. The build script will load and install all required packages from there. You populate it with rsync (takes some time, depending on your bandwidth, but you do it just once. Then keep it to build whatever package you like). My local repos are located at /drive/repo/opensuse/distribution/11.3/repo/ and /drive/repo/opensuse/update/11.3/.

I download like this:

vodoo@myhost:/drive> cat rsync-distro
#!/bin/bash
# rsync the SuSE distro
#
rsync -rlpt --exclude-from="/drive/distro-excludelist" -hi --stats \
--delete-after \
rsync.opensuse.org::opensuse-full \
/drive/repo

vodoo@myhost:/drive> cat distro-excludelist
/opensuse/distribution/11.4-Milestone1
/opensuse/distribution/11.4-Milestone2
/opensuse/distribution/11.4-Milestone3
/opensuse/distribution/11.4-Milestone4
/opensuse/distribution/11.4-Milestone5

This pulls the full distro, 11.1, 11.2 and 11.3 all architectures. Add additional lines to distro-excludelist to exclude all unnecessary stuff.

Add another local rpm-only repo to keep extra stuff, like additional packages from packman: /drive/openSUSE-11.3-rpm/. Use your browsers “Save link target as …” function to download additional packages from packman.

  1. Write a small bash script to launch the build script. Name it ‘build-guvcview.sh’. This is what I have:
#!/bin/bash
#
build --rpms /drive/repo/opensuse/distribution/11.3/repo/oss:\
drive/repo/opensuse/distribution/11.3/repo/non-oss:\
drive/repo/opensuse/update/11.3:\
drive/openSUSE-11.3-rpm \
--arch i586 \
--root /var/tmp/build-root \
guvcview.spec

Make it executable. It must be run as root (not yet; later on).

  1. Write your spec file, named ‘guvcview.spec’. The working example for guvcview looks like this:
#
# spec file for package guvcview (Version 1.4.3)
#
# norootforbuild
Summary: GTK UVC Viewer
Name: guvcview
Version: 1.4.3
Release: 1.1   
License: GPLv2
Group: Productivity/Multimedia/Video/Players
Source0: %{name}-%{version}.tar.bz2
URL: http://prdownload.berlios.de/guvcview/guvcview-src-1.4.3.tar.gz   
BuildRequires: pkg-config gtk2-devel libSDL-devel portaudio-devel
BuildRequires: libudev-devel libv4l-devel libffmpeg-devel update-desktop-files
Requires: SDL
%if 0%{?suse_version} < 1120
BuildRoot: %{_tmppath}/%{name}-%{version}
%endif

Autoreqprov: on

%description
GTK interface for capturing and viewing video from devices supported by the
linux UVC driver, although it should also work with any v4l2 compatible
device.

%prep
%setup -q -n %{name}-%{version}
chmod -x README

%build
export CFLAGS=$RPM_OPT_FLAGS
./configure --prefix=/usr --disable-debian-menu --enable-pulse
%{__make} %{?jobs:-j%jobs} %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install
%suse_update_desktop_file -r %{name} AudioVideo Player
%find_lang %{name}

%if 0%{?suse_version} < 1120
%clean
%{__rm} -rf '%{buildroot}'
%endif
%files -f %{name}.lang
%defattr(-,root,root,-)
%dir %{_datadir}/pixmaps/%{name}
%dir %{_datadir}/doc/guvcview   
%{_bindir}/%{name}
%{_datadir}/doc/guvcview/*
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man1/%{name}.1.gz
%{_datadir}/pixmaps/%{name}/*
# Enable the following when configure is used without --disable-debian-menu
#%{_datadir}/menu/guvcview

%changelog
* Sat Dec 11 2010 vodoo <vodoo@xxxx.ch> - 20101211-1
- Initial release

At this point there should be 3 files in your build directory:

vodoo@myhost:~/programs/webcam/guvcview/BUILD> ls
build-guvcview.sh  guvcview-1.4.3.tar.bz2  guvcview.spec

Now it’s time to rock:

su
<password>
./build-guvcview.sh

This installs a new copy of 11.3 and runs it in a root jail. If you do not have all required external packages in /drive/openSUSE-11.3-rpm/ it will stop with an error and tell you exactly what additional packages to install. This makes it really easy. Just download what it asks for and start again. When everything is ok you will have your new package of guvcview under /usr/src/packages/RPMS/i386/. Copy it to a suitable place and install with yast.

Have a lot of fun!