Modem manager plugins linking issue - cross compilation

Aleksander Morgado aleksander at aleksander.es
Wed Nov 17 15:38:39 UTC 2021


Hey,


> thanks for previous response. I've built DBUS and added to my device and warning disappeared. Unfortunately, I have another issue, I cannot run ModemManager, because there are undefined symbols during plugin load e.g.:
>
> ModemManager[6746]: <debug> [1637075895.604641] [filter]       cdc-acm interface check:  yes
> ModemManager[6746]: <debug> [1637075895.604753] [filter]       with net check:           yes
> ModemManager[6746]: <debug> [1637075895.604881] [filter]       default:                  forbidden
> ModemManager[6746]: <debug> [1637075895.605736] [plugin-manager] looking for plugins in '/usr/local/lib/ModemManager'
> ModemManager[6746]: <warn>  [1637075895.606914] [plugin-manager] could not load shared '/usr/local/lib/ModemManager/libmm-shared-xmm.so': /usr/local/lib/ModemManager/libmm-shared-xmm.so: undefined symbol: mm_base_modem_peek_port_primary

You'll need to go deep and investigate why, but this looks like
something specific to your build I'm afraid. See this
https://newbedev.com/undefined-symbol-when-trying-to-load-a-library-with-dlopen
and go on from there.

> Then make and make install is called afterwards. Compilation is successful. I checked issues related to undefined symbols in ModemManager git web sites but I did not find any solution for me. One proposal says to check/change prefix, libdir to /usr/. I tried more prefixes, even without prefix, but it still says undefined symbol for plugins.
>

I was going to say, prefix / is a bit weird, much better to use the
more standard /usr as prefix. But that's also unrelated here; your
problem is that the plugin that is being dynamically loaded with
dlopen() is not seeing the ModemManager binary's symbols.

> Call example:  # LD_LIBRARY_PATH=/usr/local/lib /usr/local/sbin/ModemManager --debug - did not solve issue
>

That's unrelated.

> I've checked plugins .so files with nm command and ldd. Ldd does not contain any not found reference. Missing symbol is marked as undefined in plugin.so:
> # nm build/ModemManager/target/lib64/ModemManager/libmm-shared-option.so | grep mm_base_sim_export
>                  U mm_base_sim_export
>
> I found that this symbol is defined in ModemManager binary:
> # nm build/ModemManager/target/sbin/ModemManager | grep mm_base_sim_export
> 00000000004500c0 T mm_base_sim_export
>

That looks fine to me. The plugin is saying it wants to use the method
(U) and the daemon is saying it has the method globally defined (T).
My host build has the same, btw:

aleksander at ares:~$ nm /usr/sbin/ModemManager | grep mm_base_sim_export
000000000006f930 T mm_base_sim_export

aleksander at ares:~$ nm /usr/lib/ModemManager/libmm-shared-option.so |
grep mm_base_sim_export
                 U mm_base_sim_export

>
> Seems it is linking issue and I have not found root cause. Do you have any idea/hint which can help and I can move forward?
>

Try to google other similar cases, where loading a plugin with
dlopen() fails with "undefined symbol" errors.

>
> Another question. I've started to use meson instead of autotools for build, not successful build yet. It looks that it uses only pkgconfig, are there some variables which can override includes and libs without using pkgconfig - I tried -Dc_args and -D c_link_args but it did not find dependencies at all - failed in setup in beginning? With pkgconfig dependencies was found.
>

pkgconfig is required; we rely on too many things based on pkgconfig,
and finding workarounds to avoid needing it it's going to give more
headaches than just supporting pkgconfig :)

> By the way what is correct release folder, I found 2?

Too many unrelated questions in the same email...

> https://www.freedesktop.org/software/ModemManager/ - only tar.xz files, latest 1.18.2 archive does not contain meson.build

Official releases are in
https://www.freedesktop.org/software/ModemManager/ for now, and they
rely exclusively on autotools.

> https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/archive/1.18.2/ModemManager-1.18.2.tar.gz - includes meson.build

This is not a release, this is the tarball including the full checkout
of the git repository at a given tag. Once we move to meson only, I'll
stop doing releases in
https://www.freedesktop.org/software/ModemManager/ and rely
exclusively on signed git tags.

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list