NetCDF for Perl on Windows - windows

I'm helping one of our students do some data access with NetCDF files on Windows 7 (64-bit). We have the binding for our preferred language (Perl) but can't find a prebuilt NetCDF library binary, or figure out where to put it so the Perl executable can find it. Anyone have any starting breadcrumbs? We were hoping to avoid loading up a whole Cygwin GCC stack for this one purpose; really all we need is a DLL and the knowledge of the right place to put it.
TIA,
rw

I remember when this used to be a real pain, but with modern Perl on Windows, modules that require C compilation can generally be installed as easily as on Linux.
Strawberry Perl for Windows comes with a compiler environment already set up.
ActivePerl also lets you download a C compiler, but I haven't tried this myself.
It's a shame that NetCDF haven't released their module via CPAN, but you still should be able to use the compiler that comes with Perl.
I also found this alternative module:
http://search.cpan.org/~dhunt/PDL-NetCDF-4.05/netcdf.pd

Here are the latest netCDF DLLs for Windows:
http://www.unidata.ucar.edu/software/netcdf/docs_rc/winbin.html

Related

Compiling software in cygwin requires cygwin libraries to run

I have just compiled some software in cygwin and all went well, except when I tried to run it on a different machine it required some cygwin specific libraries .dll's, is there anyway I can build this in with the software so it can run on third party machines without cygwin installed? Im trying to be generic with the question so the answer will suit other people facing the same or similar problem so sorry for the lack of detail on the software etc. (sgminer)
Thanks for any help
Not only is this a duplicate, as Paul R point out, it's also an FAQ on the Cygwin site.
From "How do I compile a Win32 executable that doesn't use Cygwin?"
The compilers provided by the mingw-gcc, mingw64-i686-gcc, and
mingw64-x86_64-gcc packages link against standard Microsoft DLLs
instead of Cygwin. This is desirable for native Windows programs that
don't need a UNIX emulation layer.
This is not to be confused with 'MinGW' (Minimalist GNU for Windows),
which is a completely separate effort. That project's home page is
http://www.mingw.org/index.shtml.

How do I write a cross platform installer script?

Instead of having a different download of a program for Windows and Linux, would it be possible to make the download be a cross-platform script/executable that can download the correct installer from an FTP server and start that? What language should I write it in? The only one I can think of would be Java, but I don't want to take the time to learn it. I can't write it in Python or BASH, because most Windows machines don't have these installed. How should I do this?
Cross-platform executable(like an exe or a.out or ELF) is out of question. An executable is never cross-platform when Windows is involved. The scripting languages(or JIT compiled) have to be brought in for this purpose. We are in a CHICKEN-AND-EGG paradox. You may have to detect the OS the downloader is using, using a Javascript script in your website page and decide on what is to be done next etc...
Although not exactly what you are looking for, below are some pointers.
The best tool I know of, for multi-platform installers, is Flexera Software's InstallAnywhere. That might be a bit costly. For free options I would look into options like:
PERL
PYTHON (but this is out of question as per your post, but look at the end of my post for more options for Python)
Although writing the installer in any of the above languages might mean a lot more work, they provide you unmatched flexibility and complete control.
Perl requires that you install Perl interpreter and modules on Windows. But this also seems to be out of question for you. So you may avoid the headache by looking into:
PAR
pp
For Python go through:
py2exe
pyinstaller

Portable scripting language for a multi-server admin?

