Gettext clone or alternative under permissive license (non-copyleft)? - c

At the moment I am trying to find a gettext alternative with comparable tool support. However, the library itself needs to be under a permissive license, so that the binaries can be linked statically and I need not release the object files along with the binary as the LGPL stipulates.
In short: one of the so-called permissive licenses (BSD, MIT, zlib/libpng, X11 etc ...) would suit me fine, but I haven't been able to find an alternative under permissive license.
Any pointers?
Yes, I have seen and read the one answer to https://stackoverflow.com/questions/943058 and downvoted it. The question clearly was for non-copyleft, too. And the LGPL is a copyleft license, even if it is more permissive compared to the GPL.

NetBSD maintains a gettext-compatible library, under BSD license.
see http://wiki.netbsd.org/projects/project/libintl/
it needs development, so anything that is missing you could develop and contribute :)
This should also be mostly compatible with the 3rd party gettext tools and utilities, if you
can get them to compile from source against libintl.

Related

Newlib: embedded vs desktop

I'm compiling a Linux toolchain based on Newlib for a toy project.
Newlib's official page reports:
Newlib is a C library intended for use on embedded systems.
but without providing any particular reason.
What I'm trying to figure out is:
Why newlib consider itself embedded "only"?
What are the downsides to use it on desktop or server environments?
Unlike Glibc, which has very specific code to make sure that it is replaceable with later API compatible versions, the Newlib isn't so; nor does it support dynamic linking anyway. And it doesn't make much sense to statically link in the C library in every possible executable in a desktop environment. Therefore, Newlib is mostly suitable for embedded targets with small number of statically linked executables.
Newlib also fulfils only the parts of the C standard library and a a minimal part of the POSIX C library extensions. Specifically it doesn't concern itself with networking at all. It is somewhat debatable if anyone in their right mind, would want to build a desktop system without any networking at all, in 2017.
Another thing to note is the non-technical aspect of licensing. Glibc uses the LGPL license, which does allow linking against proprietary programs, provided that (note that IANAL) the user is able to replace the LGPL-licenced library with another one. In practice this means that either the library is dynamically linked in, or, in case of a statically linked library, the user is provided with object files that they can use to link against the replacement library to produce an executable. This means that the license itself might not be suitable for small embedded systems with proprietary software. Newlib doesn't contain any LGPL code, unless it is built for Linux targets.

License file for Windows API DLL files

My friend is currently in preparation of distributing his software and wants to cleanup on the licenses of software he uses. The strategy is that he collects all the files that provides the licensing text.
He finished collecting all the "obvious" licenses, such as the Qt license of the Qt libraries he uses. However he also uses some of the Windows DLLs that come with Windows, such as kernel32.dll and advapi32.dll.
Where can he find the license files so that he can publish it with his software? The first DLL file, kernel32 appears to be automatically linked to his software based on an http://en.wikipedia.org/wiki/Auto-linking directive. The second file, advapi32.dll is linked explicitly to his software, and he wants to cleanup the situation of that file by collecting the file that provides the license.
For debian linux for example, he knows that the files are below /usr/share/doc/<package of the library>/copyright.
Not an option, distributing those Windows components cannot work. Different Windows versions have very different implementations of these DLLs. Even computers with the same version may have different DLL versions, these runtime components are often updated by Windows Update. Forcibly overwriting them would be normally disastrous, but the File System Protection feature in Windows recovers the damage.
There simply is no need to distribute these DLLs. Every Windows machine already has them, along with a solid promise from Microsoft that they will be compatible with the program as long as the programmer set the _WIN32_WINNT macro correctly in his code. Which selects the minimum Windows version that he chooses to support, it prevents accidentally taking a dependency on winapi functions that are only available in later versions. Getting that wrong simply prevents the program from starting.
Since you mentioned GPL in the comments, you need to know that GPL has special language concerning system libraries.
The GPL FAQ says
Both versions of the GPL have an exception to their copyleft, commonly called the system library exception. If the GPL-incompatible libraries you want to use meet the criteria for a system library, then you don't have to do anything special to use them; the requirement to distribute source code for the whole program does not include those libraries, even if you distribute a linked executable containing them.
Naturally you should rely on the actual legal language of the license, not the FAQ. Hopefully any infectious non-GPL licenses take a similar approach.
The license that applies to Windows system DLLs is the end-user license for the desktop or server OS that they came with. There are many variations on these, such as volume licenses or development subscription licenses. So your friend needs to just chalk those up as "system library, non-distributable, source not distributable, governed by OS license".
Contrary to Alex's assertion in the comments, the Windows license does (or at least attempts to) govern use in addition to redistribution. Running the application in, for example WINE, where there may not be a valid license for certain required system libraries would present a problem, even if the system libraries were placed onto the hard drive during installation/patching of a licensed copy of Windows. I am not a lawyer, but I'm pretty sure that problem falls on the administrator of the WINE environment who caused those DLLs to be loaded, not the third-party application developer.
You may not redistribute Windows system DLLs. This includes kernel32, ntdll, advapi32, and a couple of others. The exact list is not fixed but basically, it includes almost anything in the system32 directory. (This list may be a good start.) These files are considered to be part of Windows and thus covered by Windows EULA.
What you may redistribute depends on your compiler and/or any third-party (non included in Windows) libraries you're using. For Microsoft Visual C++, see redist.txt in the installation directory. It usually has a text similar to following:
Visual C++ Runtime files
Subject to the license terms for the software, you may redistribute the .EXE files (unmodified) listed below.
These files can be run as prerequisites during installation.
vcredist_x86.exe
vcredist_x64.exe
vcredist_IA64.exe
Subject to the license terms for the software, you may redistribute MSM files listed below unmodified as a part of your installation package:
[...]
See here on the specifics of redistributing MS C runtime.
For other compilers/libraries you will need to consult their documentation.

