Building and using Google Protocol Buffers - windows

I am currently working on a project, and I am trying to implement Protocol Buffers to work as a serialization format to store data on the local computer, and then be read back at a later time. Some of the features of protocol buffers seem perfect for this project so I was eager to test it out but I have run into some issues.
So far though, I have not even been able to get far enough to test out Protocol Buffers. I downloaded the most recent zip file (version 2.4.1) to my windows machine. I read through the install.txt located in the root of the folder, but it was for Unix based systems. I then saw that it came with a vsprojects folder and read through the instructions listed there. Basically, all I was told to do was open up a solution, and then build the entire solution in either Debug or Release. I instantly received several errors about "config.h" not being found.
I checked over the Unix instructions again and step one was...
cd' to the directory containing the package's source code and type
'./configure' to configure the package for your system. If you're
usingcsh' on an old version of System V, you might need to type
sh ./configure' instead to preventcsh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
So I booted into ubuntu, which I rarely use, and tried follow these instructions. The step listed above went fine and I was even able to get to the next step and 'make' the project, but then when the time came to use 'make install' I received the following errors:
ross#ubuntu:~/Desktop/protobuf-2.4.1$ make install
Making install in .
make[1]: Entering directory `/home/ross/Desktop/protobuf-2.4.1'
make[2]: Entering directory `/home/ross/Desktop/protobuf-2.4.1'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/lib/pkgconfig" || /bin/mkdir -p "/usr/local/lib/pkgconfig"
/bin/mkdir: cannot create directory `/usr/local/lib/pkgconfig': Permission denied
make[2]: *** [install-pkgconfigDATA] Error 1
make[2]: Leaving directory `/home/ross/Desktop/protobuf-2.4.1'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/home/ross/Desktop/protobuf-2.4.1'
make: * [install-recursive] Error 1
I primarily use windows for development, and the entire project I am working with now is being made in windows, so I am a little concerned. Has anybody had any luck building Protocol Buffers in either windows or linux?
Thank you

You can't do make install as your own user, when you're trying to install it system-wide.
Either use sudo make install if you have sudo rights, or become root any other possible way and then run it.
If you don't have admin rights, you can run ./configure --prefix=$HOME/protobuffers, compile and run make install again, it will install them in your home dir in subdir called protobuffers. Note that you might want to adjust your LD_LIBRARY_PATH in profile after that to be able to find libraries. If you only need protoc, that should do the trick.
--- edit ---
Speaking of which, protoc is also available for windows, and you can use them there as well.
You can download it here.

Related

Error installing libmaxminddb

I am trying to install the GEolite2 database on a netbsd server. I can't get past the first make for libmaxmindb. I get the following error;
make all-recursive
Making all in src
Making all in bin
Making all in t
make: don't know how to make man/man1/*.1. Stop
make: stopped in /usr/local/maxmind/libmaxminddb-1.1.1
*** Error code 1
Stop.
make: stopped in /usr/local/maxmind/libmaxminddb-1.1.1
*** Error code 1
Stop.
make: stopped in /usr/local/maxmind/libmaxminddb-1.1.1
Hpw can I either fix this or get around it?
UPDATE:
I downloaded the tarball for 1.1.1 from github.com/maxmind/libmaxminddb/releases/download/1.1.1/….
I noticed that the man directory has no Makefile in it and from what I could tell, maybe it should.
I am using NetBSD 6.0.1 and ran the steps in the Readme.
configure - ran normally
make - failed as shown above. –
I also tried starting from a git clone - same result.
On BSD systems one should always use GNU Make with Makefiles generated by GNU Automake.
I see in README.md for the libmaxminddb repository on github.com that one is expected to run the bootstrap script after cloning the repo (which is quite normal, though more often the script is called autogen).
If you don't already have GNU Make and the GNU Autotools installed I recommend using pkgsrc to install them.

Cygwin ratfor installation

I want to install ratfor77 on Cygwin (form the Stanford Exploration Project).
I downloaded it, untar it, attribute the good permissions to the folder ratfor77 (chmod -R u+w ratfor77).
But when I want to use the command make all I receive this error:
make: *** No rule to make target '/ratfor77', needed by 'all'. Arrêt.
I verified that all the files needed were in the folder.
Any idea?
The makefile does not follow the usual conventions. Run make ratfor77. Several compiler warnings are emitted but the executable ./ratfor77 is generated.
The problem I describe was resoluted by moving the raffor folfer to the root directory of Cygwin.
I had the message above:
Done making all in util/tools/ratfor77
I'm following a documentation but it do not work :p
But I didn't have the file ratfor.exe.
So I tried your code:
make rartfor77
And no it's ok.
Thank you very much Mike.

compile/make ffmpeg without man pags

I am installing ffmpeg on heroku (ubuntu) with enable-ssl via a build-pack. I am able to build it all the way up to these errors:
install: cannot create regular file `/usr/local/share/man/man1/ffmpeg.1': Read-only file system
...
install: cannot create regular file `/usr/local/share/man/man1/ffmpeg-filters.1': Read-only file system
make: *** [install-man] Error 1
I do not have write access to any directory outside of /app. I have tried compiling with --mandir=/app/vendor/ but that seems to be ignored.
Is there any way to build ffmpeg without the man pages or just have them installed else where?
Actually if your build has gotten to the install step, you should already have the binary for ffmpeg. Build process makes it in the local directory before attempting to move the binary and manuals to the system locations.

