Thanks a lot Mike for the long explanation! It's very useful. I'll keep trying to figure it out. I noticed before that when ldd doesn't find a library usually displays it in the list with a "not found" after the '=>' but in the case of _csnd.so there is no mention to libcsnd at all. The path where libcsnd is located is the standard /usr/lib, so ld shouldn't be having any problem finding it (it finds any other libraries located there). Also before I've had problems with other apps missing libraries but I always solved it by adding the path to ldconfig. If I do a ldd on the _csnd.so file extracted from the Csound 5.03CCRMA RPM (just extracting that isolated file to my Desktop) I get: $ ldd '/home/hector/Desktop/site-packages/_csnd.so' linux-gate.so.1 => (0xb7f41000) libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 (0xb7d29000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7c3e000) libutil.so.1 => /lib/libutil.so.1 (0xb7c3a000) libcsound.so.5.1 => not found ... Which is fine since there is no /usr/lib/libcsound.so.5.1 but /usr/lib/libcsnd.so.5.1 (which is what I got from CVS... could that name change be part of the problem?). If I create a symlink then it finds it: $ ldd '/home/hector/Desktop/site-packages/_csnd.so' linux-gate.so.1 => (0xb7f2a000) libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 (0xb7d12000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7c27000) libutil.so.1 => /lib/libutil.so.1 (0xb7c23000) libcsound.so.5.1 => /usr/lib/libcsound.so.5.1 (0xb7b31000) So I guess this proves that my environment is fine and the problem should be something else. Anyways, thanks a lot for the help and sorry for the endless emails. Cheers! Hector On Nov 7, 2007 11:25 AM, Michael Gogins wrote: > ldd only tells you what libraries have actually BEEN linked by the > operating system. If the operating system cannot find a library that is > required, it does not show up in the ldd output. Hence, if you run ldd and > do not find a library that you know is required, then you also know that the > operating system either could not find that library, or tried to load it and > failed. Possible reasons: the file doesn't exist, it exists but is not in > ldconfig or LD_LIBRARY_PATH, it exists and is found but is corrupt, etc. > > The way this works on Linux: > > A binary that dynamically links to a library has a symbol table for the > library without addresses, and the library has the same symbol table (called > the jump table), only with the addresses. When the operating system loads > the binary, it also loads the dynamically linked libraries, and it copies > the actual addresses for the symbols from the library jump table into the > blank slots in the binary symbol table. Complex systems such as Csound > dynamically link to libraries, which dynamically link to other libraries, > and so on.... > > Then, there is dynamic loading by the program, which is what happens with > rtpa. Csound itself, not the operating system, tries to load the library. > Csound itself, not the operating system, finds the addresses to functions > and assigns them to symbols. Things like rtpa or the plugin opcodes are > therefore called "modules" in Linux-speak. > > SWIG linked everything just find during the build process, it is the > runtime installation that is failing to load some of the shared libraries. > To be precise, Python loads _csnd.so as a module, and _csnd.so is > dynamically linked to csoundXX.so.5.1, but the operating system is failing > to find it. > > Therefore, you should just fix your broken symbolic links by hand. These > will be links from the actual library files for the libraries that are > missing from the ldd output, to the directories where the loaded libraries > are located. > > Hope this helps, > Mike > > -----Original Message----- > >From: Hector Centeno > >Sent: Nov 7, 2007 10:28 AM > >To: csound@lists.bath.ac.uk > >Subject: [Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: can't import csnd > from python > > > >Thanks Mike, > > > >I thought about it but I'm not sure how to do it. _csond.so is created by > >Swig, right? Is Swig failing to link it to the shared library > libcsnd.so.5.1? > >Or is the linking detected dynamically by ld? If then, why ldd is not > >showing that _csnd.so requires libcsnd.so.5.1? Sorry, but my knowledge > about > >library linking doesn't go very deep. > > > >Thanks, > > > > > >Hector > > > > > >On Nov 7, 2007 8:19 AM, Michael Gogins wrote: > > > >> Did you try creating this link by hand? > >> > >> Regards, > >> Mike > >> > >> > >> ----- Original Message ----- > >> *From:* Hector Centeno > >> *To:* csound@lists.bath.ac.uk > >> *Sent:* Tuesday, November 06, 2007 11:16 PM > >> *Subject:* [Csnd] Re: Re: Re: Re: Re: Re: Re: Re: can't import csnd > from > >> python > >> > >> Hi again, and sorry for insisting on this. > >> > >> I uninstalled my Csound CVS build and installed Csound 5.03 from the > CCRMA > >> repository. Importing the csnd library in Python works fine and ldd on > the > >> CCRMA's _csnd.so includes this: > >> > >> libcsound.so.5.1 => /usr/lib/libcsound.so.5.1 (0xb7bdf000) > >> > >> Which for some reason I can't get with my own build from CVS. Files are > in > >> the same locations for both. Setting environment variables or running > >> ldconfig doesn't change the problem... so, where should I look for? Why > is > >> libcsound.so.5.1 not being linked to _csnd.so in my build? > >> > >> Any help will be highly appreciated. > >> > >> Hector > >> > >> > >> > >> On Nov 6, 2007 8:21 AM, Michael Gogins < gogins@pipeline.com> wrote: > >> > >> > These are cumulative paths. > >> > > >> > LD_LIBRARY_PATH=$LD_LIBRARY_PATH:newpath > >> > > >> > and so on. > >> > > >> > All the .so files required must be in one or another of the > directories > >> > in ldconfig or LD_LIBRARY_PATH. > >> > > >> > Hope this helps, > >> > Mike > >> > > >> > ----- Original Message ----- > >> > *From:* Hector Centeno > >> > *To:* csound@lists.bath.ac.uk > >> > *Sent:* Monday, November 05, 2007 11:50 PM > >> > *Subject:* [Csnd] Re: Re: Re: Re: Re: Re: can't import csnd from > python > >> > > >> > Thanks Mike, > >> > > >> > I tried and still no luck. The libraries are located in > /usr/local/lib > >> > and /usr/lib/python2.5/site-packages > >> > > >> > This are all the libs: > >> > /usr/local/lib/libcsladspa.so > >> > /usr/local/lib/libcsnd.so.5.1 > >> > /usr/local/lib/libcsound64.a > >> > /usr/local/lib/tclcsound.so > >> > > >> > And in Python: > >> > /usr/lib/python2.5/site-packages/_csnd.so > >> > /usr/lib/python2.5/site-packages/_loris.so > >> > /usr/lib/python2.5/site-packages/csnd.py > >> > /usr/lib/python2.5/site-packages/loris.py > >> > > >> > But then: > >> > $ export PYTHONPATH=/usr/local/lib:/usr/lib/python2.5/site-packages > >> > $ export > LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/python2.5/site-packages > >> > $ python > >> > Python 2.5 (r25:51908, Oct 19 2007, 09:47:40) > >> > [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 > >> > Type "help", "copyright", "credits" or "license" for more > information. > >> > >>> import csnd > >> > Traceback (most recent call last): > >> > File "", line 1, in > >> > File "/usr/lib/python2.5/site-packages/csnd.py", line 7, in > > >> > import _csnd > >> > ImportError: /usr/lib/python2.5/site-packages/_csnd.so: undefined > >> > symbol: csoundSetKillXYinCallback > >> > > >> > > >> > Regards, > >> > > >> > Hector > >> > > >> > > >> > On Nov 5, 2007 9:53 PM, Michael Gogins wrote: > >> > > >> > > This doesn't change what I'm saying (in my slightly earlier > >> > > response). _csnd.so corresponds to _csnd.pyd, and > libcsnd.so.5.1corresponds to > >> > > csnd.dll. > >> > > > >> > > Regards, > >> > > Mike > >> > > > >> > > ----- Original Message ----- > >> > > *From:* Hector Centeno > >> > > *To:* csound@lists.bath.ac.uk > >> > > *Sent:* Monday, November 05, 2007 8:52 PM > >> > > *Subject:* [Csnd] Re: Re: Re: Re: can't import csnd from python > >> > > > >> > > Sorry, I made a mistake and repeated two times the same > information, > >> > > this is what I intended: > >> > > > >> > > $ nm /usr/local/lib/libcsound64.a | grep csoundSetKillXYinCallback > >> > > 00000740 T csoundSetKillXYinCallback > >> > > > >> > > $ nm /usr/lib/python2.5/site-packages/_csnd.so | grep > >> > > csoundSetKillXYinCallback > >> > > U csoundSetKillXYinCallback > >> > > > >> > > $ nm /usr/local/lib/libcsnd.so.5.1 | grep csoundSetKillXYinCallback > >> > > 000f57d0 T csoundSetKillXYinCallback > >> > > > >> > > ... and ldd: > >> > > > >> > > $ ldd /usr/lib/python2.5/site-packages/_csnd.so > >> > > linux-gate.so.1 => (0xb7f4d000) > >> > > libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 > >> > > (0xb7d45000) > >> > > liblua-5.1.so => /usr/lib/liblua-5.1.so (0xb7d1b000) > >> > > libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7c30000) > >> > > libutil.so.1 => /lib/libutil.so.1 (0xb7c2c000) > >> > > libsndfile.so.1 => /usr/lib/libsndfile.so.1 (0xb7bcc000) > >> > > libdl.so.2 => /lib/libdl.so.2 (0xb7bc7000) > >> > > libpthread.so.0 => /lib/libpthread.so.0 (0xb7baf000) > >> > > libm.so.6 => /lib/libm.so.6 (0xb7b86000) > >> > > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7b7a000) > >> > > libc.so.6 => /lib/libc.so.6 (0xb7a26000) > >> > > /lib/ld-linux.so.2 (0x80000000) > >> > > > >> > > $ ldd /usr/local/lib/libcsnd.so.5.1 > >> > > linux-gate.so.1 => (0xb7f0c000) > >> > > libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 > >> > > (0xb7c55000) > >> > > liblua-5.1.so => /usr/lib/liblua-5.1.so (0xb7c2b000) > >> > > libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7b40000) > >> > > libutil.so.1 => /lib/libutil.so.1 (0xb7b3c000) > >> > > libsndfile.so.1 => /usr/lib/libsndfile.so.1 (0xb7adc000) > >> > > libdl.so.2 => /lib/libdl.so.2 (0xb7ad7000) > >> > > libpthread.so.0 => /lib/libpthread.so.0 (0xb7abf000) > >> > > libm.so.6 => /lib/libm.so.6 (0xb7a96000) > >> > > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7a8a000) > >> > > libc.so.6 => /lib/libc.so.6 (0xb7936000) > >> > > /lib/ld-linux.so.2 (0x80000000) > >> > > > >> > > > >> > > On Nov 5, 2007 8:42 PM, Hector Centeno < hcengar@gmail.com> wrote: > >> > > > >> > > > Thanks John for your response. > >> > > > > >> > > > Sorry, I'm not sure which ones are those correct files. I did a > nm > >> > > > in some of the libraries and got this: > >> > > > > >> > > > $ nm /usr/lib/python2.5/site-packages/_csnd.so | grep > >> > > > csoundSetKillXYinCallback > >> > > > U csoundSetKillXYinCallback > >> > > > > >> > > > $ nm /usr/local/lib/libcsnd.so.5.1 | grep > csoundSetKillXYinCallback > >> > > > 000f57d0 T csoundSetKillXYinCallback > >> > > > > >> > > > $ nm /usr/local/lib/libcsnd.so.5.1 | grep > csoundSetKillXYinCallback > >> > > > 000f57d0 T csoundSetKillXYinCallback > >> > > > > >> > > > ... and ldd: > >> > > > > >> > > > $ ldd /usr/lib/python2.5/site-packages/_csnd.so > >> > > > linux-gate.so.1 => (0xb7f4d000) > >> > > > libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 > >> > > > (0xb7d45000) > >> > > > liblua-5.1.so => /usr/lib/liblua-5.1.so (0xb7d1b000) > >> > > > libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7c30000) > >> > > > libutil.so.1 => /lib/libutil.so.1 (0xb7c2c000) > >> > > > libsndfile.so.1 => /usr/lib/libsndfile.so.1 (0xb7bcc000) > >> > > > libdl.so.2 => /lib/libdl.so.2 (0xb7bc7000) > >> > > > libpthread.so.0 => /lib/libpthread.so.0 (0xb7baf000) > >> > > > libm.so.6 => /lib/libm.so.6 (0xb7b86000) > >> > > > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7b7a000) > >> > > > libc.so.6 => /lib/libc.so.6 (0xb7a26000) > >> > > > /lib/ld-linux.so.2 (0x80000000) > >> > > > > >> > > > $ ldd /usr/local/lib/libcsnd.so.5.1 > >> > > > linux-gate.so.1 => (0xb7f0c000) > >> > > > libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 > >> > > > (0xb7c55000) > >> > > > liblua-5.1.so => /usr/lib/liblua-5.1.so (0xb7c2b000) > >> > > > libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7b40000) > >> > > > libutil.so.1 => /lib/libutil.so.1 (0xb7b3c000) > >> > > > libsndfile.so.1 => /usr/lib/libsndfile.so.1 (0xb7adc000) > >> > > > libdl.so.2 => /lib/libdl.so.2 (0xb7ad7000) > >> > > > libpthread.so.0 => /lib/libpthread.so.0 (0xb7abf000) > >> > > > libm.so.6 => /lib/libm.so.6 (0xb7a96000) > >> > > > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7a8a000) > >> > > > libc.so.6 => /lib/libc.so.6 (0xb7936000) > >> > > > /lib/ld-linux.so.2 (0x80000000) > >> > > > > >> > > > Is this information any useful? > >> > > > > >> > > > > >> > > > Thanks! > >> > > > > >> > > > > >> > > > Hector > >> > > > > >> > > > > >> > > > > >> > > > On Nov 5, 2007 12:12 PM, wrote: > >> > > > > >> > > > > > >> > > > > > >> > > > > On Mon, 5 Nov 2007, Hector Centeno wrote: > >> > > > > > >> > > > > > > > > >> > > > > > > >$ python > >> > > > > > > >Python 2.5 (r25:51908, Oct 19 2007, 09:47:40) > >> > > > > > > >[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 > >> > > > > > > >Type "help", "copyright", "credits" or "license" for more > >> > > > > information. > >> > > > > > > > >>> import csnd > >> > > > > > > >Traceback (most recent call last): > >> > > > > > > > File "", line 1, in > >> > > > > > > > File "/usr/lib/python2.5/site-packages/csnd.py", line > 7, > >> > > > > in > >> > > > > > > > import _csnd > >> > > > > > > >ImportError: /usr/lib/python2.5/site-packages/_csnd.so: > >> > > > > undefined symbol: > >> > > > > > > >csoundSetKillXYinCallback > >> > > > > > > > > >> > > > > > > > > >> > > > > > >> > > > > I do not use python, but I do know that > csoundSetKillXYinCallback > >> > > > > is defined in Top/csound.c so use of nm and ldd on the correct > >> > > > > files might > >> > > > > say where it has gone > >> > > > > > >> > > > > ==John > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > > > > >