libmm-glib.la: file not recognized: File format not recognized

Ali Nematollahi alirezan1 at gmail.com
Tue Mar 29 17:34:51 UTC 2016


Hi guys

I'm writing a simple C code to interface to MM to be able to read some
stats. I'm following the mmcli examples as was suggested earlier.

All I'm currently reading is mm_modem_get_manufacturer (ctx->modem); so
nothing complex.

I have the following headers:

#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <locale.h>

#define _LIBMM_INSIDE_MMCLI

#include <glib.h>
#include <gio/gio.h>

#include <libmm-glib/libmm-glib.h>
#include "../libmm-glib/mm-modem.h"

#include "mmcli.h"
#include "mmcli-common.h"

I have a simple Makefile for it too:
CC=gcc

top_build_prefix = ../
top_builddir = ..
top_srcdir = ..
MMCLI_CFLAGS = -pthread -I/usr/include/glib-2.0
-I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/gio-unix-2.0/
CFLAGS= \
        $(MMCLI_CFLAGS) \
        -I$(top_srcdir) \
        -I$(top_srcdir)/include \
        -I$(top_builddir)/include \
        -I$(top_srcdir)/libmm-glib \
        -I${top_srcdir}/libmm-glib/generated \
        -I${top_builddir}/libmm-glib/generated

MMCLI_LIBS = -lgio-2.0 -lgobject-2.0 -lglib-2.0

LDFLAGS=$(MMCLI_LIBS) \
        $(top_builddir)/libmm-glib/libmm-glib.la



all: ali

build: ali.o
        $(CC) ali.o -o ali

ali.o: ali.c
        $(CC) $(CFLAGS) $(LDFLAGS) $(MMCLI_LIBS) ali.c

clean:
        rm *o ali


The code is placed in cli/ alongside mmcli source codes.

When I build it with the makefile I get the following error:
root at beaglebone:~/MM/ModemManager-1.4.12/cli# make -f aliMake
gcc -pthread -I/usr/include/glib-2.0
-I/usr/lib/arm-linux-gnueabihf/glib-2.0/include
-I/usr/include/gio-unix-2.0/ -I.. -I../include -I../include -I../libmm-glib
-I../libmm-glib/generated -I../libmm-glib/generated -lgio-2.0 -lgobject-2.0
-lglib-2.0 ../libmm-glib/libmm-glib.la -lgio-2.0 -lgobject-2.0 -lglib-2.0
ali.c
../libmm-glib/libmm-glib.la: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make: *** [ali.o] Error 1


But when I make mmcli it compiles fine.

What am I doing wrong/missing?
Thanks for your help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20160329/fefc9958/attachment.html>


More information about the ModemManager-devel mailing list