How to build ACE 6.0(network library) as static? - c++

ACE supplied solution file for Visual Studio, and there were solution files for static and dynamic liking.(ACE.sln and ACE_static.sln)
After they release 6.0, there was no static.sln anymore.
I can't understand. Why did they remove solution file for static? Is there a reason?
I'm putting predefined values for static build by myself. It's very annoying me.
Is there other convenient way?

I've just posted the same question on the comp.soft-sys.ace newsgroup where I got some help from one of the ACE developers:
ACE 6.0 Static Builds
Basically there's a Perl tool called MPC that's distributed with ACE that they use to compile all the build files (I haven't gotten it to work yet but then that's probably just something I'm doing wrong :)
Anyway if you open up the .sln files in Notepad you'll actually see the MPC command line used to build it near the top in the comments.

I just tried to compile ACE 6.3.1 on Win32. Instructions given at http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/ACE-INSTALL.html were bit confusing for me as there was no file ace.sln as mentioned in instructions. To generate the sln file, followed below steps using windows cmd -
Set env variable ACE_ROOT to complete path of ACE-src-6.3.1\ACE_wrappers
go to dir %ACE_ROOT%\ace
Run cmd as I was interested in VS 2010 solution file
perl %ACE_ROOT%\bin\mwc.pl -type vc10 ace.mwc
This has generated solution file inside ACE_ROOT/ace dir and I was able to compile the solution using VS2010 express edition.

Related

How to build Visual Studio Solution under Linux?

I was always using Windows, have very limited Linux experience.
My Visual Studio solution contains 5 C++ projects - 4 of them are static libs, and one is main application (that use these static libs), I want to move it to Ubuntu.
I do not use any windows specific code, so with minor changes I should be abble to compile under Linux.
How to do this? What exactly software should I use under Linux? What should I do with static libs, should I keep using static libs in Linux? How to convert Visual Studio solution to something Linux-like?
upd what if I just download Eclipse in Linux and then file by file, project by project, recreate and copy everything from VC++ to Eclipse? this should work, isn't it? I have just 100-200 files so it's possible to do this by hand.
I can think of two reasonable options. The first one is to create a makefile that will compile everything for you. There was once a utility called Make It So that did this automatically. Their page specifies compatibility with Visual Studio 2010, it might work with Visual Studio 2012 as well.
You can also use cmake. It's a bit more involving to get right, but the end result will be the ability to compile your code more or less anywhere.
Use xbuild? So if you install Mono, then you have xbuild which is the OSS version of msbuild. You can just build your .sln file by something like "xbuild solution.sln"
Clion can generate cmake file automatically for .sln project under linux.
If your code is not dependant on any Window specific library then you can use make the utility to make any lib, bin.
You can also provide different rules to link your library based on your specific requirement. You can also link third party library using Make utility.

Ocamlopt and missing crt2.o file

Having installed OCaml on Windows 7, 64 bit (self-installer), I tried to create a simple exe file with
ocamlopt HelloWorld.ml -o HelloWorld
As required I used the native-code compiler (ocamlopt) with Visual C++ (I have Visual Studio 10 installed) and the Microsoft Assembler MASM version 8 (MinGW is also installed); I have also set the path variables for OCaml (c:\ProgramFiles\Ocaml\bin), MinGW (c:\ProgramFiles\MinGW\bin) and MASM (C:\masm32\bin). However, despite my best efforts and much searching I cannot get around the error message
**Fatal error, Cannot find file "crt2.o"
File "caml_startup", line 1, characters 0-1:
Error: error during linking.
except when I place the HelloWorld.ml file in the lib folder of MinGW, where the crt2.o file is located. I appreciate the answer may be straightforward, but I am stuck. Any help would be greatly appreciated.
I guess mingw needs some way to find library files - when it is compiled from source - path to lib is hardcoded in binaries, if not - it will search in some way (environment variables). Try building either from mingw (or msys) shell which is likely to provide correct environment or set the LIB env variable manually. BTW when debugging mingw problems it will be easier to rule out ocaml first and try building simple C program first.
I kind of remember it is a known bug: contrary to what is said in the documentation, you also need Cygwin installed.
Another problem might be a 32/64 bit incompatibility, i.e. some of your tools are using 32 bits targets, while other ones use 64 bits targets.
Could you be more precise on which OCaml installer you used (URL?). Have you tried the installer present on this page? It lists several potential issues and how to setup MinGW/MSYS for native compilation.
It is very important that we understand clearly the problem you have and, eventually, the solution you found, so that we can tell the maintainers how to update the relevant documentation.
I wrote the installer.
So just to settle the matter, the detailed instructions are at http://protz.github.com/ocaml-installer/ and indeed you have to export the right FLEXLINKFLAGS as an environment variable because ocamlopt uses flexlink (which the installer packages). However, flexlink itself doesn't work out of the box in a msys environment.
The next version of the installer will encourage you to use cygwin, where everything should work flawlessly.
Cheers,
jonathan

LEDA library installation

I have downloaded LEDA free edition from this website
http://www.algorithmic-solutions.com/leda/ledak/index.htm
First quetion:
I want to use this library with my project in VS2010 ide, but i didn't really catch from installation notes, how can i install this library on windows platform.
There were already some static libs (you can see them on the image), which i added to my project with appropriate headers. But that, i suggest, is not a right way. So i will be glad if you will briefly describe the steps, which i should make to compile this library...
The root library directory looks like this
Second question:
In leda's installation guide i can see two main sections:
1.) CONFIGURATION/INSTALLATION FOR UNIX
2.) CONFIGURATION/INSTALLATION for MS Visual C++
In "CONFIGURATION/INSTALLATION for MS Visual C++" i can see the following:
Go to the LEDA main directory (at the command prompt used above).
Type: lconfig msc [dll] [ ml | mld | md | mdd | mt | mtd ]
I'am sorry, i have never seriously used UNIX based systems, but i always thought that MS Visual C++ is a thing, strongly connected with Windows, and lconfig is a unix command?
So i confused, this guide is for unix or for windows or ...?
Thank you, sorry for possibly stupid questions.
The LEDA "free" edition does not include source code. They sell the source code for users who want to modify / compile it. What you have downloaded can be used by including the .h in \incl and linking against the appropriate .lib files. It appears that the package gives you several .lib files to cover all the options of static linking or dynamic linking.
The lconfig instructions are for when you do have the source code, and you want to control which configuration of dll/lib gets built.
"lconfig" is not a standard or even niche UNIX tool; a quick google suggests it's something that actually comes with LEDA itself. Since you've downloaded it, you ought to see it someplace in the bundle.

