How to disable debug optimization in eclipse cdt - eclipse

I want to stop debug optimization in eclipse cdt and I read article about this
http://husks.wordpress.com/2012/03/29/hardware-debugging-the-arduino-using-eclipse-and-the-avr-dragon/
it supposed to see tool setting in eclipse indigo but I didn't see it.
what is the problem
see this for more info
https://sourceforge.net/projects/cmusphinx/forums/forum/5471/topic/5170910
this is my make file
TOP=../../..
DIRNAME=src/programs/init_gau
BUILD_DIRS =
ALL_DIRS= $(BUILD_DIRS)
SRCS = \
accum.c \
init_gau.c \
main.c \
parse_cmd_ln.c
H = \
accum.h \
init_gau.h \
mk_sseq.h \
parse_cmd_ln.h
FILES = Makefile $(SRCS) $(H)
TARGET = init_gau
ALL = $(BINDIR)/$(TARGET)
include $(TOP)/config/common_make_rules
I found this config file
# -*- makefile -*-
#
# This file is automatically generated by configure.
# Do not hand edit.
CC = gcc
CFLAGS = -g -O0 -Wall -fPIC -DPIC
CPPFLAGS = -I/media/sda5/sphinx/tutorial/SphinxTrain/../sphinxbase/include -I/media/sda5/sphinx/tutorial/SphinxTrain/../sphinxbase/include
DEFS = -DPACKAGE_NAME=\"SphinxTrain\" -DPACKAGE_TARNAME=\"sphinxtrain\" -DPACKAGE_VERSION=\"1.0.99\" -DPACKAGE_STRING=\"SphinxTrain\ 1.0.99\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBM=1
LIBS = -lm -lsphinxbase
LDFLAGS = -L/media/sda5/sphinx/tutorial/SphinxTrain/../sphinxbase/src/libsphinxad -L/media/sda5/sphinx/tutorial/SphinxTrain/../sphinxbase/src/libsphinxbase -L/media/sda5/sphinx/tutorial/SphinxTrain/../sphinxbase/src/libsphinxbase/.libs
AR = ar
RANLIB = ranlib
FESTIVAL = /usr/bin/festival
PERL = /usr/bin/perl

The options are under project properties as explained in first tutorial. If you are trying to build a project with existing makefile, then you need to edit the makefile.
You dont typiclly need to change project properties. Debug configuration builds without optimization by default. You just need to make sure you jave it selected. This is done using the icon (sundial? - the one next to CDT's build (hammer)).

Related

Doxygen processes my files in a subdirectory, but does not show them in the output documentation

Doxygen processes my project, both headers and implementation files, both in the main directory and in a subdirectory, but then in the generated HTML output only the files from the main directory are visible.
These are the relevant parts of the Doxyfile:
NUM_PROC_THREADS = 1
EXTRACT_ALL = YES
HIDE_* = NO
INTERNAL_DOCS = NO
SHOW_FILES = YES
WARNINGS = YES
INPUT = C:\path_to\include\dir1 \
C:\path_to\include\dir2 \
C:\path_to\include\dir3 \
C:\path_to\examples\dir1 \
C:\path_to\examples\dir2 \
C:\path_to\examples\dir3 \
C:\path_to\examples\dir3\file1.h \
C:\path_to\examples\dir3\file2.h \
C:\path_to\examples\dir3\file1.cxx \
C:\path_to\examples\dir3\file2.cxx
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \ ...
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
CLANG_ASSISTED_PARSING = YES and NO (tried both)
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
UML_LOOK = YES
INCLUDE_GRAPH = YES
DIRECTORY_GRAPH = YES
Only the files in the C:\path_to\include\ are available in the HTML output. Note that I also specify the file names, not just the directory, to try to get them in the output.
These are the relevant parts of the output logs:
Preprocessing C:\path_to\examples\dir3\file1.h...
Parsing file C:\path_to\examples\dir3\file2.h...
Preprocessing C:\path_to\examples\dir3\file1.cxx...
Parsing file C:\path_to\examples\dir3\file2.cxx...
Generating file sources...
Generating code for file file1.cxx...
Generating code for file file1.h...
Generating code for file file2.cxx...
Generating code for file file2.h...
Generating docs for file file1.cxx...
Generating docs for file file1.h...
Generating docs for file file2.cxx...
Generating docs for file file2.h...
In the HTML output, if I make a search for, e.g., "file1.cxx" or "file1.h" or "file1" I get "No matches".
It looks like the examples directory has not been processed at all, while the logs show otherwise.
Doxygen version 1.9.2 and 1.9.3.

How to setup autotools for glib-compile-resources?

How would I setup my Makefile.am file to run glib-compile-resources to compile resources.
This is how my Makefile.am currently looks like:
INTLTOOL_FILES = intltool-extract.in \
intltool-merge.in \
intltool-update.in
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src data po gnome pixmaps dicfiles
EXTRA_DIST = COPYING rpm/gjiten.spec scripts/make_debs scripts/make_release\
intltool-extract.in intltool-merge.in intltool-update.in
DISTCLEANFILES = ${INTLTOOL_FILES} \
po/.intltool-merge-cache
MAINTAINERCLEANFILES += configure config.sub config.guess aclocal.m4 compile \
depcomp install-sh \
${DISTCLEANFILES} intltool-extract intltool-merge intltool-update.in \
ltmain.sh missing mkinstalldirs config.h.in po/*stamp* *stamp*
Or do I have to setup the commands within autogen.h or configure.ac ?
How would I setup my Makefile.am file to run glib-compile-resources to compile resources.
There are lots of ways, but the one I would recommend to you is to add an all-local target. For example:
all-local:
glib-compile-resources
You would also want to be sure to provide for cleaning the generated files, which might be accomplished either by adding them to CLEANFILES or by adding a clean-local target with an appropriate recipe.

Need help translating a Make File into Meson Build File for Vala

I am working on an Application in Vala. I need to use both webkit2gtk-web-extension-4.0 and webkit2gtk-4.0 in an single project.
I am following the example from -
https://github.com/rschroll/webkitdom/tree/extension
The Make File from the example is as follows:
PKGS=--pkg gtk+-3.0 --pkg libsoup-2.4
EXEC=dom-test
SOURCES=dom-test.vala custom-web-view.vala
LIB_BASE=dom-server
LIB_SOURCES=$(LIB_BASE).vala
LIBRARY=$(LIB_BASE).so
# If you have webkit2gtk-4.0 installed, you will need a Vala from git
# version 6a1a1ab1 (2014/10/16) or later, in order to have the fixed
# .vapi files.
#WEBKIT_VAPI=--pkg webkit2gtk-4.0
#WEBKIT_EXT_VAPI=--pkg webkit2gtk-web-extension-4.0
# Otherwise, use the -3.0 versions included here
WEBKIT_VAPI=--vapidir=. --pkg webkit2gtk-3.0
WEBKIT_EXT_VAPI=--vapidir=. --pkg webkit2gtk-web-extension-3.0 -X -I/usr/include/webkitgtk-3.0
all: $(EXEC) $(LIBRARY)
$(EXEC): $(SOURCES)
valac $(WEBKIT_VAPI) $(PKGS) $^
$(LIBRARY): $(LIB_SOURCES)
valac $(WEBKIT_EXT_VAPI) $(PKGS) --library=$(LIB_BASE) -X -fPIC -X -shared -o $# $^
clean:
rm $(EXEC) $(LIBRARY)
With Meson Build system, I tried to create a subproject with the shared library and link the shared library in the main project. But I am getting the error
DOMServer.vala:1.1-1.10: error: The root namespace already contains a definition for `WebKit'
The main project meson.build file as follows:
project('com.linappfoundry.athmanam', ['c', 'vala'])
domserver_proj = subproject('DOMServer')
domserver_lib = domserver_proj.get_variable('domserver_lib')
cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required : false)
executable(
meson.project_name(),
'AthmanamApp.vala',
'Widgets/MainWindow.vala',
'Widgets/PoemParserWebView.vala',
dependencies: [
dependency('gtk+-3.0'),
dependency('glib-2.0'),
dependency('libsoup-2.4'),
dependency('webkit2gtk-4.0'),
dependency('json-glib-1.0'),
dependency('libxml-2.0'),
m_dep
],
link_with: [domserver_lib],
install: true
)
And subproject's meson.build file is as follows:
project('com.linappfoundry.athmanam.DOMServer', ['c', 'vala'])
domserver_lib = shared_library(
'com.linappfoundry.athmanam.DOMServer',
'src/DOMServer.vala',
dependencies: [
dependency('glib-2.0'),
dependency('gtk+-3.0'),
dependency('libsoup-2.4'),
dependency('webkit2gtk-web-extension-4.0')
],
install: true
)
I am not sure what I am doing wrong here, as I am new to both Vala and Meson.
The error
DOMServer.vala:1.1-1.10: error: The root namespace already contains a definition for `WebKit'
is from the Vala compiler and is saying there is already a definition of Webkit in the global namespace. The error could be as simple as using a keyword with the wrong case, e.g. Using Webkit; when it should be using Webkit;.
Webkit is defined as a namespace in the global (root) namespace and that is done in the VAPI file. Try and find where it is being redefined as something else.

Control mex link options with g++ from command line

I'm trying to link a library using mex from command line, or more exactly, from a makefile. I do this from a Makefile which I post here:
BDDM_MATLAB = #matlabhome#
MEXCC = $(BDDM_MATLAB)/bin/mex
MEXFLAGS = -v -largeArrayDims -O
MEXEXT = mexa64
TDIR = $(abs_top_srcdir)/test
IDIR = $(abs_top_srcdir)/src
LDIR = $(abs_top_srcdir)/lib
LOP1 = $(CUDA_LDFLAGS) $(LIBS)
SOURCES := $(wildcard *.cpp)
OBJS = $(SOURCES:.cpp=.o)
mTESTS = $(addprefix $(TDIR)/, $(SOURCES:.cpp=.$(MEXEXT)))
all: $(TDIR) $(mTESTS)
$(OBJS) : %.o : %.cpp
$(MEXCC) $(MEXFLAGS) -c -outdir ./ -output $# $(CUDA_CFLAGS) -I$(IDIR) CFLAGS="\$$CFLAGS -std=c99" $^
$(mTESTS) : $(TDIR)/%.$(MEXEXT) : %.o
$(MEXCC) $(MEXFLAGS) -L$(LDIR) -outdir $(TDIR) $^ $(LOP1) -lmpdcm LDFLAGS="-lcudart -lcuda"
.PHONY = $(TDIR)
$(TDIR):
$(MKDIR_P) $#
clean:
$(RM) *.o
libmpdcm is a static library that includes calls to two shared libraries libcuda and libcudart. My environment has
export LD_LIBRARY_PATH=/usr/local/cuda-7.0/lib64:$LD_LIBRARY_PATH:
My make rule produces
/usr/local/MATLAB/R2014a/bin/mex -v -largeArrayDims -O -L/home/eaponte/projects/test_cpp/lib -outdir /home/eaponte/projects/test_cpp/test test_LayeredEEG.o -L/usr/local/cuda/lib64 -lcudart -lcuda -lmpdcm LDFLAGS="-lcudart -lcuda"
This produces the following g++ command:
/usr/bin/gcc -lcudart -lcuda -shared -O -Wl,--version-script,"/usr/local/MATLAB/R2014a/extern/lib/glnxa64/mexFunction.map" test_LayeredEEG.o -lcudart -lcuda -lmpdcm -L/home/eaponte/projects/test_cpp/lib -L/usr/local/cuda/lib64 -L"/usr/local/MATLAB/R2014a/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++ -o /home/eaponte/projects/test_cpp/test/test_LayeredEEG.mexa64
The problem is that afterwards I get a linking error in Matlab:
Invalid MEX-file '/home/eaponte/projects/test_cpp/test/test_Fmri.mexa64': /home/eaponte/projects/test_cpp/test/test_Fmri.mexa64: undefined symbol: cudaFree
I know that the solution is simply to put the cuda libraries at the end of the g++ command
/usr/bin/gcc -lcudart -lcuda -shared -O -Wl,--version-script,"/usr/local/MATLAB/R2014a/extern/lib/glnxa64/mexFunction.map" test_LayeredEEG.o -lmpdcm -L/home/eaponte/projects/test_cpp/lib -L/usr/local/cuda/lib64 -L"/usr/local/MATLAB/R2014a/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++ -lcudart -lcuda -o /home/eaponte/projects/test_cpp/test/test_LayeredEEG.mexa64
How can achieve that running mex from command line (or from a Makefile)?
Just to illuminate the problem and solution and offer some help in avoiding the like:
The fundamental rule of linkage with the GNU linker
that your problem makefile transgressed is: In the commandline sequence of entities to be linked, ones that need symbol definitions
must appear before the ones that provide the definitions.
An object file (.o) in the linkage sequence will be incorporated entire in the output executable,
regardless of whether or not it defines any symbols that the executable uses. A library
on the other hand, is merely examined to see if it provides any definitions for symbols
that are thus-far undefined, and only such definitions as it provides are linked into in
the executable (I am simplifying somewhat). Thus, linkage doesn't get started until some object file is seen,
and any library must appear after everything that needs definitions from it.
Breaches of this principle usually arise from inept bundling of some linker flag-options
and some library-options together into a make-variable and its placement in the linkage recipe,
with the result that the bundled options are interpolated at a position that is valid for
the flags but not valid for libraries. This was so in your problem makefile, with LOP1 the
bad bundle.
In the typical case, the bundling causes all of the libraries to be placed before all the object files,
and never mentioned again. So the object files yield undefined symbol errors, because the libraries
they require were seen by the linker before it had discovered any undefined symbols, and were ignored.
In your untypical case, it resulted in libcudart and libcuda being seen later than your only
object file test_LayeredEEG.o - which however required no symbols from them - but earlier than
the only thing that did require symbols from them, the library libmpdcm. So they were ignored,
and you built a .mex64 shared library that had not been linked with them.
Long ago - pre-GCC 4.5 - shared libraries (like libcudart and libcuda) were exempt
from the requirement that they should be needed, at the point when the linker sees them,
in order to be linked. They were linked regardless, like object files, and the belief that
this is so has not entirely died out. It is not so. By default, shared libraries and
static libraries alike are linked if and only if needed-when-seen.
To avoid such traps it is vastly helpful to understand the canonical nomenclature of
the make variables involved in compilation and linkage and their semantics, and
their canonical use in compilation and linkage recipes for make. Mex is a
manipulator of C/C++/Fortran compilers that adds some commandline options of its own:
for make purposes, it is another compiler. For the options that it inherits from and
passes to the underlying compiler, you want to adhere to the usage for that compiler in make recipes.
These are the make variables most likely to matter to you and their meanings:
CC = Your C compiler, e.g. gcc
FC = Your Fortran compiler, e.g. gfortran
CXX = Your C++ compiler, e.g. g++.
LD = Your linker, e.g. ld. But you should know that only for specialized uses
should the linker be directly invoked. Normally, the real linker is invoked on your
behalf by the compiler. It can deduce from the options that you pass it whether you
want compiling done or linking done, and will invoke the appropriate tool. When you
want linking done, it will quietly augment the linker options that you pass with
additional ones that it would be very tiresome to specify, but which ensure
that the linkage acquires all the the correct flags and libraries for the language of the
program you are linking. Consequently almost always, specify your compiler as your
linker.
AR = Your archiving tool (static library builder)
CFLAGS = Options for C compilation
FFLAGS = Options for Fortran compilation
CXXFLAGS = Options for C++ compilation
CPPFLAGS = Options for the C preprocessor, for any compiler that uses it. Avoid the common mistake of writing CPPFLAGS when you mean CXXFLAGS
LDFLAGS = Options for linkage, N.B. excluding library options, -l<name>
LDLIBS = Library options for linkage, -l<name>
And the canonical make rules for compiling and linking:
C source file $< to object file $#:
$(CC) $(CPPFLAGS) $(CFLAGS) -c $# $<
Free-from Fortran file $< to object file $#, with preprocessing:
$(FC) $(CPPFLAGS) $(FFLAGS) -c $# $<
(without preprocessing, remove $(CPPFLAGS))
C++ source file $< to object file $#:
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $# $<
Linking object files $^ into an executable $#:
$(<compiler>) $(LDFLAGS) -o $# $^ $(LDLIBS)
If you can as much as possible write makefiles so that a) you have assigned the right options to the right variables from
this glossary, and b) used the canonical make recipes, then your path will be much smoother.
And BTW...
Your makefile has the following bug:
.PHONY = $(TDIR)
This is apparently an attempt to make $(TDIR) a phony target,
but the syntax is wrong. It should be:
.PHONY: $(TDIR)
what the assignment does is simply create a make variable called, .PHONY with the value of $(TDIR),
and does not make $(TDIR) a phony target.
Which is fortunate, because $(TDIR) is your output directory and not a phony
target.
You wish to ensure that make creates $(TDIR) before you need to output anything into
it, but you do not want it to a normal prequisite of those artefacts, which would oblige
make to rebuild them whenever the timestamp of $(TDIR) was touched. That is presumably
why you thought to make it a phony target.
What you actually want $(TDIR) to be is an order-only prerequsite
of the $(mTESTS) that will be output there. The way to do that is to amend the $(mTESTS) rule to be:
$(mTESTS) : $(TDIR)/%.$(MEXEXT) : %.o | $(TDIR)
This will cause $(TDIR) to be made, if needed, before $(mTESTS) is made, but
nevertheless $(TDIR) will not be considered in determining whether $(mTESTS) does
need to be made.
On the other hand, the targets all and clean are phony targets: no such artefacts
are to be made, so you should tell make so with:
.PHONY: all clean
As pointed out in the comments, the problem was in the order of the dynamic libraries in the compilation flags. After searching the reason for this I found in SO that static libraries need to be linked taking into account the order of dependency. In my case, the library libmpdc had dependencies on libcuda and libcudart but was on the left. The solution is to swap the order in the makefile from:
$(mTESTS) : $(TDIR)/%.$(MEXEXT) : %.o
$(MEXCC) $(MEXFLAGS) -L$(LDIR) -outdir $(TDIR) $^ $(LOP1) -lmpdcm LDFLAGS="-lcudart -lcuda"
to
$(mTESTS) : $(TDIR)/%.$(MEXEXT) : %.o
$(MEXCC) $(MEXFLAGS) -L$(LDIR) -outdir $(TDIR) $^ -lmpdcm $(LOP1)

make error when cross compile Perl for ARM

I have successfully configure perl for cross comile by using configure options:
./Configure -des -Dusecrosscompile \
-Dtargethost=172.17.185.91 \
-Dtargetdir=/home/perl/ \
-Dtargetuser=root \
-Dtargetarch=arm-linux \
-Dcc=arm-linux-gcc \
-Dusrinc=/opt/Mozart_Toolchain/arm-eabi-uclibc/include/ \
-Dincpth=/opt/Mozart_Toolchain/arm-eabi-uclibc/include/ \
-Dlibpth=/opt/Mozart_Toolchain/arm-eabi-uclibc/lib/
And the configure script tell me "Now you must run 'make'." But I encounter such as error when I make:
`sh cflags "optimize='-O2'" miniperlmain.o` miniperlmain.c
CCCMD = arm-linux-gcc -DPERL_CORE -c -DOVR_DBL_DIG=14 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -Wall
In file included from perl.h:38,
from miniperlmain.c:40:
config.h:4425:12: error: operator '==' has no left operand
In file included from miniperlmain.c:40:
perl.h:713:14: error: operator '>=' has no left operand
... ...
In config.h, some macro is left blank, for example:
#define INTSIZE /**/
#define LONGSIZE /**/
#define SHORTSIZE /**/
... much more ...
And I think it is the undefined macro result in the make error. I have no idea how to fix it. Why the macro is blank even if successfully configure?
Are there some guides to cross compile Perl?
There is a Cross directory that features a README file that includes the following instructions for arm-linux:
1) You should be reading me (README) in perl-5.x.y/Cross
2) Make sure you are in the Cross directory.
3) Edit the file 'config' to contain your target platform information.
4) make patch ## This will patch the existing source-tree.
5) make perl ## Will make perl
(Read the whole thing.)
I got the easiest way to cross compile Perl for arm-linux.Please refer to Cross-compiling perl. It's a great work! It saved my life.
Just according to instructions that give, you can get what you want. You may encounter such error when 'make':
pp_sys.c:78: error: non-thread-local declaration of 'h_errno' follows thread-local declaration
Simply comment that line.
Enjoy it!