Packager and detectionof *.so files

G’day folks,

I am new to using packager but have been trying to build a package. I have
printed off the packager articles etc. My problem is that I am building a
package that includes shared object libraries. According to the
documentation, packager is clever enough to detect that my execrutables
require .so files and adds the correct “required” tags to the .qpm file. For
some reason it isn’t clever enough to add the <QPM:Contains Library> tag
for each .so that gets built into the package.
Firstly is this the right forum for this question.
Secondly, anyone have any ideas ? I thought it may be because my .so files
were in a non-standard location in ‘basedir’ or similar.

Thanks in advance

Matt McHugh

Hi,

I had the exact same problem as you…

Here is what I have done.

First, read these files:
http://qdn.qnx.com/articles/aug2701/index.html
http://qdn.qnx.com/articles/sep1401/index.html


The problem is (probably) that you have .so files which are shared objects.
Packager considers .so files to be type DLL by default, so the proper tags
are not added to the package. Packager expects any shared objects to be
.so. (ie: libc.so.2). Having said that, there is a way to override this
behaviour…


Second, modify your qpg file :


This is how .so file are define in your qpg
<QPG:Add file="/usr/lib/liblla.so" install="/usr/lib/"/>

This is how it should be…
<QPG:Add file="/mysource/usr/lib/liblla.so" install="/usr/lib/"
filetype=“so”/>

