Modem manager plugins linking issue - cross compilation

Kulenda, Vit vit.kulenda at yunextraffic.com
Wed Nov 17 13:39:44 UTC 2021


Hi Aleksander,

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
ModemManager[6746]: <warn>  [1637075895.608001] [plugin-manager] could not load shared '/usr/local/lib/ModemManager/libmm-shared-icera.so': /usr/local/lib/ModemManager/libmm-shared-icera.so: undefined symbol: mm_bearer_connect_result_unref
ModemManager[6746]: <warn>  [1637075895.608675] [plugin-manager] could not load shared '/usr/local/lib/ModemManager/libmm-shared-novatel.so': /usr/local/lib/ModemManager/libmm-shared-novatel.so: undefined symbol: qcdm_cmd_nw_subsys_modem_snapshot_cdma_new
ModemManager[6746]: <warn>  [1637075895.608997] [plugin-manager] could not load shared '/usr/local/lib/ModemManager/libmm-shared-foxconn.so': /usr/local/lib/ModemManager/libmm-shared-foxconn.so: undefined symbol: mm_iface_modem_location_get_type
ModemManager[6746]: <warn>  [1637075895.609705] [plugin-manager] could not load shared '/usr/local/lib/ModemManager/libmm-shared-option.so': /usr/local/lib/ModemManager/libmm-shared-option.so: undefined symbol: mm_base_sim_export

There are much more, I've attached file.

I built ModemManager on one machine for my device - cross compilation. Build is successful. I've checked compile log and there are no errors only few warnings, which looks not critical for me.

	Line 664: libtool: warning: remember to run 'libtool --finish /lib64'
	Line 773: libtool: warning: '../libmm-glib/libmm-glib.la' has not been installed in '/lib64'
	Line 774: libtool: warning: '/home/z003scbe/Repositories/hlc-os-modemmanager/build/ModemManager/build/libmm-glib/libmm-glib.la' has not been installed in '/lib64'
	Line 1135: libtool: warning: remember to run 'libtool --finish /lib64/ModemManager'
	Line 1167: libtool: warning: '../libmm-glib/libmm-glib.la' has not been installed in '/lib64'

I built latest ModemManager 1.18.2 with Autotools (make) with following dependencies:

Glib - 2.68.2
libmbim - 1.26.0
libqmi - 1.30.2
libgudev - 236
dbus - 1.12.20
systemd - 248
zlib - 1.2.5

Mentioned dependencies have been cross compiled as well before they are referenced during modem manager build. I am not sure it will help when I provide part of Makefile.

REAL_GNU_TARGET_NAME = x86_64 -siemens-linux-gnu
GLIB_CFLAGS:=-I$(REPOSITORY_DIR)/glib/target/include -I$(REPOSITORY_DIR)/glib/target/include/glib-2.0 -I$(REPOSITORY_DIR)/glib/target/lib64/glib-2.0/include/ -I$(REPOSITORY_DIR)/glib/target/include/gio-unix-2.0
GLIB_LIBS:=-L$(REPOSITORY_DIR)/glib/target/lib64 -lglib-2.0 -lgobject-2.0 -lgio-2.0 -lgthread-2.0 -lgmodule-2.0 -lffi

		CC=$(REAL_GNU_TARGET_NAME)-gcc \
		LD=$(REAL_GNU_TARGET_NAME)-ld \
		AR=$(REAL_GNU_TARGET_NAME)-ar \
		PKG_CONFIG_PATH="$(REPOSITORY_DIR)/glib/target/lib64/pkgconfig" \
		MM_CFLAGS="$(GLIB_CFLAGS) -I$(REPOSITORY_DIR)/zlib/target/include" \
		MM_LIBS="$(GLIB_LIBS) -L$(REPOSITORY_DIR)/zlib/target/lib64 -lz" \
		LIBMM_GLIB_CFLAGS="$(GLIB_CFLAGS) -I$(REPOSITORY_DIR)/zlib/target/include" \
		LIBMM_GLIB_LIBS="$(GLIB_LIBS) -L$(REPOSITORY_DIR)/zlib/target/lib64 -lz" \
		MMCLI_CFLAGS="$(GLIB_CFLAGS) -I$(REPOSITORY_DIR)/zlib/target/include" \
		MMCLI_LIBS="$(GLIB_LIBS) -L$(REPOSITORY_DIR)/zlib/target/lib64 -lz" \
		MBIM_CFLAGS="-I$(REPOSITORY_DIR)/libmbim/target/include/libmbim-glib" \
		MBIM_LIBS="-L$(REPOSITORY_DIR)/libmbim/target/lib64 -lmbim-glib" \
		QMI_CFLAGS="-I$(REPOSITORY_DIR)/libqmi/target/include/libqmi-glib" \
		QMI_LIBS="-L$(REPOSITORY_DIR)/libqmi/target/lib64 -lqmi-glib" \
	        	GUDEV_CFLAGS="-I$(REPOSITORY_DIR)/libgudev/target/include/gudev-1.0 -I$(REPOSITORY_DIR)/glib/target/include/glib-2.0/ -I$(REPOSITORY_DIR)/glib/target/lib64/glib-2.0/include/" \
		GUDEV_LIBS="-L$(REPOSITORY_DIR)/libgudev/target/lib64 -L$(REPOSITORY_DIR)/systemd/target/usr/lib64 -L$(REPOSITORY_DIR)/glib/target/lib64 -lglib-2.0 -lgobject-2.0 -lffi -lgudev-1.0 -ludev" \
		$(MODEMMANAGER_DIR)/configure \
			--target=$(REAL_GNU_TARGET_NAME) \
			--host=$(REAL_GNU_TARGET_NAME) \
			--prefix=/ \
			--libdir=/lib64 \

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.

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

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

When I checked code this function is defined in:
ModemManager-1.18.2\src\mm-base-sim.c
ModemManager-1.18.2\src\mm-base-sim.h

ldd /usr/local/lib/ModemManager/libmm-shared-option.so
        linux-vdso.so.1 (0x00007fff5d98f000)
        libc.so.6 => /lib/libc.so.6 (0x00007f2a1419e000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2a1475b000)

I also tried to set to build static libraries, but for that case ModemManager did not show any warning and said that no plugins have been found in /lib64/ModemManager/

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?


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.

By the way what is correct release folder, I found 2?
https://www.freedesktop.org/software/ModemManager/ - only tar.xz files, latest 1.18.2 archive does not contain meson.build
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/archive/1.18.2/ModemManager-1.18.2.tar.gz - includes meson.build
 

Thank you for any answer. Have a nice day

Best regards

Vit Kulenda
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: undefinedSymbols.txt
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20211117/c3ded709/attachment-0001.txt>


More information about the ModemManager-devel mailing list