specifying the kernel source in ./configure

*nix specific usage questions
jpzone
New Cone
New Cone
Posts: 8
Joined: 21 Jul 2007 22:34

specifying the kernel source in ./configure

Postby jpzone » 25 Jul 2007 04:15

Hi all.
Please help me with following question -

While compiling vlc player, how to make the ./configure script to look at a different kernel source instead of the one running?

I want to compile videolan for one embedded linux kernel. I have the source (compiled) of that kernel in my home directory but I can't find any options in videolan configuration which makes it look at the kernel source in my home directory. I dont want it to guess the kernel source because it then always selects the kernel which is running on the machine.

Anticipating some help from the forum, Please give me some clue.

Thanks
jpzone

kmf31
Cone that earned his stripes
Cone that earned his stripes
Posts: 308
Joined: 11 Mar 2007 21:47

Re: specifying the kernel source in ./configure

Postby kmf31 » 25 Jul 2007 08:51

VLC is a userspace program and does not depend on the kernel-headers for a precise kernel-version such as kernel-drivers which are loaded as kernel-modules and will not work with another kernel-version.

It is true that VLC uses some kernel-headers for dvb and v4l support which can be selected with: "--with-v4l=PATH" and "--with-dvb=PATH" (verify with "./configure --help | grep kernel":

Code: Select all

--enable-mga Linux kernel Matrox support (default disabled) --with-v4l=PATH path to a v4l-enabled kernel tree --with-dvb=PATH path to a dvb- and v4l2-enabled kernel tree
)

However, here you only need one reasonable "close" kernel for the compilation and afterwards it will well work on another kernel version. Also this is even only relevant if you use dvb or v4l in VLC and this will indeed use some kernel-driver for you dvb card etc. but this driver is not a part of vlc but of the kernel itself, either in a stock kernel or obtained from: http://www.linuxtv.org/ (in case if your driver is not yet contained in the stock kernel from kernel.org, typically a new linuxtv-driver enters the stock-kernel after 1-3 months after release in the linuxtv-project).
Typically the dvb-modules of the kernel are loaded when you plug in your dvb-card (at least with USB), otherwise you take care to load them manually with some script at boot.

