# Compiling Scala and Sbt for Debian distro

**URL:** <https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620>\
**Category:** Scala Platform\
**Created:** [August 17, 2019, 5:42am UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620 "2019-08-17T05:42:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tfinneid](https://contributors.scala-lang.org/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@tfinneid](https://contributors.scala-lang.org/u/tfinneid)\
**Post date:** [August 17, 2019, 5:42am UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/1 "2019-08-17T05:42:51Z")

</div>

Hi, some months ago I was looking into compiling scala for the Debian project, but got caught in the circular dependency of Sbt/Scala and buld.sbt (among many other related questions such as jdk version compatability, debian packaging rules and so on).

One thing that stuck with me from those discussion, was that @SethTisue and @eed3si9n made som interresting comments about compiling for Debian use.

As far as I remember, one needs Sbt to build Scala and Scala to build Sbt, there is currently no other way to build either. But the build process for Scala and Sbt can be simplified for Debian packaging purposes, as testing and QA of code changes is performed by the respective projects.

The strategy would, I suppose, be to compile Scala by a simplified process, and use that as a basis for compiling Sbt by a simplified process.

What is the simplest way to compile Scala from command line, to make a a release usable as a Debian package and to buld Sbt? Can it be done with Javac, some library dependencies and perhaps som java code generationt tools, from command line? (I assume so, just wanting to check the strategy first, then figure out how to do that)

Regards

Thomas

---

<div class="post-metadata">

**Author:** ![smarter](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/smarter/32/92_2.png) [@smarter](https://contributors.scala-lang.org/u/smarter)\
**Post date:** [August 17, 2019, 9:57am UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/2 "2019-08-17T09:57:56Z")

</div>

> [@tfinneid](#):
>
> Can it be done with Javac, some library dependencies and perhaps som java code generationt tools, from command line?

No. You need a previous recent enough version of scalac to compile scalac, we discussed this before: [Question about building scala and sbt proper - #10 by smarter](https://contributors.scala-lang.org/t/question-about-building-scala-and-sbt-proper/2811/10)

---

<div class="post-metadata">

**Author:** ![tfinneid](https://contributors.scala-lang.org/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@tfinneid](https://contributors.scala-lang.org/u/tfinneid)\
**Post date:** [August 17, 2019, 12:50pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/3 "2019-08-17T12:50:02Z")

</div>

Yeah, that last discussion pluss the other discussions I had at the same time was a confusing experience…

Put another way, even the scala compiler is written in Scala…

I am not quite ready to give up though, even if its a gordian sized problem. So exploring it from another perspective…

Scala programs can be run from a java command line, with the scala jar file as a classpath dependency. So two questions here:

1. do you thinkg a basic scala compiler system be built running from java with the Scala jar file
2. would it be possible to decompile that scala jar fil into java code, to be compiled back to a minimal scala runtime environment, enough to compile a scala release?

Regards

Thomas

---

<div class="post-metadata">

**Author:** ![smarter](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/smarter/32/92_2.png) [@smarter](https://contributors.scala-lang.org/u/smarter)\
**Post date:** [August 17, 2019, 1:06pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/4 "2019-08-17T13:06:52Z")

</div>

> [@tfinneid](#):
>
> 1. do you thinkg a basic scala compiler system be built running from java with the Scala jar file

I don’t understand this question, what does “running from java with the Scala jar file” mean ?

> [@tfinneid](#):
>
> would it be possible to decompile that scala jar fil into java code, to be compiled back to a minimal scala runtime environment, enough to compile a scala release?

It’s not impossible, but it would be a lot of work.

---

<div class="post-metadata">

**Author:** ![BalmungSan](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/balmungsan/32/1250_2.png) [@BalmungSan](https://contributors.scala-lang.org/u/BalmungSan)\
**Post date:** [August 17, 2019, 1:08pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/5 "2019-08-17T13:08:11Z")

</div>

I do not think this is really a new problem.

For example, GCC is written in C. You need GCC to build GCC.  
Usually one simple download a prebuilt version, and use it to build the version one wants.

I would assume that is what is done to build the debian package for GCC, but it may be worth checking what is their solution.

---

<div class="post-metadata">

**Author:** ![smarter](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/smarter/32/92_2.png) [@smarter](https://contributors.scala-lang.org/u/smarter)\
**Post date:** [August 17, 2019, 1:15pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/6 "2019-08-17T13:15:14Z")

</div>

> [@tfinneid](#):
>
> would it be possible to decompile that scala jar fil into java code, to be compiled back to a minimal scala runtime environment, enough to compile a scala release?

On top of being a lot of work, I don’t think that this is enough to get your package in Debian, quoting from [Reject FAQ for Debian's NEW-Queue](https://ftp-master.debian.org/REJECT-FAQ.html) :

> Serious violations (direct rejects even if we only find one point)  
> …  
> Generated files: Your package contains generated files (such as compressed .js libraries) without corresponding original form. They’re not considered as the preferred form of modification, so you will either have to provide corresponding original form, or remove them from your tarball, eventually depending on an already available packages to provide missing features.

Decompiling Scala classfiles into Java source files is definitely not going to produce anything that can be called “the preferred form of modification”, even if it’s technically source code.

As I said last time we discussed this, you’ll need an exemption from the normal rules to get an up-to-data scalac in the archive, this is the only sane way to do it. Debian has many other bootstrapped compilers in their archive, which must have gotten in through some process, you just need to figure out what that process is, I suggest asking on the relevant Debian mailing-list.

---

<div class="post-metadata">

**Author:** ![sjrd](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/sjrd/32/24_2.png) [@sjrd](https://contributors.scala-lang.org/u/sjrd)\
**Post date:** [November 19, 2019, 10:25am UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/7 "2019-11-19T10:25:30Z")

</div>

Split this topic on November 19, 2019, 10:25am UTC

3 posts were split to a new topic: [Off-topic: Digression about GPL licenses](https://contributors.scala-lang.org/t/off-topic-digression-about-gpl-licenses/3815)

---

<div class="post-metadata">

**Author:** ![SethTisue](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/sethtisue/32/3185_2.png) [@SethTisue](https://contributors.scala-lang.org/u/SethTisue)\
**Post date:** [August 17, 2019, 9:09pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/9 "2019-08-17T21:09:41Z")

</div>

> [@smarter](#):
>
> As I said last time we discussed this, you’ll need an exemption from the normal rules to get an up-to-data scalac in the archive, this is the only sane way to do it. Debian has many other bootstrapped compilers in their archive, which must have gotten in through some process, you just need to figure out what that process is, I suggest asking on the relevant Debian mailing-list.

Seconded.

This is the answer, this is the only answer, this has always been the answer every time this has come up over the years. There is only one answer to this.

---

<div class="post-metadata">

**Author:** ![ashawley](https://contributors.scala-lang.org/letter_avatar_proxy/v4/letter/a/53a042/32.png) [@ashawley](https://contributors.scala-lang.org/u/ashawley)\
**Post date:** [August 18, 2019, 3:09pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/10 "2019-08-18T15:09:25Z")

</div>

Since Scala 2.11 and sbt 0.13 are in Debian, it would require building Scala 2.12.0 with Scala 2.11 and an old sbt 0.13. This is the loose thread that was missed during the Scala 2.12 rollout, and was probably difficult since it was the first release without the Ant build config.

Unfortunately, it’s a difficult inflection point because there’s a good chance there are a lot of intermediate builds during Scala 2.12 development because of binary breaking changes that were made.

---

<div class="post-metadata">

**Author:** ![smarter](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/smarter/32/92_2.png) [@smarter](https://contributors.scala-lang.org/u/smarter)\
**Post date:** [August 18, 2019, 3:48pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/11 "2019-08-18T15:48:14Z")

</div>

> [@ashawley](#):
>
> Unfortunately, it’s a difficult inflection point because there’s a good chance there are a lot of intermediate builds during Scala 2.12 development

Yep: [Question about building scala and sbt proper - #10 by smarter](https://contributors.scala-lang.org/t/question-about-building-scala-and-sbt-proper/2811/10)

---

<div class="post-metadata">

**Author:** ![SethTisue](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/sethtisue/32/3185_2.png) [@SethTisue](https://contributors.scala-lang.org/u/SethTisue)\
**Post date:** [August 18, 2019, 4:28pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/12 "2019-08-18T16:28:55Z")

</div>

> [@ashawley](#):
>
> it would require building Scala 2.12.0 with Scala 2.11

The Scala 2.12 compiler is written in Scala 2.12 and uses the Scala 2.12 standard library. Compiling it with 2.11 isn’t an option.

(I’m seconding Guillaume, but I’m trying to put it in the plainest possible terms.)

---

<div class="post-metadata">

**Author:** ![tfinneid](https://contributors.scala-lang.org/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@tfinneid](https://contributors.scala-lang.org/u/tfinneid)\
**Post date:** [August 18, 2019, 10:05pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/13 "2019-08-18T22:05:45Z")

</div>

> [@SethTisue](#):
>
> The Scala 2.12 compiler is written in Scala 2.12 and uses the Scala 2.12 standard library. Compiling it with 2.11 isn’t an option.

Sorry for my ignorance, but how is the very first Scala 2.12 version (v2.12.0-M1) built, if not with the last 2.11 release?

---

<div class="post-metadata">

**Author:** ![tfinneid](https://contributors.scala-lang.org/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@tfinneid](https://contributors.scala-lang.org/u/tfinneid)\
**Post date:** [August 18, 2019, 10:31pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/14 "2019-08-18T22:31:25Z")

</div>

> [@smarter](#):
>
> Generated files: Your package contains generated files (such as compressed .js libraries) without corresponding original form. They’re not considered as the preferred form of modification, so you will either have to provide corresponding original form, or remove them from your tarball, eventually depending on an already available packages to provide missing features.

From my discussions with the Debian team, it means that a package can not contain binary code built from somewhere else. It means all packages must be built from source code that can be built using Debian built tools on debian servers. So an uncompressed .js source file is ok, beccause its the original source. But a generated .js file must be generated from the original source (another example: IDL definition file) on a Debian server, not by an external machine.

So my assumption is that by decompiling scala into java, that source code (as long as the Scala license allows) could be used to build a minamal scala runtime to be included on debian tooling server (dont remember what that server infrastructure was called at the moment) so that it can be used as a legal tool to build a proper scala distribution on the proper Debian build servers. (actually releases: testing, unstable etc, which have their separate build environments and tools available)

---

<div class="post-metadata">

**Author:** ![tfinneid](https://contributors.scala-lang.org/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@tfinneid](https://contributors.scala-lang.org/u/tfinneid)\
**Post date:** [August 18, 2019, 10:46pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/15 "2019-08-18T22:46:46Z")

</div>

> [@BalmungSan](#):
>
> For example, GCC is written in C. You need GCC to build GCC.  
> Usually one simple download a prebuilt version, and use it to build the version one wants.

I dont remeber the exact history of the GCC development, but I think that the first version of GCC was written by hand by Richard Stallman in 1984. I dont know how it was built. that part is quite scetchy, but several other languages are mentioned, so maybe one of those language environments were free.

---

<div class="post-metadata">

**Author:** ![smarter](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/smarter/32/92_2.png) [@smarter](https://contributors.scala-lang.org/u/smarter)\
**Post date:** [August 18, 2019, 10:48pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/16 "2019-08-18T22:48:56Z")

</div>

> [@tfinneid](#):
>
> But a generated .js file must be generated from the original source (another example: IDL definition file) on a Debian server, not by an external machine.

And a generated .java file must be generated from the original .scala source, except you’re proposing to upload directly to a Debian server some generated java files, do you see how this is as problematic as generated js files?

---

<div class="post-metadata">

**Author:** ![tfinneid](https://contributors.scala-lang.org/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@tfinneid](https://contributors.scala-lang.org/u/tfinneid)\
**Post date:** [August 18, 2019, 11:02pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/17 "2019-08-18T23:02:08Z")

</div>

> [@SethTisue](#):
>
> This is the answer, this is the only answer, this has always been the answer every time this has come up over the years. There is only one answer to this.

I would prefer that solution myself, but the Debian team does not. I discussed this with them the last time and they were adament that the only acceptable solution was to build from scratch using debian tools.

I even suggested simply adding scala to the non-free repository, but they allways shifted the discussion back into how to build it for Debian properly.

The current Scala and Sbt are as @smarter hints, built by the the source package containing a downloaded scala and sbt in a build-lib/ directory. The maintainers did not know this, so they explicitly told me that that was not an option for how to proceed. I think the current Sbt package (0.13) has been, or is going to be, removed from the the proper Debian releases, because of that infraction.

So if this is the only solution, then I ask for help on how to argue the case, by concrete examples and such. Or by figuring out how to get an acceptable Debian build using scala. I know that the tooling server can be used to build early version of tools to use to install on the proper build servers. But I dont know the Debian infrastructure or rules well enough, so any suggestion is valuable.

---

<div class="post-metadata">

**Author:** ![smarter](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/smarter/32/92_2.png) [@smarter](https://contributors.scala-lang.org/u/smarter)\
**Post date:** [August 18, 2019, 11:03pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/18 "2019-08-18T23:03:53Z")

</div>

> [@tfinneid](#):
>
> So if this is the only solution, then I ask for help on how to argue the case, by concrete examples and such.

Just ask them how Rust got into the archive.

---

<div class="post-metadata">

**Author:** ![tfinneid](https://contributors.scala-lang.org/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@tfinneid](https://contributors.scala-lang.org/u/tfinneid)\
**Post date:** [August 18, 2019, 11:25pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/19 "2019-08-18T23:25:01Z")

</div>

> [@smarter](#):
>
> And a generated .java file must be generated from the original .scala source, except you’re proposing to upload directly to a Debian server some generated java files, do you see how this is as problematic as generated js files

I understand what you say, but notice it states “corresponding original form”, which is not the same as “actual original code”

I might be wrong in my assumption, but my argument is the nuance that the IDL file is the source, while the js file isnt. The java file, on the other hand, is a reverse engineered file. Dont know if that argument will pass by the Debian team, but I will ask the Debian team if possible.

My understanding is that they are concerned with the source code being built on Debian servers from scratch and that its is free, not neccesarily that the code has to be “the actual handwritten original source code file”. The source code must be included so its humanly readable and compilable independently of any external tools or dependencies. Thats Debians primary concern as I understand it.

---

<div class="post-metadata">

**Author:** ![smarter](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/smarter/32/92_2.png) [@smarter](https://contributors.scala-lang.org/u/smarter)\
**Post date:** [August 18, 2019, 11:39pm UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/20 "2019-08-18T23:39:02Z")

</div>

> [@tfinneid](#):
>
> I understand what you say, but notice it states “corresponding original form”, which is not the same as “actual original code”

What ? Original means original, there’s no such thing as a “non-actual original”.

> [@tfinneid](#):
>
> The java file, on the other hand, is a reverse engineered file.

Which mean in particular that it’s not _the preferred form of modification_, which is how [Reject FAQ for Debian's NEW-Queue](https://ftp-master.debian.org/REJECT-FAQ.html) defines “generated files”. Without this rule, you could just take any random binary, disassemble it into [gas syntax](https://en.wikipedia.org/wiki/GNU_Assembler) and call the result “source code”. It’s text so it’s technically human-readable, but it would of course never be accepted into Debian.

---

<div class="post-metadata">

**Author:** ![tfinneid](https://contributors.scala-lang.org/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@tfinneid](https://contributors.scala-lang.org/u/tfinneid)\
**Post date:** [August 19, 2019, 12:05am UTC](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620/21 "2019-08-19T00:05:03Z")

</div>

> [@smarter](#):
>
> Which mean in particular that it’s not _the preferred form of modification_ , which is how [Reject FAQ for Debian's NEW-Queue](https://ftp-master.debian.org/REJECT-FAQ.html) defines “generated files”…

This question is getting too Debian specific, so I’ll move the discussion over to the Debian devel mailing-list. Please join the discussion on the Debian list to help figure out a way to get Debian approval.

[Next page](https://contributors.scala-lang.org/t/compiling-scala-and-sbt-for-debian-distro/3620.md?page=2)
