I have a project where I had to change the vector class, as well as the global allocator, and the only way I saw to do so in this context was to take what was already good in those classes and just change what I needed to change.
I was wondering how I need to license my project. I was planning on using something permissive (it will an open source project as soon as I upload the source to GitHub. I just didn't know what to do with the licenses).
Should I just use the same licenses as the Rust repo? I did want to use a license like GNU General Public License, so that anyone who modifies the source, they have to make the modifications available to all. The Apache and MIT license. Do I need to do anything else, like put a copy of the license in the classes I took/modified from the Rust source.
I can upload the project to GH. I haven't yet, because I didn't know if there would be a problem without getting my licensing sorted out, first.
That's probably the safest option.
The GPL is notoriously incompatible with other (more permissive) licenses. I wouldn't waste time and resources on trying to make it work (if at all possible).
No, that's mostly an urban legend. Being explicit about the license in a well-visible manner should be enough.
Realistically? Nobody is going to go after you with a lawsuit for wrangling
As a side note: you can change the global allocator using the
#[global_allocator] attribute. You can also write your own
Vec with your own growth/allocation strategy by re-using
RawVec. And as a side-side note:
Vec is not a class. There are no classes in Rust.
IANAL. Both MIT and Apache are compatible with GPL in the sense that you can take code you received under MIT and give someone else access to it under the GPL. However, you must still follow the requirements of the MIT or Apache license when you do this. For example, if you choose to use it under MIT, then this means that you must somehow tell people that you received the code under the MIT license.
This would be like having the vector be a module of your application that's made available to the user under GPL, MIT, or Apache at their choice. Then, you can make the rest of the library available under GPL only. You can read about that kind of module here.
Yea, I just had to re-implement the global allocator so it used no imports. I used the same method as the regular Windows allocator, I just have to get the
GetProcessHeap() address, as the project has to work in an environment where the is no IAT.
Yea, I know there's not classes. It's al structs. I have been programming for only a short time, and even shorter time with Rust, so forgive me if I don't use the proper nomenclature.
If you use GPLv2 I believe you have to use MIT as license for rust standard library usage. The FSF considers Apache-2.0 to be incompatible with GPLv2:
Despite our best efforts, the FSF has never considered the Apache License to be compatible with GPL version 2, citing the patent termination and indemnification provisions as restrictions not present in the older GPL license. The Apache Software Foundation believes that you should always try to obey the constraints expressed by the copyright holder when redistributing their work.
This is a good idea. So I would split the stuff from the Rust library into it's own crate, and put the licenses there, and then the rest of the code could be under whatever license?
Since you said module, would I need to make a whole separate GH repo, or could it all be in one?
Sorry for the noob questions. haha.
It does seem that APACHE and MIT license are compatible (GPL 3), if I put them in their own module.
Oh, yea. I forgot to mention, I would probably use GPL 3.0 unless that is a bad license. Really I just want people to contribute to the project, and I don't want people to take the code for themselves, modify it, and then not share with the rest of the Rust community.
A big goal of this project is to encourage reverse engineering Rust binaries. The project itself is a framework for pen-testers to use Rust in their payloads.
As long as its clear what the license for which things are, it's fine to have it in one repository.
You may want to compare with what the Linux kernel is doing to import the Rust alloc crate.
- The linux repository has it in a folder
rust/alloc/ in the same repository as everything else.
- The directory has a readme that talks a bit about licenses. link
- All of the files contain
// SPDX-License-Identifier: Apache-2.0 OR MIT at the top.
Similarly, the Rust compiler also imports LLVM code, which is under slightly different terms than the rest of Rust. You can find an explanation here.
Thank you, everyone, for your replies! This was really helpful!
Thanks for all the resources, too! I think I know what I have to do!
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.