As far as the "generic" headerfiles for dvb are concerned you can also copy the folder "dvb" from "include/linux" (in some rather recent kernel-tree) to /usr/include/linux/ and that is enough (=> with this no need for the above ./configure options). Afterwards you may compile vlc even without the above ./configure options (such as "----with-dvb=PATH) and the running kernel (when VLC is invoked) does not need to match the kernel-version of which you took the dvb-headers. I am doing this for a long time like this.
Of course "the running kernel" needs his own dvb-kernel-drivers (for your dvb-card) activated and compiled as modules but this is done with the compilation of the kernel (or of the linuxtv-drivers if you take them and here it is indeed important to take the correct kernel-header files).

Remember: the issue of the exact matching of kernel-source-versions is only important if you compile a kernel-module and it is not relevant for user space programs (such as vlc) even though the user space program may use such a kernel-module (e.g. vlc using the driver for a dvb-card). The kernel-module typically provides a generic interface to the user space program by /dev- or /proc-files.

jpzone
New Cone
New Cone
Posts: 8
Joined: 21 Jul 2007 22:34

Re: specifying the kernel source in ./configure

Postby jpzone » 26 Jul 2007 02:34

Thanks for the reply,

Okay so here is what I am trying to do. Please bear with me for 2 minutes to understand this. I have a Soekris embedded computer (a board) on which I want to hook up the webcam so that when it will become a node in wireless network, it can stream to other nodes. that board has a 2.6.19.2 kernel. I compiled the modules for v4l (compat_ioctl32, v4l1-compat, v4l2-common, videodev, usbvideo, quickcam) on my development machine for 2.6.19.2 kernel and copied them to board. upon hooking up camera to board now it recognizes it and it looks that video0 is working.

Now I want vlc to stream the webcam. I dont think I need anything in dvb. I added an option to my configure script --with-v4l=/x/y/linux-2.6.19.2 and compiled vlc again. copied the binaries, libraries, includes, share to board in /usr/bin, /usr/lib and so on. Still it gives me the same error upon running vlc.. "floating point exception"

here is my ./configure options -
./configure
--prefix=/home/php/rix/vlc-test/in/
--exec-prefix=/home/php/rix/vlc-test/de/
--with-v4l=/home/php/rix/linux-2.6.19.2
--enable-nls=no
--enable-optimize-memory
--enable-vlm=no
--enable-growl=no
--enable-motify=no
--enable-dvdnav=no
--enable-smb=no
--enable-v4l
--enable-gnomevfs=no
--enable-libcdio=no
--enable-libcddb=no
--enable-cdda=no
--enable-vcd=no
--enable-screen=no
--enable-ogg=no
--enable-mkv=no
--enable-mod=no
--enable-mpc=no
--enable-mad=no
--enable-libtar-support=no
--enable-a52=no
--enable-dts=no
--enable-libmpeg2=no
--enable-vorbis=no
--enable-speex=no
--enable-x264=no
--enable-cmml=no
--enable-x11=no
--enable-xvideo=no
--enable-glx=no
--enable-xinerama=no
--enable-opengl=no
--enable-freetype=no
--enable-fribidi=no
--enable-libxml2=no
--enable-skins2=no
--enable-wxwidgets=no
--enable-visual=no
--enable-daap=no
--enable-bonjour=no
--enable-gnutls=no
--enable-hal=no
--enable-sdl=no

I am trying to avoid all extra libraries and gui because of memory constraints on board. Please let me know if I am discarding something important which actually is giving me this error.

Do I need to cross compile because board gives i586 in uname -a and development machine gives i686.

Please give me some pointer how can this be done.

kmf31
Cone that earned his stripes
Cone that earned his stripes
Posts: 308
Joined: 11 Mar 2007 21:47

Re: specifying the kernel source in ./configure

Postby kmf31 » 26 Jul 2007 11:00

The issue between 586 and 686 is (potentially) only a problem if on your bord you have an old Pentium 1 processor (the type of processor used around 1995-1996) and 686 is already Pentium 2 which is in the mean-time also considered as very old. Furthermore, with default compilation options most gcc compilers (32bit-gcc-version of course) produce code that run even on 386 processors (which are even more older). In short if a binary compiled on your developpement machine works on the embedded computer it should be okay as far as this point is concerned and I don't believe that you "need to cross-compile". At worst try some gcc-options to force 386 of 586 compatible code (but even this should not be necessary).


I think you should be more concerned about the installation path and the way you install vlc. If you install vlc in some special prefix path and if you copy it elsewhere I believe it does not work very well, maybe not all since it has to find its plugins and I believe this is more than only an issue to find shared libaries. But okay, I am not at all expert on these kind of details such as the real developpers.

However, to keep things simple, I recommand that you chose some installation tree for you embedded computer, e.g. --prefix=/usr/VLC and that you use this same tree on your developpement computer and install vlc properly with "make install" after compilation and then you copy this full folder on the same place on the embedded computer. Then you add /usr/VLC/bin to your PATH (on the embedded computer) in order to find the vlc binary. Actually if you call vlc with the absolute path /usr/VLC/bin/vlc this will also work without changing the path.
This will take care that vlc will automatically find all of its plugins. However, even if you reduce the libraries vlc still depends on "some" special dynamic libraries, codecs, outside vlc (e.g. ffmpeg etc., depending of what you finally keep as codec) and these need to be installed on the embedded computer (typically in /usr/lib).
To find the dynamic dependencies for a binary one typically uses the command "ldd ..." but in the case of vlc you have to apply this command not only to the vlc-binary itself but to all of its plugins (which are in /usr/VLC/lib/vlc/... if you use my suggestion for prefix).

There is also a method to include the few codecs you use in a static way using the appropriate ./configure option. I think you can use: "--enable-static --disable-shared". In that way all plugins will be build statically (or even statically completely included in the main vlc-binary, I am not 100% sure ??).
Have also a look at the configure options of the type "--with-blabla-tree=PATH" allowing to link particular codecs statically into the plugins.

Afterwards there is the question if here the static or dynamic way is more memory efficient. In general if a dynamic library is used more than once in the system it is more efficient but I am not sure if this applies for the codecs-libaries you still need, may be yes if vlc loads at the same time two plugins depending on the same library. In that case a static link may waste memory.
In any case you have to provide all libaries on which vlc depends in the embedded computer, either independently as shared libaries or compiled statically in vlc or its plugins.

jpzone
New Cone
New Cone
Posts: 8
Joined: 21 Jul 2007 22:34

Re: specifying the kernel source in ./configure

Postby jpzone » 29 Jul 2007 01:17

That was really a great reply and it helped great to me..

I somehow got rid of the "Floating Point Exception Error". you were correct that I did not need anything in the cross compile or anything fancy.
I have 2.6.19.2 kernel on my embedded platform and I made that running on a desktop. I loaded the v4l modules first in the desktop kernel and than compiled with v4l. then I transferred everything on the board and it does not give me that error but now error is different.

But may be I made a mistake in the install as you said. what I did was I copied the vlc, vlc-config binary to /usr/bin/ and libvlc.a to /usr/lib/ (and vlc dir) on the board This got me in new trouble because vlc binary was not able to find the plugins. I searched and added --plugin-path while running vlc and it worked partly. I mean it was detecting all the plugins in /usr/lib/ correctly but still was giving errors on board like -

>> /usr/bin/vlc -I dummy --plugin-path=/usr/lib/ v4l:/dev/video0:norm=secam:frequency=543250:size=640x480:channel=0:adev=/dev/dsp:audio=0 --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=3000,ab=256,vt=800000,keyint=80,deinterlace} :std{access=http,mux=ps,dst=192.168.0.1:8080}' --ttl 12
...
...
[00000108] main stream output debug: adding a new input
[00000109] stream_out_transcode private debug: creating video transcoding from fcc=`I422' to fcc=`mp4v'
[00000133] main decoder debug: looking for decoder module: 5 candidates
[00000133] main decoder debug: using decoder module "rawvideo"
[00000134] main encoder debug: looking for encoder module: 1 candidate
[00000109] stream_out_transcode private error: cannot find encoder ((null))
[00000133] main decoder debug: removing module "rawvideo"
[00000109] stream_out_transcode private error: cannot create video chain
[00000122] main packetizer error: cannot create packetizer output (I422)
...
...

