Bonjour à tous,
Je travaille sur un projet en Python et C : les calculs bas niveau sont réalisés en C et l'orchestration se fait en Python. J'ai donc besoin de générer une librairie dynamique de mes sources C, afin de les utiliser en Python.
Cela marchait très bien jusqu'à ce que j'ajoute une mise en cache dans mon application qui utilise les HashTable de la librairie glib. Je n'arrive plus à écrire un makefile correct afin de compiler mes sources (j'ai testé une utilisation de fonctions de glib sur un petit exemple à coté (sans makefile donc), cela marche sans problème).
Voici mon makefile actuel (uniquement pour macos pour l'instant) :
Code makefile : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 CC=gcc ARCHFLAG=-arch i386 LFLAGS=`pkg-config --cflags --libs glib-2.0` CFLAGS=$(LFLAGS) -fpic EXEC=ltlsynthesis OBJS=antichain.o automaton.o backward_algorithm.o linked_list.o state.o bits.o tools.o cache.o ltlsynthesis.dylib: $(OBJS) $(CC) $(ARCHFLAG) -dynamiclib -o $@ $^ $(LFLAGS) antichain.o: constants.h linked_list.o automaton.o: bits.h constants.h linked_list.h tools.h backward_algorithm.o: constants.h linked_list.h automaton.h state.h antichain.h bits.h linked_list.o: constants.h state.o: tools.h constants.h automaton.h bits.h linked_list.h tools.o : constants.h cache.o : state.h %.o: %.c $(CC) $(ARCHFLAG) -o $@ $(CFLAGS) -c $< clean: rm -f *.so *.dylib *.o *.tab.* *.yy.* install: ltlsynthesis.dylib cp ltlsynthesis.dylib ../
En réalité, seul le fichier cache.c utilise glib. J'obtiens ce message quand je fais make install :
Quelqu'un peut-il m'aider? J'ai déjà retourné le makefile dans tous les sens, pas moyen de générer ma dylib (j'ai besoin qu'elle soit en i386).gcc -arch i386 -o linked_list.o `pkg-config --cflags --libs glib-2.0` -fpic -c linked_list.c
i686-apple-darwin10-gcc-4.2.1: -lglib-2.0: linker input file unused because linking not done
i686-apple-darwin10-gcc-4.2.1: -lintl: linker input file unused because linking not done
gcc -arch i386 -o antichain.o `pkg-config --cflags --libs glib-2.0` -fpic -c antichain.c
i686-apple-darwin10-gcc-4.2.1: -lglib-2.0: linker input file unused because linking not done
i686-apple-darwin10-gcc-4.2.1: -lintl: linker input file unused because linking not done
(...) idem pour chaque fichier source (...)
ld: warning: in /opt/local/lib/libglib-2.0.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libintl.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
"_g_hash_table_new", referenced from:
_initialize_cache in cache.o
"_g_hash_table_destroy", referenced from:
_destroy_cache in cache.o
"_g_hash_table_insert", referenced from:
_add_to_cache in cache.o
"_g_hash_table_remove_all", referenced from:
_clean_cache in cache.o
"_g_hash_table_lookup", referenced from:
_get_from_cache in cache.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [ltlsynthesis.dylib] Error 1
D'avance merci.
Naked
Partager