A PCRE internal error occured. This might be caused by a faulty plugin

====== Structure ===== Package to be build resides in ''carambola/package'' ~/carambola/package/hello/ │ Makefile │ └───src main.c Makefile ====== Makefile ====== include $(TOPDIR)/rules.mk PKG_NAME:=hello PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(INCLUDE_DIR)/package.mk define Package/hello SECTION:=utils CATEGORY:=Utilities TITLE:=Simple program to read/write from memory. endef define Package/hello/description Simple program to read/write from/to any location in memory. endef define Build/Prepare mkdir -p $(PKG_BUILD_DIR) $(CP) ./src/* $(PKG_BUILD_DIR)/ endef define Package/hello/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/hello $(1)/usr/sbin/hello endef $(eval $(call BuildPackage,hello)) ====== src/Makefile ====== OBJ = main.o CFLAGS += -I $(STAGING_DIR)/usr/include LDFLAGS += -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz all: compile %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< compile: $(OBJ) $(CC) -o hello $(LDFLAGS) $(OBJ) clean: rm -f *.o *.so hello ====== src/main.c ====== Source was taken from: [[http://www.cyberciti.biz/tips/linux-unix-connect-mysql-c-api-program.html|this]] web page. #include <mysql/mysql.h> #include <stdio.h> main() { MYSQL *conn; MYSQL_RES *res; MYSQL_ROW row; char *server = "localhost"; char *user = "root"; char *password = "PASSWORD"; /* set me first */ char *database = "mysql"; conn = mysql_init(NULL); /* Connect to database */ if (!mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) { fprintf(stderr, "%s\n", mysql_error(conn)); exit(1); } /* send SQL query */ if (mysql_query(conn, "show tables")) { fprintf(stderr, "%s\n", mysql_error(conn)); exit(1); } res = mysql_use_result(conn); /* output table name */ printf("MySQL Tables in mysql database:\n"); while ((row = mysql_fetch_row(res)) != NULL) printf("%s \n", row[0]); /* close connection */ mysql_free_result(res); mysql_close(conn); } ====== MySQL ====== Connect to MySQL server from other machine to test if it works as expected mysql -u root -h 192.168.0.111 or mysql -u root -h 192.168.0.111 -p if using password for mysql * you should see ''mysql>'' prompt * type: show databases; to test. If you have started your own mysql server (like [[http://xampp.en.softonic.com/|xampp]]) you should enable remote access by querying: GRANT ALL PRIVILEGES ON *.* TO root; Please note: it is higly not recommended to enable these privileges. It is good only for testing purposes. You should connect from same computer where mysql is running. ====== Building ====== * copy your test project to ''carambola/package/hello/'' cd carambola/package ln -s ../../packages.git/libs/uclibc++/ ln -s ../../packages.git/libs/mysql/ cd ../ make menuconfig * select: Libraries/libmysqlclient * select: Libraries/uvlibcxx (should be selected automatically) * select: Utils/hello make * Later, if you want to build only specific package and save some time: make package/hello/compile V=99 ====== Install/Run on carambola ====== * If you flash newly build image, you do not need to do anything else, however if you did not, install couple of libraries to carambola. opkg install uclibcxx_0.2.2-3_ramips.ipk opkg install libmysqlclient_5.1.53-3_ramips.ipk * Copy our fresh package to /tmp using [[carambola_scp|scp]] * Install newly build package: opkg install /tmp/hello_1_ramips.ipk * type ''hello'' to see result. * If you want to build this same project on regular PC you can type: gcc -o output-file $(mysql_config –cflags) mysql-c-api.c $(mysql_config –libs)

Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki