Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-08-2005, 09:34 AM   #1
Senior Member
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,506

Rep: Reputation: 100Reputation: 100
Impossible to use autotools to compile a MySQL client program?

Hi all,

I have the following

bin_PROGRAMS = editor
editor_SUBDIRS = . src/editor
editor_SOURCES = editor.c editor.h
editor_LDFLAGS = `allegro-config --libs` `mysql_config --libs`
editor_CFLAGS = `allegro-config --cflags` `mysql_config --cflags`

This absolutely refuses to compile - running the eventually resulting makefile results in

If gcc -DHAVE_CONFIG_H -I. -I. -I../.. `allegro-config --cflags` `mysql_config --cflags` -g -O2 -MT editor-editor.o -MD -MP -MF ".deps/editor-editor.Tpo" -c -o editor-editor.o `test -f 'editor.c' || echo './'`editor.c; \
then mv -f ".deps/editor-editor.Tpo" ".deps/editor-editor.Po"; else rm -f ".deps/editor-editor.Tpo"; exit 1; fi
gcc -g -O2 -o editor `allegro-config --libs` `mysql_config --libs` editor-editor.o
editor-editor.o(.text+0xaa): In function `main':
/home/rylan/c/supreme-1.0/src/editor/editor.c:14: undefined reference to `mysql_init'
editor-editor.o(.text+0x165):/home/rylan/c/supreme-1.0/src/editor/editor.c:27: undefined reference to `mysql_close'
collect2: ld returned 1 exit status
make[2]: *** [editor] Error 1

However, doing

gcc -o editor editor.c `allegro-config --cflags` `mysql_config --cflags` `allegro-config --libs` `mysql_config --libs`

works perfectly...

How can I get autotools to allow projects to be compiled with the MySQL client library? Why does `allegro-config --libs` work, but NOT `mysql_config --libs`?

Why does autotools create an editor-editor.o file, instead of an editor.o file (like when you run gcc -o editor editor.c `allegro-config --cflags` `mysql_config --cflags` `allegro-config --libs` `mysql_config --libs` manually?)

Is there any way to force autotools to link and compile in one step, instead of two, since it somehow seems that the editor-editor.o file produced in autofools two-step approach is unlinkable with libmysqlclient.a???

ANY help appreciated - hours and hours spent on this with zero results...



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot compile my program anymore (autotools, gnu make) sterrenkijker Programming 5 07-27-2006 05:52 AM
Compiling this 3-line long program impossible in all IDE's seriesx4 Programming 2 08-10-2005 06:29 PM
Getting Port on which client is listning from the client program. rasanth Programming 2 10-26-2004 12:23 PM
compile the socket server for the client cool hat Linux - Software 0 06-19-2004 02:23 PM
Redhat 9's autotools broken for apache, mysql, php? rylan76 Linux - Software 0 04-15-2004 04:48 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:47 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration