Clang dynamic memory analyzer not referencing back to source code Red Hat 6.3 - clang

We recently built the 3.3 release of clang/llvm using the Fedora 20 packaging process as a guide to unpacking, moving the different parts to the correct location and building the compiler tool chain. All seems to be working correctly except the dynamic memory analyzer is not referencing back to the source code. The same usage on the Fedora platform does reference back to the source code.
This is our first attempt to use the clang/llvm tool set. Also this is the first question asked in this forum which seems a bit different on its organization from all the others I have participated in so my appologies in advance if I have not figured out the nuances of posting a question here. Does seem odd that the main projects do not seem to have a way of asking questions.

We found a solution, do not know quite why we needed to add the extra
environment setup. Compiling as follows:
PATH=/net/fas4045/home3/jq031c/llvm_sandbox/bin:$PATH make -j 16
DEPFILES= CXX=clang++ CC=clang CXXFLAGS="-fsanitize=memory
-fsanitize-memory-track-origins -fno-omit-frame-pointer"
LDXFLAGS=-fsanitize=memory
Runing as follows:
MSAN_SYMBOLIZER_PATH=/net/fas4045/home3/jq031c/llvm_sandbox/bin/llvm-symbolizer ./runtests.sh
We can understand that we need to add the analysis option to the link flags as we do a two step build of compile followed by link. The discovery after searching was the need to define the path to llvm-symbolizer with an environment variable which none of the other dynamic analysis options seems to need.

Related

How to create a dependency in Atmel Studio 7.0?

I need to #include a file called ClearCore.h but it refuses to show up as a dependency.
https://i.stack.imgur.com/1kTvS.jpg
https://i.stack.imgur.com/dn6XT.jpg
As you can see, the file is in the library and most other files are listed as dependencies, but this one refuses to despite being #included.
Here is the error message from compilation.
https://i.stack.imgur.com/tM2wk.jpg
I am an applications engineer at Teknic and I saw your post and wanted to offer a few points to help you get your code running.
It sounds like you are having trouble adding the ClearCore library as a dependency. As this is more a function of ATMEL, there could be several reasons as to why we are running into issues here.
The easiest way to troubleshoot this would be to use one of Teknic’s already linked and ready to run example projects (we include these examples in addition to the ClearCore libraries). You can use the provided example projects as a template to sort out whatever may be causing the dependency issues.
You can find these examples here: https://teknic-inc.github.io/ClearCore-library/SdkExamples.html
Keep in mind that if you move the example projects into other directories, some of the relative file path definitions may be broken.
If you have any questions about the examples projects please feel free to give us a call at 585-784-7454, or use our "Contact Us" form online at https://www.teknic.com/contact/.
Best regards,
Mark D. – Teknic Servo Systems Engineer

What exacly is "buidling" from source and how does it work

So I really cant understand how this work but late me explain. First, just in case you need it, I am running Ubuntu 12.04 64-bit on a laptop.
As a building tool am using CMake. I want to load in to my project OpenCV, MRPT (http://www.mrpt.org/) and libfreenect. All of them have a "source code". What I don't understand is when they say "build from source". How to I make a project with all of them?
Do I need to build each one individually and with some way but then in my project OR do I down load the source code and build them all together at ones? As you can see I'm really confused what I have to do... do I run the CMakeList.txt from each source code and the run one CMakeList.txt that has all the other CMakeList.txt?
In fewer world, if I want to build from source, two or more libraries, how do I do that?
I would like a general answer (how this "build from source" works) and an answer specifically on the the ones I mentioned (CMake, OpenCV, MRPT, libfreenect). I hope I made clear what I don't really understand.
It depends of the 'master' project. In general in the c/c++ universe your project must know how to invoke the build process of each subproject/library OR your project needs to know how to include&link the results after building each external project yourself.
You can also mix the two approaches if needed but I think it cleaner to try to use one if possible.
In the first case if all the subprojects offer cmake building files (CMakeLists.txt) you may try to add_subdirectory() each and see if there are any conflicts. For example google test can be easily included this way and it gives your project some global variables that easy linking later.
Alternatively or if the above approach gives problems or the sub project doesn't provide CMakeLists.txt you can use ExternalProject_add(). It takes more work and you have to handle includes/linking configurations with your project manually but it makes the subproject more independent. For example if there are conflicting targets with your project or the subproject doesn't provide CMakeLists.txt.
The last approach involves building and installing the sub projects separately, using configuration variables in your project to point the includes/libraries paths of the sub project. Check CMake:How To Find Libraries for details.

HipHop for PHP, deploying apps

After Googling, I found a lot of HipHop documentation, but plenty was posted between 2011 and 2013.
Earlier this year was launched a new version of HipHop that even supports Drupal and includes a lot of improvements...
I've always used the Zend Guard to deploy my commercial applications, but now I started to consider seriously the use of HipHop in production, but here comes the question:
We can run an application using only the bytecode HHBC (Without .php source code)?
Follows the reference of my research
https://github.com/facebook/hhvm/wiki/FAQ
The question may seem very obvious, but it is not so easy to find this answer in the project documentation.
Thanks in advance!
Well, yes and no.
HHVM has a so-called RepoAuthoritative mode in which the HHVM will no longer check the existence of the PHP files or how up-to-date they are; instead, it will retrieve the HHBC directly from its cache.
Theoretically, you can follow these steps:
pre-generate the HHBC for all your PHP files and insert that HHBC in HHVM's cache. This is the so-called pre-analysis phase (if you ever see it in HHVM documentation, this is what they mean by it)
turn on RepoAuthoritative mode (it's just 1 line in HHVM's config)
delete your PHP code
This way your PHP applications will run just fine without the source code being present. Doing a server restart won't change this since HHVM's bytecode cache lives on disk (it's implemented as an SQLite database).
However, it will be kind of a headache if you:
want to change something in your code. You would have to copy your code, make the change and repeat the pre-analysis phase.
want to upgrade HHVM to a newer version. HHVM uses its build ID as part of the cache key so, if you upgrade it, the bytecode cache becomes unreachable and, since you'll be running in RepoAuthoritative mode, your application will be reduced to a bunch of HTTP 404 errors. To fix this, you would have to repeat the pre-analysis phase as well.
Bottom line: no upside, big downside. There's just no point in doing it.
PS: I hope I answered your question. It's also possible that I misunderstood what you asked; if that's the case, please let me know in a comment.

Qt generic error message

This is the error messsage I get.
I know it's kind of an eye roller, that it's difficult nigh impossible to tell what I may need without the source, but it seems like a deployment problem as people that installed the Qt SDK can run it. Plus, I figured I'd have better luck asking here than with a chinese developer that speaks google-english.
So here's what I've done:
I installed the MSVC2012.
I used a program called cffexplorer to see what the exe was looking for. I have the 7 or so .dlls that are at the top of the tree.
I found a recent (jun 2013) qwindows.dll from elsewhere on my system and put it in ./plugins (I've tried this file in ./, ./plugins, and ./plugins/platforms
I created a qt.conf with the following data (I determined the format from an existing Qt based app that works)
[Paths]
Plugins = plugins
Yet, I continue to get this message. Any suggestions on what I might look for to clear this up?
Ask the developer what compiler was used to build the application. Then you will need the right dll (that was built with the same compiler as the application). Also notice that (by default) the documentation says that qwindows.dll should be in the platforms folder in the same path as your executable, read more here. Depending on whether the developer used a Qt built with angle, you may also need: libEGL.dll and libGLESv2.dll. Dependency walker might help you find dependencies that are not there.

Using Vim instead of (or with) Xcode for iOS development

Xcode comes with a lot of things that are essential to building to the iPhone and/or iPad. In fact a lot of it I am not even aware of because it is so 'behind the scenes'.
On the other hand, I have recently been exposed to the advantages of using Vim as an editor. Is there any setup which would make using Vim an efficient option when developing for the iOS platforms? Or would it be so complicated to combine the two as to make this question moot?
In other words, if you have any tips, advice or warnings when using Vim and Xcode together, I am all ears!
Developing for iOS or Mac with Vim can be really powerful and fast, especially if you use TDD or want quick feedback.
But it takes a bit of finagling to get it working. The few important things you need to know are:
Use the xcodebuild command-line tool to run your build and units from some vimscript.
Use the clang_complete plugin to give you full code completion from within vim.
Use the ios.vim and cocoa.vim plugins for navigation.
This is my preferred method of working. In fact, I wrote the ios.vim plugin to make this easier for more people.
I've been there already...
I love vim and regularly use it in my day-by-day C++ development on *nix platforms, but I also like all of Xcode's features which, specially with latest Xcode >= 4.3 and clang backend, give a real plus in terms of auto-completion and symbol referencing.
I think I've found the optimal solution with the great (although not officially supported by Apple) XVim plugin.
Hoping that future Xcode upgrades won't break it (it's still working fine with latest developers' previews of 4.5), this really allows you to keep your fingers moving as you've learned doing in Vim while working with Xcode, which as I said, is for me the optimal solution.
Vim and XCode will co-exist quite well together provided that you aren't trying to edit the same files in Vim and the XCode editor at the same time. If you do then each will give you a warning about the file being modified externally. The terminal version of Vim is a little easier to live with in this particular respect: it will only warn you when you try to save the file, asking are you sure, whereas MacVim, and the XCode editor, will warn you each time you return to the file.
XCode does allow you to select an external application when you open files, by file type. In XCode Preferences, go to the File Types tab, and then file->text->sourcecode. Preferred Editor can be set to an external program such as MacVim; note that Emacs should be already listed as a selection: when Emacs is selected XCode launches Terminal.app with Emacs in a terminal. This Preferred Editor setting has the problem that you'll get a new window with each opened file, which may not match your workflow.
Vim's remote feature might prove useful here, see :help remote. With a little work, and the above Preferred Editor preference, one should be able to send the file to be edited to any instance of Vim, including an existing Vim running within an xterm. I seem to recall that Emacs provides something similar.
But none of this precludes you from using Vim without setting Preferred Editor: just open and edit your project files in Vim as you would normally.
Your workflow might be to use Vim for editing code, and switch to XCode for building the project, but Vim can also run the same build tools that XCode uses, and with a little more work you'll even be able to jump to the lines with errors. XCode relies on gdb for debugging, which can also be used quite well with Vim, via plugin.
Of course Vim can't be expected to replace something like Interface Builder, but just about every other aspect of iOS dev can be achieved with a Vim-only solution.
Or just use Vim to edit your code faster, and continue to use XCode for the rest.
Starting with Xcode 13.0 Beta you can use Vim keybindings in Xcode. It is enabled in settings:
Preferences → Text Editing → Editing → Enable Vim key bindings
Edit (per #fangxing):
The way to toggle what is now called Vim Mode changed:
Menubar → Editor → Vim Mode
Even thought MacVim with YouCompleteMe is my main environment for development on OSX, there are tasks I prefer to do in XCode, like debugging and profiling. For these scenarios I use XVim which adds VIM editing capabilities to XCode.
On XCode 5.1 XVim crashed quite a lot. But it progressed and it now works quite well with XCode 6 so far. But you only get a subset of VIM this way, e.g. you can't split the editor to view two files at the same time. You can enable/disable it quite easy with Shift-Command-X.
(Sorry to post this as answer and not as a comment, but the reputation-system of stackoverflow did not made it possible for me)
I can't recommend YouCompleteMe enough! Beside its code-completion it also shows you syntactic errors on the fly on the affected line without the need of manually triggering your compiler (i.e. very similar to the features of the XCode editor). The description of the YCM creator is quite informative:
YouCompleteMe is a fast, as-you-type, fuzzy-search code completion
engine for Vim. It has several completion engines: an identifier-based
engine that works with every programming language, a semantic,
Clang-based engine that provides native semantic code completion for
C/C++/Objective-C/Objective-C++ (from now on referred to as "the
C-family languages")...
To get it running:
Follow the section 'Mac OS X super-quick installation'
Don't forget to add a .ycm_extra_conf.py file to the root of your project folder
Edit:
Without a plugin like YouCompleteMe, VIM can only do rudimentary word completion (Ctrl-N) which is neither aware of the programming language you're using nor of all the other files belonging to your project. You also don't get a list of the members of an object after you type '.' or '->'. So you miss on a lot of help (and therefore speed) XCode is giving you while typing. Also VIM doesn't warn you like XCode when you make typos or other errors in your code. YouCompleteMe adds exactly those missing features to VIM and makes iOS development in VIM a joy.
You could use xcodebuild to build and run your project, but personally I prefer to work with VIM and XCode at the same time. Both reload documents automatically after they have been modified by the other. Keep XCode for debugging, profiling and deployment.
Using AppCode in parallel with Xcode is just amazing. Code changes sync right away! I am so happy with this setup because I can finally use vim (as an AppCode plugin) when writing iOS apps. AppCode has additional advantages so I really recommend that you check it out. The refactoring tools are also way better IMHO. E.g. it can extract methods that Xcode can't for some reason and if it can not extract a method it will at least tell you why.
There are definitely some advantages using external editors ( however emacs is ten million times better than vim:}).
Stick with Xcode for most stuff, but when you need the power of emacs, or possibly vim ( bulk repetitive editor macros is my main reason), just edit the file using show in finder and open with, or just by switching to your editor navigating to the file from there.
XCode will realise when you switch back that the file has changed.
For plain code, I'd stick with Xcode, it's code completion is based on more knowledge of the code, so beat's emacs or vim's hands down. Continuous code checking is invaluable, and as already mentioned, the direct access to the documentation is awesome ( option click if you haven't already found it).
I like XVim for XCode. Unfortunately, it breaks for XCode 5.1 (some people got Development branch working, but I couldn't).
I ended up switching to AppCode after a trial, I really liked the tab management, refactoring, and code analysis. Code is automatically synced with XCode, so I run both (XCode for build settings, managing asset catalog. AppCode for everything else).
First day I downloaded it, I installed IdeaVim so I could still use some of the Vim keyboard shortcuts.
Though you won't get to full Vi/Vim functionality with the plugin. I find mix usage with native IDE commands is enough to compensate.
According to my opinion Xcode is better solution. It has so many features that you can not find/add in Vim. Some of them are:
Interface Builder (to create good lookin interfaces in less time)
ARC (Automatic Reference Counting—memory management)
Automated process for managing code signing and app store submission
The list is very long and Apple always encourages you to use Xcode, not any other IDE.

Resources