Please Note: Portable as in portableapps.com, not in the traditional sense of a language that can be used on multiple architectures or operating systems. Whoever coined this usage of the word portable should be whacked. :)
I'm a DBA and sysadmin, mostly for Windows machines running SQL Server. I'm looking for a programming/scripting language for Windows that doesn't require Admin access or an installer, needing no install process other than expanding it into a folder. My intent is to have a language for automation around which I can standardize.
Up to this point, I've been using a combination of batch files and Unix shell, using sh.exe from UnxUtils but it's far from a perfect solution.
I've evaluated a handful of options, all of them have at least one serious shortcoming or another. I have a strong preference for something open source or dual license, but I'm more interested in finding the right tool than anything else. Not interested that anything that relies on Cygwin or Java, but at this point I'd be fine with something that needs .NET.
Requirements:
Manageable footprint (1-100 files, under 30 MB installed)
Run on Windows XP and Server (2003+)
No installer (exe, msi)
No reliance on a JVM or Cygwin install
Works with external pipes, processes, and files
Support for MS SQL Server or ODBC connections
Bonus Points:
Open Source
FFI for calling functions in native DLLs
GUI support (native or gtk, wx, fltk, etc)
Linux, AIX, and/or OS X support
Dynamic, object oriented and/or functional, interpreted or bytecode compiled; interactive development
Able to package or compile scripts into executables
So far I've tried:
Ruby: 148 MB on disk, 23000 files
Portable Python: 54 MB on disk, 2800 files
Strawberry Perl: 123 MB on disk, 3600 files
REBOL: Great, except closed source and no MSSQL or ODBC in free version
Squeak Smalltalk: Great, except poor support for scripting
I urge you to try Lua. Regarding your requirements:
Tiny footprint (56 source files, under 150K compiled)
Runs everywhere (uses only ANSI C)
No installer needed; you compile from source (there's also a "batteries included" package that I haven't explored
Doesn't need JVM and works with any ANSI C compiler, so you can compile with Visual Studio, not Cygwin
Works with external processes and files but only to the extent supported by ANSI C. If POSIX popen is provided then that is supported also.
And your bonus points:
Open source (MIT license)
FFI to C is brilliantly conceived and executed—not quite as simple as Tcl but loads more powerful. Much better integration with C than Python or Ruby.
GUI support is mixed but there are good bindings for wx widgets. QT support was there at one time but I don't know if it has been maintained.
Linux is supported
Language/compiler features:
Dynamic
Functional
Prototype-based objects and inheritance through metamethods (you'll want to see examples in the book below
Fastest bytecode compiler in the West
Interactive read-eval-print loop; load new code dynamically
Able to package scripts into executables; either use Luiz de Figueiredo's srlua, or I can send you a 120-line Lua script that converts Lua source to a .c file that you link in with your app and the interpreter to make an executable.
Additional bonus points:
Very crisp, clean, well-designed language.
Small enough to master in its entirety and to be productive within a day.
Superb book Programming in Lua (check out the previous edition free online)
There are a couple of options for Python that might fit your bill:
The first is IronPython, which can be run without an installer and will play nicely with .net APIs. This gives you access to anything with a .net API or a COM typelib that you could build a PIA for. I've used at as a scripting mechanism for precisely this reason - it could be dropped into a directory within the system and did not need to be explicitly installed..You will have to have an appropriate .Net runtime installed, but .Net 2.0 is installed with SQL Server 2005. SQL Server can be accessed through ADO.net and building GUIs with Winforms is fairly straightforward.
The second is Portable Python which is designed to be run off a USB key. Although I see you've already tried it, you might elaborate on what the shortcomings were. If something isn't available in the basic install you could always look into building a custom version with it included. TkInter (at least) is bundled.You can also use Py2EXE to generate standalone python applications with all superfluous junk stripped out. This will give you about 10 files or so (depending on the number of DLLs) that can be run from a single directory, possibly on a USB key.
Running local python installs on Unix-oid OS's is pretty straightforward, so that's pretty much a no brainer. Also, python comes with most linux distros and is available as 'contributed software' from most if not all trad unix vendors. IIRC it's also bundled with MacOS.
Tclkit is a single-file, self-contained Tcl/Tk system. The mac version I have is about 3.8 megs. You can get a version for just about any modern OS. I carry around a thumb drive that has mac, windows and linux binaries so I can run my scripts on any platform. No install is required, just copy one file wherever you want.
The only thing it's missing from your original spec is MS SQL Server / ODBC support out of the box. I know people use tcl for that but I think you'll have to add an extra library or something. See the Tcl'ers wiki entry on MS SQL Server for more information.
For tcl, apart from Tclkit, freewrap is another small portable, self-contained interpreter for tcl.
Just rename the freewrap executable to something else will convert it to a stand-alone interpreter. Renaming it back to freewrap will convert it to a script wrapper.
Also, freewrapped apps contain a tcl interpreter. In dire emergencies you can try opening the app as a zip file and edit/replace the tcl code contained within (just remember to make a copy first). This has saved me several times when I'm at a client site without development tools but need to troubleshoot something. I just make a copy of one of my deployed app and presto - instant development environment!
Looking at wikipedia's exhaustive list of portable software
There's Tiny C compiler, again on Wikipedia here, and its own homepage here.
To summarize by quoting from wikipedia's list of features:
Small - can compile and execute C code everywhere, for example on rescue disks (about 100KB for x86 TCC executable, including C preprocessor, C compiler, assembler and linker).
Fast - tcc generates optimized x86 code. No byte code overhead. It compiles, assembles and links about 9 times faster than GCC.
Any C dynamic library can be used directly. TCC is heading towards full ISOC99 compliance. TCC can of course compile itself.
Includes an optional memory and bound checker. Bound checked code can be mixed freely with standard code.
Compile and execute C source directly. No linking or assembly necessary. Full C preprocessor and GNU-like assembler included.
C script is supported: just add '#!/usr/local/bin/tcc -run' at the first line of your C source, and execute it directly from the command line.
With libtcc, you can use TCC as a backend for dynamic code generation.
Few dependencies. It includes its own hand-written lexer, and it is implemented using a recursive descent parser. Thus, building TCC requires few other libraries.
Its LGPL license permits anyone to use, modify, and/or redistribute the software, and it can be used to develop either open source or proprietary software.
Hope this helps and would be of use,
Best regards,
Tom.
Every somewhat modern Windows version comes pre-installed with both VBScript and JScript. The doesn't meet all your features (compile to an executable comes to mind), but they certainly have an unbeatable advantage with the installation size: it's hard to beat 0.
In addition to the Lua suggestion, there is also Idle. It is basically a superset of Lua 5.1, with both the language (and libraries) and the implementation based on Lua. It was originally created to be a more complete scripting solution for Windows: because Lua is primarly intended for embedding, it has a rather small standard library and it is usually expected that the embedding application provides a rich library to Lua.
This makes sense for an embedded language, because, after all, there isn't much common functionality between, say Adobe Lightroom, Nginx and World of Warcraft, so there simply is nothing you can put in a standard library. But for a more general purpose OS scripting language, one would want a slightly larger library. Thus, Idle bundles a couple of libraries that are third-party (and sometimes hard to get to work on Windows) in Lua in its standard library.
Some of the things that the Idle standard library adds over Lua are tight Win32 integration, SQLite3 support, networking support, a PEG parser generator and archive support.
Also, Idle has support for embedding Perl and C code into your Idle programs.

installing gcc on vista

I downloaded gcc 4.4.0 and unzipped it to C:\Program Files\gcc
forgive me for being a novice, but...now what? I read the install readme file but it's over my head. how do i get it to work?
If it were me, I would just start with cygwin in the first place. If you do, most of the Unix/Linux/BSD faq's and tutorials will "just work".
If you're new to gcc and want to start using it on Windows, I highly recommend the MinGW GUI installer.
If you want to do C/C++ programming for fun, Mingw is the simpler way to go about it. You'll also need some libraries to get you started.
Try: http://nuwen.net/mingw.html
It's a Mingw distribution based on GCC 4.3.3
It also contains: binutils, boost (with compiled headers), SDL, libbzip, libjpeg, libvorbis, freetype, and many other libraries.
EDIT: I'm not sure if any of the precompiled stuff will work on Vista. I've only tried it on WinXP.
If you want to Install, you can install Dev C++, which is actually MinGW with GUI. Dev C++ can probably be clubbed wth cygwin too though I havn't tried it out ever.
Even if the name says C++ in Dev C++, don't worry. I have tried and it does compile C programs as well. I am recommending Dev C++ because most people on Windows have a habit of using GUI for everything in contrast to be people from *nix background.
You can download it from here
It also includes GDB which is the debugger you can use. If you are don't know how to use gdb this tutorial can come handy.
Another aspect of Dev C++ is that it's development has probably ceased as no new versions have been released since Feb,2005 which is more than 4 years. People still use Dev C++ as it does it's job right. The latest version has GCC 3.4.2 bundled with it.
If you are interested in running the most latest or using newer versions of gcc, then you should try out wxDev C++ is an extension of Dev C++. The latest RC was made available somewhere in 1 yr back. It even has in built CVS support
Now since you require GCC 4.4.0 , it is available on MinGW site. Try to replace the older gcc dll in Dev C++/wxDev C++ with the newer one from this site.
You will edit the environment variable "PATH" to include C:\Program Files\gcc\bin.
(source: justrealized.com)
Then you can use gcc just like in Linux.

Is it possible to use GCC without Cygwin or MinGW?

GCC is a very well respected multi-language compiler (from what I've gathered). One thing I've not been able to definitively find out is: Is it possible to use GCC on windows without anything extra like Cygwin or MinGW?
I've learned that if you use GCC on Cygwin, there is a dependency on a DLL. If you use GCC with MinGW, you eliminate that dependency but you still must have MinGW to use GCC.
Is it possible to build GCC and utilize it by itself, completely native to Windows? Like Microsoft's Compiler? After reading around, my guess is no. But I'd still like more info, if possible.
If not, why does GCC require environments like Cygwin or MinGW? I understand this now. It is because GCC requires a Unix/POSIX environment. Why it does, it still beyond me.
I did find this and it helps but doesn't really answer my question: Why does GCC-Windows depend on cygwin?
To refine my question, I guess what I'm trying to understand why GCC can't stand on it's own -- Where I have just "GCC.exe".
For MinGW, you need MinGW in the sense that MinGW provides the implementation of the gcc language system. I don't see how your question makes sense - it's like "Can I use VC++ without installing VC++?"
To clarify: MinGW is the GCC compiler executable(s), headers and support objects. There isn't anything else. There is a related but independant package called MSYS which provides some posix utilities, but you do not need this in any way in order to use the MinGW version of GCC.
What is exactly the problem with mingw? And what is native?
mingw used to generate pretty much standalone binaries, and maybe that is even more native than MSVC's, which require msvcrt, a component that needs to be installed sometimes.
So maybe you could explain what you tried with mingw, and what the exact problem is.
To disable mingw's extra dependency simply don't use exceptions (-fno-exceptions), I haven't used cygwin so not sure.
I don't think so. I've had to compile some command line apps for people in the past and always had to use cygwin.
I think the biggest reason being posix compatibility, which is what cygwin strives to bring to Win32.
Linaro used to provide that long time ago, a GCC that runs naively on Windows without MinGW or Cygwin. I am currently using that GCC 4.9 on a Windows 10 PC to compile UEFI and it is working like charm.
https://releases.linaro.org/archive/14.09/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.9-2014.09_win32.zip
simply install wsl on your computer.

Resources