MinGW make fails on crlibm: 'failcom' is not recognized as an internal or external command

On Windows 7, 64-bit, I am trying to compile crlibm. My environment is a 32-bit MinGW that came with the Python-XY distribution, and the shell I'm using is bash as it comes with Git for Windows.
I have sucessfully ran ./configure without any arguments. But when I try to run make, I get the following error message:
$ env PATH=/c/MinGW32-xy/bin make
make all-recursive
make[1]: Entering directory `c:/Users/michael/crlibm-1.0beta4'
'failcom' is not recognized as an internal or external command,
operable program or batch file.
make[1]: *** [all-recursive] Error 255
make[1]: Leaving directory `c:/Users/michael/crlibm-1.0beta4'
make: *** [all] Error 2
As someone noticed in a different context, failcom seems to be a variable in the makefile, but for some reason it is interpreted as a command. When this command is invoked, it is of course not found, and the build process fails.
Unfortunately, the discussion linked above has not led to a solution that I could have used. So my question is if anyone here recognizes this problem and knows how to solve or work around it.
Best regards,
Michael
I have finally found the answer to my question on this wiki page. I cite:
A common misunderstanding is MSYS is "UNIX on Windows", MSYS by itself does not contain a compiler or a C library, therefore does not give the ability to magically port UNIX programs over to Windows nor does it provide any UNIX specific functionality like case-sensitive filenames. Users looking for such functionality should look to Cygwin or Microsoft's Interix instead.
To summarize: MSYS/MinGW is not suposed to support a configure/make workflow of the type a UNIX user is accustomed to. Installing Cygwin as suggested in the above wiki page did indeed solve my problem.

wkhtmltopdf compilation on Ubuntu

I am trying to compile wkhtmltopdf from the latest source. I am on Ubuntu 12.10 x64 server edition.
I used the instructions from here and here.
For the wkhtmltopdf-qt compilation, as mentioned by the author, the new Git repo is at gitorious.org/~antialize/qt/antializes-qt.git on the 4.8.2 branch. So, that is what I used as well.
Everything went fine. The compilation of both (qt and wkhtmltopdf) completed successfully. But I was able to use wkhtmltopdf only as root (using sudo). When I ran it as any other user, I got the following error.
error while loading shared libraries: libQtWebKit.so.4: cannot open shared object file: No such file or directory.
I had done all the compilations as root, with the files inside the root user's home directory (/root). I guessed that the wkhtmltopdf program needs to read the wkqt directory, where the compiled qt resides (and the libQtWebKit.so.4 file). This directory was inside the root user's home directory as well, thus preventing other users from running wkhtmltopdf.
So, I decided to start from scratch again. This time, I put all the source files (wkhtmltopdf-qt and wkhtmltopdf) in /usr/wkhtmltopdf. But during the compilation of qt, I get an error with the compiler trying to access qmake at the previous (old) location where qt source was present (/root/wkhtmltopdf-qt).
Error below:
ln -s libQtDeclarative.so.4.8.2 libQtDeclarative.so
ln -s libQtDeclarative.so.4.8.2 libQtDeclarative.so.4
ln -s libQtDeclarative.so.4.8.2 libQtDeclarative.so.4.8
rm -f ../../lib/libQtDeclarative.so.4.8.2
rm -f ../../lib/libQtDeclarative.so
rm -f ../../lib/libQtDeclarative.so.4
rm -f ../../lib/libQtDeclarative.so.4.8
mv -f libQtDeclarative.so.4.8.2 libQtDeclarative.so libQtDeclarative.so.4 libQtDeclarative.so.4.8 ../../lib/
make[1]: Leaving directory `/usr/wkhtmltopdf/wkhtmltopdf-qt/src/declarative'
cd src/3rdparty/webkit/Source/ && make -f Makefile.WebKit
make[1]: Entering directory `/usr/wkhtmltopdf/wkhtmltopdf-qt/src/3rdparty/webkit/Source'
/root/wkhtmltopdf-qt/bin/qmake -spec ../../../../mkspecs/linux-g++-64 -o Makefile.WebKit WebKit.pro
make[1]: /root/wkhtmltopdf-qt/bin/qmake: Command not found
make[1]: *** [Makefile.WebKit] Error 127
make[1]: Leaving directory `/usr/wkhtmltopdf/wkhtmltopdf-qt/src/3rdparty/webkit/Source'
make: *** [sub-webkit-make_default-ordered] Error 2
I don't understand how this is possible when I am starting with absolutely fresh source code.
Is there some way in which I can completely remove (uninstall) the previously installed wkhtmltopdf-qt and wkhtmltopdf?
I would appreciate some help. Thanks.
Okay, I figured it out.
Apparently, the source code was not as fresh as I thought.
I was cleaning the untracked and modified files in the Git working copy of the QT source directory. Running git status showed no modified files. But what I missed was that there were a lot of git-ignored folders and files, which still had the info about the previous compilation. These files and folders were not showing up in git status.
So, I temporarily moved the .gitignore file outside the repo and ran git clean -fd. That cleaned out all unnecessary files. Then I moved the .gitignore file back. For safety, I also ran git checkout -- . to get the latest versions of all the files from HEAD.
Compilation worked after that.

Resources