Setting up midiIO library on Windows

I've downloaded the midiIO library and in the readme it says:
edit the file Makefile.library and set the OSTYPE and OSSUBTYPE to match your hardware/os setup.
type "make library" to compile the library. It will be created as lib/libmidiio.a in unix.
edit the file Makefile.examples and set the OSTYPE and OSSUBTYPE to match your hardware/os setup.
Also, if you are using ALSA, then uncomment out the POSTFLAG to use the alsa library (-lasound).
type "make examples" to compile the example programs in the examples directory. The example programs will be place in the bin directory.
1 + 3 are fine but 2 + 4 are over my head. I've worked in a unix environment before and have used gcc with flags but I need to get this done in Windows. I typically use Visual Studio but don't know how to achieve this with that.. I've downloaded Dev-C++ if that's any use but I don't know what to do with the makefiles?
Ignore the makefiles and set up a fresh project in Visual C++. Make your target a static library (which will be a .lib file in Win32, not a .a file as in unix as you probably know). It is unlikely that the project will build out of the box, so you might have to deal with some compilation errors relating to unix-specific symbols. I took a quick look at the source code, and it looks fairly well-written, so I don't think you should have many problems building it directly in Windows.
Alternately, you could build the source using the real make tool in cygwin, but this means that you would need to distribute the cygwin library with your final product. This may or may not be more trouble than it's worth, especially if you are already using VC++ for the rest of your project's code.

How do I zip a directory of files using C++?

I'm working on a project using C++, Boost, and Qt. I understand how to compress single files and bytestreams using, for example, the qCompress() function in Qt.
How do I zip a directory of multiple files, including subdirectories? I am looking for a cross-platform (Mac, Win, Linux) solution; I'd prefer not to fire off a bunch of new processes.
Is there a standard way to combine bytestreams from multiple files into a zipped archive, or maybe there is a convenience function or method that would be available in the Boost iostream library?
Many thanks for the assistance.
Update: The QuaZip library looks really great. There is an example in the download package (in the "tests" dir) that shows very clearly how to zip up a directory of files.
Update 2: After completing this task on my Linux build environment, I discovered that QuaZip doesn't work at all with the Visual Studio compiler. It may be possible to tackle all those compiler errors, but a word of caution to anyone looking down this path.
I have found the following two libraries:
ZipIOS++. Seems to be "pure" C++. They don't list Windows explicitly as a supported platform. So i think you should try your luck yourself.
QuaZIP. Based on Qt4. Actually looks nice. They list Windows explicitly (Using mingw). Apparently, it is a C++ wrapper for [this] library.
Ah, and of course, i have ripped those sites from this Qt Mailinglist question about Zipping/Unzipping of directories :)
Just for the record...
Today, I needed to do something very similar in Visual C++. (Though wanted to maintain the possibility to compile the project on other platforms; however preferred not to adopt Qt just for this purpose.)
Ended up using the Minizip library. It is written in plain C, but devising a simple C++ wrapper around it was a breeze, and the end result works great, at least for my purposes.
I have built a wrapper around minizip adding some features that I needed and making it nicer to use it. Is does use the latest c++11 and is developed using Visual Studio 2013, so it should work out-of-the-box for you.
There's a full description here: https://github.com/sebastiandev/zipper
you can zip entire folders, streams, vectors, etc. Also a nice feature is doing everything entirely in memory.
Poco::Zip is also a choice, it has clearly documentation and some code for demo.
Poco::Zip Document
system("zip myarchive.zip *");
I tried QuaZIP 0.4.3 on Windows with VisualStudio 2010 -- there are still issues but can be resolved easily.
To build with VS:
Use CMake to configure and generate VS solution for QuaZIP.
Open soltion with VS and build -- you'll first notice that it can't find 'zlib.h'.
Open preferences for quazip project and add path to Qt's copy of Zlib to C/C++->General->Additional Include Directories: $(QTDIR)/src/3rdparty/zlib.
Rebuild again and you'll get lots of warnings and one error C2491: dllimport static issue on QuaZipFile::staticMetaObject.
This is because QuaZipFile is declared like "class QUAZIP_EXPORT QuaZipFile" and QUAZIP_EXPORT needs to resolve to Q_DECL_EXPORT for dll and to Q_DECL_IMPORT for application, based on whether QUAZIP_BUILD is defined or not. When building QuaZIP QUAZIP_BUILD should be defined but isn't -- configuration process defines in error completely useless "quazip_EXPORTS" instead.
To fix, just remove "quazip_EXPORTS" from all build configurations and add QUAZIP_BUILD instead -- QuaZIP will now build fine.