Including third-party libraries in C applications

I'm a bit naive when it comes to application development in C. I've been writing a lot of code for a programming language I'm working on and I want to include stuff from ICU (for internationalization and unicode support).
The problem is, I'm just not sure if there are any conventions for including a third party library. for something like readline where lots of systems are probably going to have it installed already, it's safe to just link to it (I think). But what about if I wanted to include a version of the library in my own code? Is this common or am I thinking about this all wrong?
If your code requires 3rd party libraries, you need to check for them before you build. On Linux, at least with open-source, the canonical way to do this is to use Autotools to write a configure script that looks for both the presence of libraries and how to use them. Thankfully this is pretty automated and there are tons of examples. Basically you write a configure.ac (and/or a Makefile.am) which are the source files for autoconf and automake respectively. They're transformed into configure and Makefile.in, and ./configure conditionally builds the Makefile with any configure-time options you specify.
Note that this is really only for Linux. I guess the canonical way to do it on Windows is with a project file for an IDE...
If it is a .lib and it has no runtime linked libraries it gets complied into you code. If you need to link to dynamic libraries you will have to assure they are there provide a installer or point the user to where they can obtain them.
If you are talking about shipping your software off to end users and are worried about dependencies - you have to provide them correct packages/installers that include the dependencies needed to run your software, or otherwise make sure the user can get them (subject to local laws, export laws, etc, etc, etc, but that's all about licensing).
You could build your software and statically link in ICU and whatever else you use, or you can ship your software and the ICU shared libraries.
It depends on the OS you're targeting. For Linux and Unix system, you will typically see dynamic linking, so the application will use the library that is already installed on the system. If you do this, that means it's up to the user to obtain the library if they don't already have it. Package managers in Linux will do this for you if you package your application in the distro's package format.
On Windows you typically see static linking, which means the application bundles the library and it will use that specific version. many different applications may use the same library but include their own version. So you can have many copies of the library floating around on your system.
The problem with shipping a copy of the library with your code is that you don't get the benefit of the library's maintainers' bug fixes for free. Obscure, small, and unsupported libraries are generally worth linking statically. Otherwise I'd just add the dependency and ensure that whatever packages you ship indicate it appropriately.

GNU Lesser GPL, application sell? [duplicate]

This question already has answers here:
Closed 13 years ago.
Possible Duplicate:
Using LGPL library in a commercial Java application
Hello guys!
There is a project under the GNU Lesser GPL license. I want to use this project in my application. Can I sell my application using this license?
In a nutshell, the idea of LGPL'd projects (usually libraries) is that you are free to use them as you wish in your own application, be it open or closed source, free or proprietary - as long as you publish the source code of the LGPL'd part (if you modify the LGPL'd part, you must publish the modified sources, under LGPL).
Additionally, the libraries must be linked dynamically so that they could be replaced to another version by the user if he so wishes. For libraries (.dll, .so, .jar...), this is usually self-evident. Side note: this is inherently pointless requirement, because nothing requires that your application works with any other library version than the one that you originally provided. You could even actively prevent your application from working with other versions.
You can use LPGLed libs with your proprietary software, but there are some restrictions you must observe. Better read the LGPL carefully and contact a lawyer.
General notes, You can use a LGPL library if
You link with it dynamically only allowing user to replace specific library (for example replace dll to newer compatible version).
If you make changes in LGPL code, you release the changed library sources as well.
Generally many closed source projects use LGPL code, it is common practice, but
read license carefully, especially this GPL-FAQ.
If you have doubts, contact lawyer.
If you are using the GNU app as part of the development process, then the resulting code is saleable.
If you are calling or otherwise using the public APIs of the GNU app then your app is saleable provided you package and distribute the GNU app as a separate component complete with the original app -- and make it clear in your documentation that you are using the GNU library and it still belongs to its original authors under the GNU license terms.
If on the otherhand you have modified the package, cut and pasted code from the package, inserted your code into thier programs or otherwise changed thier code to get yours to work you can only further distribute with the same gnu license. This does not actually preclude selling the software, but, there are all sorts of complications so its best not to go there.
If in doubt contact the original authors, tell them what you have done/intend and ask them what they think - it is afterall thier software your messing with.
Short answer is yes, you can sell your application under any license you like. The only thing you need to do is:
Mention somewhere that your product uses that library, anywhere, in the about box, in the splash screen, in the manual...
If your customers ever ask for the source code of that library (not necessarily your application), then you must give it to them or tell them how to obtain it. But note that only your customers/users actually have this right (and most customers don't bother right?).
That is basically it in a nutshell though I would still recommend you read the GPL FAQ posted by Artyom.

Implementing C file streams (FILE *, fopen, fread, etc.) on embedded platform

I've been tasked with adding streams support (C89/C90) to the libraries for my company's legacy embedded C compiler. Our target hardware typically has 1MB or less of code space and does not have an operating system.
We have a lot of stream-like implementations throughout the codebase that I can use as a starting point. For example, a console that works over a TCP sockets or serial port, a web server that reads from FAT on SD card or in-memory file, and even a firmware updater that reads from many sources.
Before I go and re-invent the wheel, I'm wondering if there are existing implementations that I could either port or use as a starting point for my work. Even though we provide full source code to our customers, GPL-licensed code isn't an option since our customers don't want to release source code to their products.
Can anyone recommend a book (annotated Unix source, CompSci text) or public domain/BSD-licensed source? I'd prefer to look at an older OS targeted to a single device, as current operating systems contain a tangle of macros and layers of typedefs that make following even a simple struct definition difficult.
Take a look at P.J. Plauger's book The Standard C Library, which describes in detail one possible implementation of the complete C89 standard library.
You should be able to pull most of what you need from the source code for the GNU C standard library. It is licensed with the Lesser GPL, which means you can link to the library without affecting the license of your software (or forcing your customers to release their code). Porting this to your platform (thus keeping the LGPL-ed code in its own library) may be easier than implementing your own from scratch.
Several different projects have taken GNU GLIBC and optimized it for embedded systems. You may want to look at:
Embedded GLIBC (LGPL)
uLIBC (LGPL)
Newlib (multiple free licenses)
In particular, EGLIBC and uLIBC were designed to run properly on embedded systems that lack a MMU.
You can also have a look at BSD's implementation of libc
Alternatively there is STLSoft, who provides several libraries (including the C standard lib) under a BSD license. I can't attest to their quality since I haven't used their code myself, but it might be worth looking at if you can't work LGPL-ed code into your project.
Wouldn't *BSD (Net|Open|Free)'s libc be suitable? At least as a starting point.
Try looking at http://www.minix3.org/
Check your development tools. Some development tools come with their on source for their software libraries.
I took the source for the Compiler's printf and adapted for a debug port on an embedded system. There is less work when you have a foundation to build from.

Resources