how do I get CLSQL to look for mysql.h in non-standard directory? - sql

in the error log:
CLSQL is doing:
gcc -I /usr/local/include/mysql -I /usr/include/mysql -I /sw/include/mysql -I /opt/local/include/mysql -I /usr/local/mysql/include -fPIC -c clsql_mysql.c -o clsql_mysql.o
and gets error:
clsql_mysql.c:34:19: mysql.h: No such file or directory
and a bunch of C errors because it doesn't include a header.
I want it to do:
gcc -I /usr/local/include/mysql -I /usr/include/mysql -I /sw/include/mysql -I /opt/local/include/mysql -I /usr/local/mysql/include <b>-I /usr/local/mysql/include/mysql</b> -fPIC -c clsql_mysql.c -o clsql_mysql.o
I tried running: (clsql:push-library-path #P"/usr/local/mysql/include/mysql/") already. Didn't work.
HALP!

check that file exists and no permissions problem by inserting #include with full name at the beginning of clsql_mysql.c file:
#include "/usr/local/mysql/include/mysql/mysql.h"
if compiles well - undo changes and resolve path provided by -I parameter
if doesn't compile and says "file does'nt exist" - check that file exists and no permission problems

I'm not familiar with CLSQL specifically, but if it uses cffi-grovel to generate that command, then prior to loading it you should try adding your "-I/usr/local/mysql/include/mysql/" to the cffi-grovel::*cc-flags* list. You could also add it in the asd file, as the grovel-file asdf component takes an optional cc-flags argument.

Related

string.h:29:8: error: expected identifier

I'm trying to compile nginx with custom openssl »libressl« using this script: https://gist.github.com/Belphemur/3c022598919e6a1788fc
Everything works fine using libressl 2.1.1.
Problem is that libressl 2.1.1 has some security issues, which have been resolved by newer releases.
However I can't get the build to work with libressl 2.1.2 or libressl 2.1.3 (latest version).
The issue I get:
..
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /tmp/build/pcre-8.36 -I /tmp/build/libressl-2.1.2/.openssl/include -I objs \
-o objs/src/core/nginx.o \
src/core/nginx.c
In file included from /usr/include/string.h:635:0,
from /tmp/build/libressl-2.1.2/.openssl/include/string.h:6,
from src/os/unix/ngx_linux_config.h:27,
from src/core/ngx_config.h:26,
from src/core/nginx.c:8:
/tmp/build/libressl-2.1.2/.openssl/include/string.h:29:8: error: expected identifier or ‘(’ before ‘__extension__’
char * strndup(const char *str, size_t maxlen);
^
make[1]: *** [objs/src/core/nginx.o] Error 1
make[1]: Leaving directory `/tmp/build/nginx-1.7.9'
make: *** [build] Error 2
All done.
..
What's the problem & how to resolve it?
Thanks for helping.
I'm the creator of the script you use to build Nginx with LibreSSL.
It is now corrected, the previous way to build and use libressl doesn't work with previous version of the script. (Simply copying all the include and stripping the lib)
The script now install libressl in a set directory and give it to nginx, this way, all the include not needed to use the library (like this string.h) is not part of the building process of nginx.
strndup is provided in string.h. You don't need to provide it here:
/tmp/build/libressl-2.1.2/.openssl/include/string.h:29:8: error: expected identifier or ‘(’ before ‘__extension__’
char * strndup(const char *str, size_t maxlen);
I would delete the copy of string.h from the sources, and use the platform's supplied string.h for strndup.
As a matter of fact, I don't know where that string.h is coming from because its not present on my system (and I regularly build and use the latest OpenSSL):
$ find /usr/local/ssl/ -name string.h
$ find /usr/local/ssl/ -name *.h
/usr/local/ssl/include/openssl/rc4.h
/usr/local/ssl/include/openssl/crypto.h
/usr/local/ssl/include/openssl/ts.h
/usr/local/ssl/include/openssl/ecdsa.h
/usr/local/ssl/include/openssl/opensslconf.h
...
I'm trying to compile nginx with custom openssl »libressl« using this script: https://gist.github.com/Belphemur/3c022598919e6a1788fc
OK, this can be a pain as I've had to do similar with nginx (FIPS validated OpenSSL).
The easiest way to handle it is build OpenSSL from sources and install it into /usr/local/ssl. Then, grep nginx's files for -lcrypto and -lssl. When you find them, replace them with the static archive of OpenSSL:
change -lcrypto to /usr/local/ssl/lib/libcrypto.a
change -lssl to /usr/local/ssl/lib/libssl.a
And drop the -L related to OpenSSL.
This will ensure you use your version of OpenSSL at compile time and run time without the need for LD_PRELOAD and DYLD_LIBRARY_PATH tricks. It will just always work.

Gtest file not found by g++

I run a code which needs gtest, but terminal shows:
'gtest/gtest.h' file not found
Here is the command:
$ g++ -w -I ../gtest/include/gtest -I../snap-core -I../glib-core -c run-all-tests.cpp
I think I add the path of gtest, but system did not find it.
You need to change
-I ../gtest/include/gtest
to
-I ../gtest/include/
because you are looking for the tile gtest/gtest.h, not gtest/gtest/gtest.h

Undocumented flag in CC

When compiling a file using a new version of Informix-4GL it launches the following command link the generated object into a executable.
cc -qchars=signed -D_H_LOCALEDEF -DASIAN -DAIX_43 -DAIX_53 -DUSE_PROTOTYPES \
-Dsigflag=ix_os_sigflag -DTERMINFO -bh:8 -s -brtl -DASIAN \
-qarch=com -qchars=signed -D_H_LOCALEDEF -DINFX_ANSI -DASIAN \
-s -DAIX_43 -DAIX_53 \
-o teste -s teste.o \
-lm -lbsd -lc_r -ldl -ltli_r -lm_r
If there are an undefined symbol, it gives an error, but generates the file teste, although without execution permission. This behaviour is different from the previous versions and it does not go well with make: if I do make 2 times, the first time it gives the undef error, but in the second time it does nothing, because the executable already exists.
If I take out the -bh:8 option, it works as before (does not generate the exec file).
Does anyone knows this option/flag: -bh:8 ? I could not find it in the cc documentaion.
I believe -bh is short for -bhalt, which specifies the maximum error level that is allowed before the linker command halts.

Unbound modules in OCaml

My problem is that ocamlc and ocamlopt apear to be refusing to find third party libraries installed through apt-get. I first started having this problem when I tried to incorporate third-party modules into my own OCaml programs, and quickly wrote it off as a personal failing in understanding OCaml compilation. Soon-- however-- I found myself running into the same problem when trying to compile other peoples projects under their own instructions.
Here is the most straight-forward example. The others all use ocamlbuild, which obfuscates things a little bit.
The program: http://groups.google.com/group/fa.caml/msg/5aee553df34548e2
The compilation:
$ocamlc -g -dtypes -pp camlp4oof -I +camlp4 dynlink.cma camlp4lib.cma -cc g++ llvm.cma llvm_bitwriter.cma minml.ml -o minml
File "minml.ml", line 43, characters 0-9:
Error:Unbound module Llvm
Even when I provide ocamlc with the obsolute paths to the llvm files, like so...
$ ocamlc -g -dtypes -pp camlp4oof -I +camlp4 dynlink.cma camlp4lib.cma -cc g++ /usr/lib/ocaml/llvm-2.7/llvm.cma /usr/lib/ocaml/llvm-2.7/llvm_bitwriter.cma minml.ml -o minml
... to no avail.
What am I doing wrong?
Your command is doing two things: it's compiling minml.ml (into minml.cmo), then linking the resulting object into minml.
Compiling a module requires the interfaces of the dependencies. The interfaces contain typing information that is necessary to both the type checker and the code generator; this information is not repeated in the implementation (.cma here). So for the compilation stage, llvm.cmi must be available. The compiler looks for it in the include path, so you need an additional -I +llvm-2.7 (which is short for -I /usr/lib/ocaml/llvm-2.7).
The linking stage requires llvm.cma, which contains the bytecode implementation of the module. Here, you can either use -I or give a full path to let ocamlc know where to find the file.
ocamlc -g -dtypes -I +camlp4 -I +llvm-2.7 -pp camlp4oof -c minml.ml
ocamlc -g -cc g++ -I +camlp4 -I +llvm-2.7 dynlink.cma camlp4lib.cma llvm.cma llvm_bitwriter.cma minml.cmo -o minml
or if you want to do both stages in a single command:
ocamlc -g -dtypes -cc g++ -I +camlp4 -I +llvm-2.7 dynlink.cma camlp4lib.cma llvm.cma llvm_bitwriter.cma -pp camlp4oof minml.ml -o minml

G++ -I option for compiling program

Here is a little problem that cannot be resolved by me such a Linux program newbie.
Now I have a main.cpp program which need to be compiled, there is a
#include "Down.h"
in the front of file.
Actually, this header file exist in the other directory, which locates at
../../../include
directory. Besides, some other header files needed by Down.h also locate at this ../../../include directory.
Here is the problem, I compile main.cpp with command
g++ -I /../../../include main.cpp
However, it gives lots of error info which means it is not correct to be done like this.
Should I also change the include declaration into this one?
#include "../../../include/DownConvert.h"
May you please leave me with some advice? Thanks.
Edit:
After using g++ -I ../../../include main.cpp, I get the following errors:
$ g++ -I ../../../include main.cpp
In file included from ../../../include/DownConvert.h:98,
from main.cpp:92: ../../../include/ResizeParameters.h:4:22: error:
TypeDefs.h: No such file or directory
In file included from /usr/include/c++/4.4/bits/stl_algo.h:61,
from /usr/include/c++/4.4/algorithm:62,
from ../../../include/H2
g++ -I /../../../include main.cpp
See that leading slash after the -I? That's an absolute path.
Change it to a relative path (shown below) and it'll work OK.
g++ -I ../../../include main.cpp
g++ -I ../../../include main.cpp
ought to work
Try to use -v option:
g++ -v -I ../../../include main.cpp
And check that list of directories to search for include files contains your folder and there is no complains that this folder is absent. If there is this sort of complains correct the path that you give after -I