Author Topic: Why are these codec libraries still lingering?  (Read 6625 times)

Offline resander

  • Multiple posting newcomer
  • *
  • Posts: 49
Why are these codec libraries still lingering?
« on: May 17, 2009, 06:40:21 pm »
I have an application that uses ODBC to access databases. At one stage I wanted to test some video codec software (don't remember the details now), so I simply inserted code to test it right at the beginning of my ODBC database access code. I had to link to the codec's libavformat.so, which I defined via Project->Build Options->LinkerSettings. I removed  the codec testcode from source and the linker library settings after testing.

I then continued working on the ODBC access code, but everytime I linked I got the warning: /usr/bin/ld: warning libavcode.so.52 needed by /usr/lib/libavformat.so.52 may conflict with libavcodec.so.51. I thought it a bit strange, but ignored it because it seemed quite harmless.

Recently I have been having problems in connecting to Oracle Express via ODBC. The Oracle driver just stops in the middle of the connect call without issuing an error message. I am using Linux strace to try to find out where things might be going wrong. I have discovered lots of attempts to find codec libraries in the trace, but I can see no reason why an Oracle ODBC driver (= a software layer between an application program and the native Oracle code that implements the SQL database) would need video, audio codecs and speech compressors.   

Here are some open calls in the strace log:

open("/lib/tls/i686/cmov/libavcodec.so.51", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/libavcodec.so.51", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/tls/libavcodec.so.51", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libavcodec.so.51", O_RDONLY) = -1 ENOENT (No such file or directory)
   
open("/lib/tls/i686/cmov/libasound.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/libasound.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib/tls/i686/cmov/libavutil.so.49", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/libavutil.so.49", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/i686/cmov/libavutil.so.49", O_RDONLY) = 3

and similar open calls to load libgsm speech compressor, libvorbis audio codecs, libtheora video compression codecs and a few more.

Why are the codec libraries being loaded? Is it because I briefly hijacked the project to checkout the  avformat video codec?

I don't think this should be happening, but I don't know enough to figure out what to do next.

Hints would be most welcome.


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: Why are these codec libraries still lingering?
« Reply #1 on: May 18, 2009, 08:31:52 am »
I don't think this should be happening, but I don't know enough to figure out what to do next.
It can happen. For example: You exchanged the modified version with the old one which has an old time stamp. Thus you make C::B "believe" the compiled object file is still up-to-date so it get's linked in with the code you don't want. If you did such, a full re-build is strongly recommend. If you did experiments like described and cleaned up your project file a full re-build is recommended anyways.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline resander

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: Why are these codec libraries still lingering?
« Reply #2 on: May 18, 2009, 07:23:54 pm »
I am using Rebuild on the Build menu most of the time, so the project is using the latest files. 

I requested a linkmap (via -Map=mapfilename) to check if there are any references to libavcodec/libavformat functions left by myself by mistake. I could not see any, but the map contains the following:

....
LOAD obj/Debug/util.o
LOAD /usr/lib/libodbc.so.1
LOAD /usr/lib/libSDL.so
LOAD /usr/lib/libSDL_image.so
LOAD /usr/lib/libavcodec.so.51
LOAD /usr/lib/libavformat.so.52

The first util.o is my own and libodbc.so.1 is the unixODBC driver manager. I expect these, but the last four are intruders.


I have done Find in Files on the Search menu looking for avformat and avcodec and have also looked at each individual source file, but could not find anything.

The Link Settings section contains /usr/lib/libodbc.so.1 and the Other Link settings contains -Map=mapfilename.

There is a Libraries tab in Properties on the Project menu. It contains nothing in the 'Libraries used in Project' column and a list of libraries in 'Known libraries' column. The latter contains libavcodec, libavformat, theora and many other codecs, but libodbc and libSDL are not there.

Here is the output by ldd on my executable program file:

ken@ken-desktop:~$ ldd /home/ken/projects/lsken/bin/Debug/lsken
   linux-gate.so.1 =>  (0xb7f9f000)
   libodbc.so.1 => /usr/lib/libodbc.so.1 (0xb7f05000)
   libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0xb7e73000)
   libSDL_image-1.2.so.0 => /usr/lib/libSDL_image-1.2.so.0 (0xb7e57000)
   libavcodec.so.51 => /usr/lib/i686/cmov/libavcodec.so.51 (0xb790a000)
   libavformat.so.52 => /usr/lib/i686/cmov/libavformat.so.52 (0xb7824000)
   libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7736000)
   libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7710000)
   libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7700000)
   libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb75a2000)
   libltdl.so.7 => /usr/lib/libltdl.so.7 (0xb7599000)
   libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7580000)
   libasound.so.2 => /usr/lib/libasound.so.2 (0xb74b8000)
   libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb74b4000)
   libdirectfb-1.0.so.0 => /usr/lib/libdirectfb-1.0.so.0 (0xb744d000)
   libfusion-1.0.so.0 => /usr/lib/libfusion-1.0.so.0 (0xb7444000)
   libdirect-1.0.so.0 => /usr/lib/libdirect-1.0.so.0 (0xb742f000)
   libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb7409000)
   libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0xb73e9000)
   libtiff.so.4 => /usr/lib/libtiff.so.4 (0xb7393000)
   libz.so.1 => /usr/lib/libz.so.1 (0xb737d000)
   libavutil.so.49 => /usr/lib/i686/cmov/libavutil.so.49 (0xb736d000)
   libgsm.so.1 => /usr/lib/libgsm.so.1 (0xb7360000)
   libtheora.so.0 => /usr/lib/libtheora.so.0 (0xb7315000)
   libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0xb721a000)
   libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0xb71f0000)
   libavcodec.so.52 => /usr/lib/i686/cmov/libavcodec.so.52 (0xb6ab0000)
   /lib/ld-linux.so.2 (0xb7f85000)
   librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb6aa7000)
   libogg.so.0 => /usr/lib/libogg.so.0 (0xb6aa1000)
   libdirac_encoder.so.0 => /usr/lib/libdirac_encoder.so.0 (0xb6a0d000)
   libfaac.so.0 => /usr/lib/libfaac.so.0 (0xb69fb000)
   libfaad.so.0 => /usr/lib/libfaad.so.0 (0xb69bb000)
   libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0xb6946000)
   libschroedinger-1.0.so.0 => /usr/lib/libschroedinger-1.0.so.0 (0xb68d6000)
   libx264.so.65 => /usr/lib/libx264.so.65 (0xb683f000)
   libxvidcore.so.4 => /usr/lib/libxvidcore.so.4 (0xb6726000)
   liboil-0.3.so.0 => /usr/lib/liboil-0.3.so.0 (0xb66b7000)
   libX11.so.6 => /usr/lib/libX11.so.6 (0xb65c8000)
   libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0xb65c5000)
   libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb65ac000)
   libXau.so.6 => /usr/lib/libXau.so.6 (0xb65a8000)
   libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb65a3000)

which shows libavcode, libavformat and lots of libraries needed by these.

The unixODBC driver manager does not need libavxxx stuff:

ken@ken-desktop:~$ ldd /usr/lib/libodbc.so.1
   linux-gate.so.1 =>  (0xb80bc000)
   libltdl.so.7 => /usr/lib/libltdl.so.7 (0xb8033000)
   libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb801a000)
   libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7ebb000)
   libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7eb7000)
   /lib/ld-linux.so.2 (0xb80bd000)

neither does the Oracle ODBC driver:

ken@ken-desktop:~$ ldd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libsqora.so.10.1
   linux-gate.so.1 =>  (0xb7f71000)
   libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7eda000)
   libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7eb4000)
   libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7e9a000)
   libnsl.so.1 => /lib/tls/i686/cmov/libnsl.so.1 (0xb7e81000)
   libclntsh.so.10.1 => /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so.10.1 (0xb70cd000)
   libodbcinst.so.1 => /usr/lib/libodbcinst.so.1 (0xb70a9000)
   libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb6f4b000)
   /lib/ld-linux.so.2 (0xb7f72000)
   libnnz10.so => /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libnnz10.so (0xb6d45000)
   libltdl.so.7 => /usr/lib/libltdl.so.7 (0xb6d3c000)




There is another project in the same workspace, called 'tutorials', which is a set of demo programs for avcodec/avformat. I downloaded the c-sources and made a code::blocks project for them.

The mapfile for tutorials contains:

LOAD obj/Debug/tutorial01.o
LOAD /usr/lib/libSDL.so
LOAD /usr/lib/libSDL_image.so
LOAD /usr/lib/libavcodec.so.51
LOAD /usr/lib/libavformat.so.52

For tutorials the av libraries of course should be there. Is there any possibility of project cross-infection?

Is there a way of finding out why and where the av libraries are included, maybe via a more detailed linkmap or some other form of contents cross-reference?
 
What should be my next step?
 

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
Re: Why are these codec libraries still lingering?
« Reply #3 on: May 18, 2009, 07:46:40 pm »
Have you done a "clean" on the entire project, then tried to re-build?  The linkmap you showed us looks like a object file (that has not been re-built for a while) has those external references in it.

Ringo

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
Re: Why are these codec libraries still lingering?
« Reply #4 on: May 18, 2009, 07:52:06 pm »
Are you absolutely sure not to have any entries in the global linker options (in "Settings -> Compiler and debugger -> ....") ?

Offline resander

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: Why are these codec libraries still lingering?
« Reply #5 on: May 19, 2009, 03:22:15 pm »
Jens
Many thanks. You have saved my day.

I checked the global linker settings and found the four unwelcome guests.

I put them there 6 months ago when I was doing a lot of experimenting with codecs and totally forgot about them.

I now remember putting them there for several experimental projects because I had difficulties with operating the GUI for local project linker settings. Using the global settings meant I only had to define the settings once. The GUI for the global settings has the same problem.

The problem is that the settings dialogs are much too large for my 800x600 screen resolution. The Add, Edit,Delete and OK, Cancel buttons are outside the screen. On Linux, pressing Altkey while dragging the mouse moves the dialog. Using that I can move the dialog upwards in order to create some expansion room at the bottom of the screen, but the problem is that resize (drag the bottom edge downwards of a dialog or control) operation does not work. A popup menu containing Resize, Move etc appears instead. Clicking Resize on the menu sends the mouse (now with drag-icon cursor) to an arbitrary position on the screen, i.e. the mouse does not stay on the lower dialog element edge. Moving the drag cursor back to the lower edge and starting drag usually does not work. The menu pops up again nine times out of ten.     

The problem seems to happen when the dialog titlebar disappears outside the containing window or screen. If the dialog is smaller and all of it stays within view then the resize works as normal.

The problem is more severe for the global settings dialog.

I cannot increase the resolution above 800x600 because of an Ubuntu display driver problem for my video adapter. Many people have reported this on the Ubuntu forums.

I don't know if this is fixable by programming in codeblocks, but an easier solution would be to rearrange the controls and buttons so that everything is visible at 800x600. This would also be to the benefit of people with less than perfect eyesight who often will not be able to see the small writing at 1024x768 or higher resolution.

Again, many thanks.