is there something like protoc but cross-platform compiler instead - serialization

protoc.exe is built for windows. Every other distro, you have to compile protoc yourself to use it. We really want to drop something like protoc into our project but then have the hassle on anyone on a different OS has alot of work to do to set it up. Therefore, for this project protoc is kind of dead basically.
Is there another library like protoc that generates objects/DTOs and marshallers/unmarshallers that has a cross-platform compiler? (Java compiler would be great as we could wire it into our gradle builds).
thanks,
Dean

Avro Project is similar to Protocol Buffers (has it's own format though) and has a Java Compiler. Avro definition can be in either IDL (not unlike Protocol Buffers) and JSon. One problem is the Jar for Avro is large (it uses a lot of other Jars
You could look a compiling protoc to Java-Byte-Code. There are several projects available for this see cibyl also lists several cross compilers. The result will be slow and large but it may work.

Protocol buffer are supposed to be cross-platform compiler
There are other alternatives to Protoc buffer such as xstream, Jackson, GSON. There is detailed set of answers Here.
Hope this helps!

I haven't tried if it works, put possibly you could run protoc over JVM. There exists several compilers for running C++ on JVM.
See Compiling C++ for the JVM.

Related

Handling unresolved platform-dependent dependencies in biicode

I've tried to add biicode support to the the testing library Catch and had some problems with external dependencies related to Objective-C and Microsoft Foundation Classes (MFC).
The following is printed if running bii deps:
florianwolters/catch depends on:
system:
algorithm
assert.h
cmath
cstddef
cstdio
cstring
fstream
iomanip
iostream
iterator
limits
map
memory
ostream
set
sstream
stdbool.h
stdexcept
stdint.h
stdlib.h
streambuf
string
sys/time.h
sys/types.h
unistd.h
vector
windows.h
unresolved:
AfxWin.h
Foundation/Foundation.h
objc/runtime.h
sys/sysctl.h
The three files sys/sysctl.h, objc/runtime.h and Foundation/Foundation.h are related to iOS development in Objective-C. The file AfxWin.h is part of the C++ library Microsoft Foundation Classes (MFC) from Microsoft. The biicode block I've created is florianwolters/catch (for further information).
So the question is: How-to deal with such dependencies? It does not make sense to upload source code owned by Apple or Microsoft (it may even be illegal) to bicode, though I haven't checked the licenses yet.
Is the "proper" or recommended way to simply ignore such unresolved issues?
EDIT 2015-01-11:
I've written a blog post about the process here. Please let me know, if I did any mistakes or if you have any suggestions for improving the workflow.
Yes, at the moment it is the proper way. Biicode has pre-defined some system headers, the basic ones for Win and Nix platform, but not all of them. Typically OSX or other specific headers as MFC will not be found in biicode and then will be marked as unresolved.
This is not a problem at all. The same happens for your own libraries. If you wan to use any of your system-installed libraries, you can do very easily as usual (in CMake with Finders, or Imported targets). Biicode will mark included headers for that library as unresolved, which is the way to indicate that it is not managed by biicode. As long as those headers are present in your machine, everything will work fine.

How can I compile perl6 file to exe

I am playing with perl6 version which built on MoarVM on windows. I created some perl6 file and want to compile it to exe. I tried the following:
perl6 --target=MAST r.pl>r
Now I want to compile the r to executable
I found this link which talk about how to that using Parrot but I am using MoarVM target: http://perlgeek.de/blog-en/perl-6/my-first-executable.writeback
my question how can i compile MoarvVM targeted file to windows executable ?
Unfortunately, the answer is to target JVM and one of the many nice tools for turning a JAR into an executable. MoarVM doesn't have that tooling at this point (and given the lack of current overlap between perl6 hackers and Windows users, probably won't for some time).
One of the things that attracted me to the language, was that it was supposed to be compilable, I thought "sure, it would build exe files for me", unfortunately, it does not (last I checked).
compile:
perl6 --target=mbc --output=test.moarvm -e 'say 42'
run:
perl6 -e 'CompUnit::Loader.load-precompilation-file("test.moarvm".IO)'
However, you can compile the program t the intermediate moarvm machine, do KEEP IN MIND this is not porable, so you have to recompile on each target.
I think this code was legated to me by somebody that really knew perl6 on the irc channel, I don't understand how it works, though.
I advise if you need a compiled language, to wait for real support from the compiler guys or simply to use something like rust or golang (that is what I ended up using, I'm happy).
I know rust doesn't have all the "bells and whistles" that Perl6 has, but it gets the job done...

Is there a way to show where LLVM is auto vectorising?

Context: I have several loops in an Objective-C library I am writing which deal with processing large text arrays. I can see that right now it is running in a single threaded manner.
I understand that LLVM is now capable of auto-vectorising loops, as described at Apple's session at WWDC. It is however very cautious in the way it does it, one reason being the possibility of variables being modified due to CPU pipelining.
My question: how can I see where LLVM has vectorised my code, and, more usefully, how can I receive debug messages that explain why it can't vectorise my code? I'm sure if it can see why it can't auto-vectorise it, it could point that out to me and I could make the necessary manual adjustments to make it vectorisable.
I would be remiss if I didn't point out that this question has been more or less asked already, but quite obtusely, here.
Identifies loops that were successfully vectorized:
clang -Rpass=loop-vectorize
Identifies loops that failed vectorization and indicates if vectorization was specified:
clang -Rpass-missed=loop-vectorize
Identifies the statements that caused vectorization to fail:
clang -Rpass-analysis=loop-vectorize
Source: http://llvm.org/docs/Vectorizers.html#diagnostics
The standard llvm toolchain provided by Xcode doesn't seem to support getting debug info from the optimizer. However, if you roll your own llvm and use that, you should be able to pass flags as mishr suggested above. Here's the workflow I used:
1. Using homebrew, install llvm
brew tap homebrew/versions
brew install llvm33 --with-clang --with-asan
This should install the full and relatively current llvm toolchain. It's linked into /usr/local/bin/*-3.3 (i.e. clang++-3.3). The actual on-disk location is available via brew info llvm33 - probably /usr/local/Cellar/llvm33/3.3/bin.
2. Build the single file you're optimizing, with homebrew llvm and flags
If you've built in Xcode, you can easily copy-paste the build parameters, and use your clang++-3.3 instead of Xcode’s own clang.
Appending -mllvm -debug-only=loop-vectorize will get you the auto-vectorization report. Note: this will likely NOT work with any remotely complex build, e.g. if you've got PCH's, but is a simple way to tweak a single cpp file to make sure it's vectorizing correctly.
3. Create a compiler plugin from the new llvm
I was able to build my entire project with homebrew llvm by:
Grabbing this Xcode compiler plugin: http://trac.seqan.de/browser/trunk/util/xcode/Clang%20LLVM%20MacPorts.xcplugin.zip?order=name
Modifying the clang-related paths to point to my homebrew llvm and clang bin names (by appending '-3.3')
Placing it in /Library/Application Support/Developer/5.0/Xcode/Plug-ins/
Relaunching Xcode should show this plugin in the list of available compilers. At this point, the -mllvm -debug-only=loop-vectorize flag will show the auto-vectorization report.
I have no idea why this isn't exposed in the Apple builds.
UPDATE: This is exposed in current (8.x) versions of Xcode. The only thing required is to enable one or more of the loop-vectorize flags.
Assuming you are using opt and you have a debug build of llvm, you can do it as follows:
opt -O1 -loop-vectorize -debug-only=loop-vectorize code.ll
where code.ll is the IR you want to vectorize.
If you are using clang, you will need to pass the -debug-only=loop-vectorize flag using -mllvm option.

Objective-C syntax checker

Is there an Objective-C syntax checker?
I have tried gcc -fsyntax-only but it is not really 'syntax only'. It still produces errors if run on an individual implementation file which has references to external frameworks.
I am looking for something that can perform a syntax check on individual header or implementation files without attempting to link or produce object files.
Can gcc do this with additional flags I am unaware of, or is there another tool up to this task?
I want to do this from the command-line. Can xcodebuild do this for an individual file? Running xcodebuild for the entire project to check the syntax of one file is a bit much.
There's no way for it to check the syntax without it knowing about the header files for the frameworks you are using. You need to use the -framework flag to include the relevant header files.
You could try using clang -fsyntax-only instead, especially if you're using 10.6/Xcode 3.2. Clang/LLVM has much better separation between the parser and the other parts of the compiler chain. You can find clang in /Developer/usr/bin.
So after trawling through the gcc man page I discovered the -F flag which lets you add a framework directory to the list of directories gcc searches for header files.
This solves my issue.
Use it like this: gcc -fsyntax-only -ObjC -F/Path/To/A/Framework -F/Path/To/Another/Framework File.m
You can compile a single file in Xcode[1] using Build->Compile (cmd-K) which is effectively a syntax check (there's no linking step).
[1] I assume you're using Xcode, as there's little point in using Objective-C without OS X (really the Cocoa frameworks).

How to configure cmake to compile informix *.ec files?

I'm just found cmake and I want to use it to create make files for a little project that uses the esql compiler.
I've not used cmake yet (it is on my list of things that I need to look at - round about the time some spare tuits become available), but...
I do have several sets of rules for compiling ESQL/C to object code etc for regular make.
You can find one set of those rules online at the IIUG Software Archive in the SQLCMD package. Or you can contact me directly to discuss the niceties in detail (and/or the differences between cmake stuff and regular make stuff). You can also find Informix-related autoconf macros in the SQLCMD package - file acinformix.m4.
You will probably need to use the cmake ADD_CUSTOM_COMMAND command to create the rule for compiling each source file with the esql compiler.