(1) Note that I pointed all source files to /mysource
The files can be located anywhere on your hard drive, so you don’t have to
build up the directory structure before packaging. Just change to QPG to
point to the actual file locations in the file=" " field, and change the
install=" " field to the location where they are to show up when they are
installed. Note that the file=" " field will also accept wildcards (ie:
lib/package/nto//a/*.a).




Third, Verify the soname of your libraries :


objdump -x yourLib.so | grep SONAME

That should show the SONAME that packager is putting into the manifest for
that library. Then could you also send the QPM files that are generated?

Packager depends on that SONAME being in the elf-header of your libraries.

If you are building your libs using our standard makefile structure, and you
use the ‘so’ variant, make will automatically put in the SONAME which is
needed for your library and there will be no further action necessary.

But since it’s not there, you must be building it differently. If you’re
building from custom makefiles, you will have to add the following:

-Wl,hyour_soname

where ‘your_soname’ will be yourLib.so or whatever .so you’re building
at the time. Once built, try the objdump -x on it again to make sure the
SONAME is in fact in the header. Then you can try packager again!

I hope this is clear enough for you.



I do not take credit for this information, Mr Jerry Chappell from QNX has
helped me resolving this issue.
He is the brain behind all this info (and the packager itself ). I just
want to save him some precious time as a
reward for his precious help.


Here is another solution :

Once the packages are created, edit the generated QPM files by hand, and
remove the lines which have QPM:RequiresLibrary where it references
libraries which are in your project. By doing this, the installer will have
no problem resolving dependencies. When you go back into pkg-installer, it
may show your packages as unsatisfied; this won’t affect their operation,
but the only way to fix that is to also remove the QPM:RequiresLibrary
lines from the MANIFEST files which are inside the QPKs. So you could
decompress the QPK (tar -zxvf mypkg.qpk), edit the MANIFEST file, and then
tar up the QPK again (tar -zcvf mypkg.qpk extraction_directory).

Obviously, it’s not an elegant solution, but it will work for you.


I hope this will solve your problem…

Regards


Éric Paiement
New Product Introduction
Technical Support
Solutions mindready Inc.

“matt mchugh” <mattgreeneggswithspam@ruzz.com> wrote in message
news:ab9v0p$g9q$1@inn.qnx.com

G’day folks,

I am new to using packager but have been trying to build a package. I have
printed off the packager articles etc. My problem is that I am building a
package that includes shared object libraries. According to the
documentation, packager is clever enough to detect that my execrutables
require .so files and adds the correct “required” tags to the .qpm file.
For
some reason it isn’t clever enough to add the <QPM:Contains Library> tag
for each .so that gets built into the package.
Firstly is this the right forum for this question.
Secondly, anyone have any ideas ? I thought it may be because my .so files
were in a non-standard location in ‘basedir’ or similar.

Thanks in advance

Matt McHugh

G’day Eric,

Thanks mate, that was an excellent reponse and got me out of trouble.

The only thing that didn’t work was that we had to pass the “hlib($LIB)” a
minus sign
ie Wl,-hlibBLAH


Cheers Matt
“Eric Paiement” <eric.paiement@mindready.com> wrote in message
news:abdsni$f0r$1@inn.qnx.com

Hi,

I had the exact same problem as you…

Here is what I have done.

First, read these files:
http://qdn.qnx.com/articles/aug2701/index.html
http://qdn.qnx.com/articles/sep1401/index.html


The problem is (probably) that you have .so files which are shared
objects.
Packager considers .so files to be type DLL by default, so the proper tags
are not added to the package. Packager expects any shared objects to be
.so. (ie: libc.so.2). Having said that, there is a way to override this
behaviour…


Second, modify your qpg file :


This is how .so file are define in your qpg
QPG:Add file="/usr/lib/liblla.so" install="/usr/lib/"/

This is how it should be…
QPG:Add file="/mysource/usr/lib/liblla.so" install="/usr/lib/"
filetype=“so”/

(1) Note that I pointed all source files to /mysource
The files can be located anywhere on your hard drive, so you don’t have
to
build up the directory structure before packaging. Just change to QPG to
point to the actual file locations in the file=" " field, and change the
install=" " field to the location where they are to show up when they are
installed. Note that the file=" " field will also accept wildcards (ie:
lib/package/nto//a/*.a).




Third, Verify the soname of your libraries :


objdump -x yourLib.so | grep SONAME

That should show the SONAME that packager is putting into the manifest for
that library. Then could you also send the QPM files that are generated?

Packager depends on that SONAME being in the elf-header of your libraries.

If you are building your libs using our standard makefile structure, and
you
use the ‘so’ variant, make will automatically put in the SONAME which is
needed for your library and there will be no further action necessary.

But since it’s not there, you must be building it differently. If you’re
building from custom makefiles, you will have to add the following:

-Wl,hyour_soname

where ‘your_soname’ will be yourLib.so or whatever .so you’re building
at the time. Once built, try the objdump -x on it again to make sure the
SONAME is in fact in the header. Then you can try packager again!

I hope this is clear enough for you.



I do not take credit for this information, Mr Jerry Chappell from QNX has
helped me resolving this issue.
He is the brain behind all this info (and the packager itself ). I just
want to save him some precious time as a
reward for his precious help.


Here is another solution :

Once the packages are created, edit the generated QPM files by hand, and
remove the lines which have QPM:RequiresLibrary where it references
libraries which are in your project. By doing this, the installer will
have
no problem resolving dependencies. When you go back into pkg-installer, it
may show your packages as unsatisfied; this won’t affect their operation,
but the only way to fix that is to also remove the <QPM:RequiresLibrary
lines from the MANIFEST files which are inside the QPKs. So you could
decompress the QPK (tar -zxvf mypkg.qpk), edit the MANIFEST file, and then
tar up the QPK again (tar -zcvf mypkg.qpk extraction_directory).

Obviously, it’s not an elegant solution, but it will work for you.


I hope this will solve your problem…

Regards


Éric Paiement
New Product Introduction
Technical Support
Solutions mindready Inc.

“matt mchugh” <> mattgreeneggswithspam@ruzz.com> > wrote in message
news:ab9v0p$g9q$> 1@inn.qnx.com> …
G’day folks,

I am new to using packager but have been trying to build a package. I
have
printed off the packager articles etc. My problem is that I am building
a
package that includes shared object libraries. According to the
documentation, packager is clever enough to detect that my execrutables
require .so files and adds the correct “required” tags to the .qpm file.
For
some reason it isn’t clever enough to add the <QPM:Contains Library
tag
for each .so that gets built into the package.
Firstly is this the right forum for this question.
Secondly, anyone have any ideas ? I thought it may be because my .so
files
were in a non-standard location in ‘basedir’ or similar.

Thanks in advance

Matt McHugh

\