/etc/dpkg/buildflags.conf example? - dpkg

dpkg-buildflags mentions /etc/dpkg/buildflags.conf file that can be used to configure dpkg-buildpackage. I cannot find any example of what the file should look like though. How could I for example make it pass --disable-static to --configure?

As the man page explains, that file is used to set or modify compilation build flags, which are those passed to the preprocessors/compilers/linkers (cpp/gcc/ld for example, but other languages are also supported). An example content could be:
APPEND CFLAGS -ggdb -O3
STRIP CXXFLAGS -O2
I don't know of any --configure option, I guess you are talking about the configure script usually found on projects using autotools. But there's no global option to pass to that, because what build system each package uses is specific to that source package. If you need to pass that option you'll need to modify the debian/rules file.
Or propose to the debian-policy list, the addition of a new DEB_BUILD_OPTION tag to disable static libraries globally, which will need to be supported by every source package producing them.

Related

Add and link mysql libraries in a cmakelist.txt

I'm working in a project where I need to use MySQL LIBRARIES. I had success in the past, using a simple makefile where I wrote the specific flags.
CFLAGS+=`mysql_config --cflags`
LIB+=`mysql_config --libs`
However... for my project is required to use a cmakelist and I'm having difficulties with that. I can add GTK libraries with this code:
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtk+-3.0)
include_directories(${GTK_INCLUDE_DIRS})
link_directories(${GTK_LIBRARY_DIRS})
target_link_libraries( cgm ${GTK_LIBRARIES} )
but for MySQL I'm in trouble. I tried many things unsuccessfully, but I believe that is similar to the GTK example. Can anyone help me with this problem?
The simplest way could be to find (e.g. with google) FindMySQL.cmake script, which works for you. This script can be used with find_package command as usual:
list(CMAKE_MODULE_PATH APPEND <directory-where-FindMySQL.cmake-exists>)
find_package(MySQL REQUIRED)
include_directories(${MYSQL_INCLUDE_DIR})
target_link_libraries(cgm ${MYSQL_LIB})
(Names of variables MYSQL_INCLUDE_DIR and MYSQL_LIB can be different for concrete script).
But it is not difficult to link with MySQL library manually, knowing way for compute CFLAGS and LIBS.
During configuration stage(executing of cmake) programs can be run with execute_process, for add CFLAGS and LIBS for specific target use target_compile_options and target_link_libraries correspondingly :
execute_process(COMMAND mysql_config --cflags
OUTPUT_VARIABLE MYSQL_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND mysql_config --libs
OUTPUT_VARIABLE MYSQL_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
target_compile_options(cgm PUBLIC ${MYSQL_CFLAGS})
target_link_libraries(cgm ${MYSQL_LIBS})

Can't include JSON::XS module locally in CGI perl script but can include JSON module

So for a particular CGI perl script I have included JSON like this to handle some .json files:
use lib "./modules/JSON/lib";
use JSON;
This works fine and well. The web directory holds the files required in the modules folder.
However, the JSON module is very slow. I read that JSON:XS can be much, much faster but I can't seem to simply use it as so:
use lib "./modules/JSON-XS";
use JSON::XS;
There is no lib folder in the JSON-XS files, i've tried combinations of use (ie, using both folders and etc) but it didn't work.
And no I cannot simply install the module for this particular project.
Any help is appreciated.
And no I cannot simply install the module for this particular project.
You can't use a module without installing it. You've just been getting away with doing a half-assed job of it. That won't work for JSON::XS, though. The reason it's fast is because it's written in C, so you'll need to compile the C code. The easiest way by far to do this is to use the provided installer instead of reinventing the wheel.
(You do know you can install a module into any directory, and that this does not require special permissions, right?)
Perl distributions are usually usable in an uninstalled state. What you just need to do is to call perl Makefile.PL && make (or for a Module::Build-based distribution: perl Build.PL && ./Build). This will do all necessary compilations (if it's an XS module) and copy the library files into the blib subdirectory. In your script instead of use lib you would write use blib:
use blib "/path/to/JSON-XS";
Note that if a module has dependencies, then you have to resolve it yourself and add that many use blib statements. JSON::XS does not have that many dependencies, but it will be really inconvenient for other modules. In this case you should probably seek another solution, e.g. using CPAN.pm together with local::lib.
Okay this finally worked for me:
I did this process to all the dependencies (in the order of no dependencies to more dependencies)
export PERL5LIB = ~/path/to/modules/perl5
perl Makefile.PL PREFIX=$PERL5LIB LIB=$PERL5LIB
make
make test
make install
This installed all modules into a directory I called perl5. It also means that when you try to install other modules locally the dependencies issue does not appear due to the PREFIX/LIB additions.
Then all I did was add this to my perl CGI script:
use lib "./modules/perl5";
use JSON::XS;
PS: JSON::XS is so much faster!
:D

Amending a complex Makefile for installing a library used in one module of an OCaml package

I need to add the csv module in one module compute.ml of an OCAML package.(see discussion ocaml hash from mysql)
Do you know of a simple way to amend the makefile (it is a complex document in my case and I don't think that I can fully rewrite it or switch to ocamlfind install) to enable a compilation without "Unbound value Csv.load" error messages?
ie can I include a new library inside an existing stable Ocaml package?
modified module : compute.ml,
modification;
let data = Csv.load ("foo.csv")
....
error message during compilation :
camlp5r ../wserver/pa_macro5.cmo -DUNIX -o compute.ppo compute.ml
ocamlopt.opt -warn-error A -I ../wserver -I ../sally -I +camlp5 -c -impl compute.ppo
File "compute.ml", line 110, characters 13-21:
Error: Unbound value Csv.load
Thanks for help
You have to tell ocamlopt where to look for csv.cm{i,x} files with the appropriate -I option, like the ones you already have at the end of your command line.
If the library lies in a subdirectory of OCaml's standard library (as given by ocamlc -where), you can use
-I +csv_dir, as is done for camlp5 in your example. Otherwise, you'll have to provide the full path.
Note that this is not the only modification that you'll have to do: you'll also have to add csv.cmx (or .cmxa) on the command line that perform the final link of your application/library.

Is there a way to document cuda's ".cu" file use doxygen

As the cuda's ".cu" file is basically c, Is there a way we can use doxygen to generate documentation for ".cu" files? I noticed that NVIDIA use doxygen to generate cuda's docuementation. However when I use doxygen, the ".cu" files are ignored.
In case anyone else is coming along and reading this with the same problem, what you need to do is this:
Add *.cu to FILE_PATTERNS.
Add cu=c++ EXTENSION_MAPPING.
You can find documentation for both options here.
If you're using the Windows Doxygen GUI frontend, FILE_PATTERNS is on the Input page and EXTENSION_MAPPING is on the Project page.
I suspect that this is your problem: http://www.doxygen.nl/manual/config.html#cfg_file_patterns
If the value of the INPUT tag contains directories, you
can use the FILE_PATTERNS tag to specify one or more wildcard patterns
(like *.cpp and *.h ) to filter out the source-files in the directories.
If left blank the following patterns are tested:
.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py .f90 *.f *.vhd
*.vhdl

how to find which libraries to link to? or, how can I create *-config (such as sdl-config, llvm-config)?

I want to write a program that outputs a list of libraries that I should link to given source code (or object) files (for C or C++ programs).
In *nix, there are useful tools such as sdl-config and llvm-config. But, I want my program to work on Windows, too.
Usage:
get-library-names -l /path/to/lib a.cpp b.cpp c.cpp d.obj
Then, get-library-names would get a list of function names that are invoked from a.cpp, b.cpp, c.cpp, and d.obj. And, it'll search all library files in /path/to/lib directory and list libraries that are needed to link properly.
Is there such tool already written? Is it not trivial to write a such tool?
How do you find what libraries you should link to?
Thanks.
Yeah, you can create a pkg-config file which will allow you to run 'pkg-config --cflags' to get the compiler flags or 'pkg-config --libs' to get the linker libraries.
http://pkg-config.freedesktop.org/wiki/
If you're on Linux, just try looking into /usr/lib/pkgconfig to find some example .pc files that you can use as models. You can still use pkg-config on Windows as well, but it's not something that comes with it.