Now as an observation, I saw I can run this correctly on my desktop computer running the same kernel as board. But the difference is I had installed ffmpeg before on the computer while compiling vlc code. but there are no ffmpeg libs on board and hence that is the reason of the errors may be. I figured out this from your reply mentioning the dynamic libraries.

So what options do I have? I mean should I load ffmpeg libs to board. Because of memory constraints on board I am reluctant to do so but it looks like thats the only option. what happens if I compile with --enable-static and --disable-shared?? I am a newbie to linux development so please bear with me. I tried searching for the same and it looks like --enable-static will install all the dynamic libs also to --prefix. Is that true? in that case, will I have ffmpeg libs together with plugins in --prefix?

Thanks once again for your help in time..

one totally different question - what if I use ogg + vorbis + theora for streaming? I dont need ffmpeg there, correct? but upon trying that it segfaults.. It will be great if you can please answer my question in "vlc sout" section.. It will be great if you can give me some clue there too.

jpzone
New Cone
New Cone
Posts: 8
Joined: 21 Jul 2007 22:34

Re: specifying the kernel source in ./configure

Postby jpzone » 29 Jul 2007 06:41

what I interpreted from other forum posts regarding --enable-static and --disable-shared is that when vlc is built with this options, the bins and libs in prefix dir does not need to load any other libraries (from /usr/lib typically) to run. Is that true? I believe not because doing that practically, vlc still tries to load ffmpeg libs.

So, how should I know what dynamic libraries I will need on my board to run vlc? doing ldd on all plugins?

I think I dont have enough memory to install ffmpeg on board. Is there any way I can do this without ffmpeg completely and can use some small size codecs. I am trying ogg and vorbis but they also segfault. Please help me.

kmf31
Cone that earned his stripes
Cone that earned his stripes
Posts: 308
Joined: 11 Mar 2007 21:47

Re: specifying the kernel source in ./configure

Postby kmf31 » 30 Jul 2007 20:11

As already told I would strongly recommand to install vlc in some folder such as /usr/VLC and to copy the full folder on the same place on the embedded computer. In this way there will no problems with the plugins (this may also resolve the segfault problem you have in some cases). You chose "--prefix=/usr/VLC" and later you call /usr/VLC/bin/vlc and here the plugin-paths etc. will be compiled in vlc. Sometimes when you recompile vlc with different ./configure options you should also erase the old installation folder because old copies of no longer used plugins may also cause problems (such as segfault). The "make install" will only install the new plugins but not erase the old plugins which where compiled previously and if they are absent in the new compilation.

The library libvlc.a will not be used by vlc during the runtime, because it is the static version. You may use it to compile and link other programs that call libvlc-functions but as far as vlc is concerned the libvlc-funtions are either already contained in vlc or vlc depends on the dynamic version (libvlc.so which is typically a symbolic link to libvlc.so.x.x.x where x.x.x is some version number).

You streaming command line containing:

Code: Select all

#transcode{vcodec=mp4v,acodec=mpga,vb=3000,ab=256...
clearly needs ffmpeg and maybe x264 (x264 the modern streaming mp4-codec used for HD-TV etc.) to encode the mp4v codec (if this is a valid name for the video-codec in vlc ?). Furthermore, I suspect that encoding to mp4 will be very heavy for the CPU and I am not sure if your embedded computer can handle this concerning the CPU-charge. You should first test on a bigger computer. Maybe you should better encode to mpeg2 (which also requires ffmpeg).
But the difference is I had installed ffmpeg before on the computer while compiling vlc code. but there are no ffmpeg libs on board and hence that is the reason of the errors may be.
Of course if you need ffmpeg in vlc, you need either the dynamic libraries or to compile the vlc-ffmpeg-plugin statically (using "--with-ffmpeg-tree=..." during compilation). For this you will have to install and compile ffmpeg on you own.
The dynamic ffmpeg-libraries of ffmpeg are:

libavformat.so.<blabla-version-number>
libavcodec.so.<...>
and maybe:
libpostproc.so.<...>

you have to copy them from your developpement computer (proably to be found in /usr/lib/...) to /usr/lib/ of the embedded computer and afterwards run the command: "ldconfig" to actualize the library cache-database.

You should control with "ldd libffmpeg_plugin.so" which libraries the ffmpeg-plugin requires (libffmpeg_plugin.so is in the subfolder "codec" of the plugin folder, which is probably /usr/lib/vlc in your case or /usr/VLC/lib/vlc if you use the installation folder I suggested.

In principal you have to do the same with every plugin and to add the missing dynamic libraries in the embedded computer (typically of the form: lib<blabla>.so.<blabla-number>).


ffmpeg is a very universal library which is able to decode and encode a lot of codecs, such as mpeg2, mpeg4, mpega and ffmpeg may also be compiled in a way that it supports ogg, thora, etc. (However, you may also add ogg, thora support explicitely in vlc and not in ffmpeg). For mpeg2 decoding only there is also libmpeg2.so.<...> which vlc uses by default (if it is present in the system). If somehow you need to encode mpeg2 (and with V4L that seems necessary to me ??) you will need ffmpeg. However, the dynamic libraries of ffmpeg are not so big.

You can disable ffmpeg with "--disable-ffmpeg" during compilation but than many things with transcoding will not work (especially your above streaming command line).

Finally, when you want to do streaming you need to include the live555-library which is not included by default and which you forget in you above configure-option list. Details for installation here:
viewtopic.php?f=13&t=34103&p=105767&hil ... 55#p105767


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 21 guests