fatal error: sqlite3.h: No such file or directory

I'm trying to build a C application through cross compiling for a Zynq board (ARM architecture). When I type make without mentioning the ARM arch, it works fine on my laptop. But as soon as I modify the Makefile, I get an error saying:

main.c:20:43: fatal error: sqlite3.h: No such file or directory
 #include "sqlite3.h" //library for sqlite3
compilation terminated.
make: *** [ws_temp_server] Error 1

The Makefile looks like this:

SOURCE=lib/base64_enc.c lib/websocket.c lib/sha1.c lib/sqlite/sqlite3.c main.c 
CC = arm-xilinx-linux-gnueabi-gcc
LDFLAGS=-lpthread -ldl

all: $(PROGRAM)

    rm $(PROGRAM)

What am I doing wrong? Thanks for any help I can get.


You don't provide enough information to say for sure: in particular, you don't say where the sqlite3.h file actually is on your filesystem. However, based on what you do show I suspect you need to change the INCLUDES variable, to this:

INCLUDES = lib/sqlite

(or else change the #include in your code to be #include "sqlite/sqlite3.h"). This is assuming that the header file is in the same directory as the sqlite3.c source file.

Note that this is a bad/confusing implementation. You should be putting the -I flag in the INCLUDES variable:

INCLUDES = -Ilib/sqlite

INCLUDES is plural which may lead someone to believe they could add multiple directories in that variable, but if you leave it the way you have it, this will cause strange compiler errors:

INCLUDES = lib/sqlite another/dir

will add the flags -Ilib/sqlite another/dir... note how the second directory doesn't have a -I option.

Of course, by convention you should be using CPPFLAGS (for C preprocessor flags), not INCLUDES, but... :)

I got this issue fixed with

$ sudo apt-get install libsqlite3-dev

(debian wheezy)

HTH Someone

Need Your Help

Initialise numpy array of unknown length

python arrays numpy

I want to be able to 'build' a numpy array on the fly, I do not know the size of this array in advance.

Query if Android database exists!

android database

I have created a database for my android app which contains static data and does not require update/delete functionality thus when the app starts, I want to check if the db exists and if not then e...