# Julia in a VM

**URL:** <https://discourse.julialang.org/t/julia-in-a-vm/12781>\
**Category:** New to Julia\
**Created:** [August 1, 2018, 9:53am UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781 "2018-08-01T09:53:34Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![ckoe-bccms](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ckoe-bccms/32/1816_2.png) [@ckoe-bccms](https://discourse.julialang.org/u/ckoe-bccms)\
**Post date:** [August 1, 2018, 9:53am UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/1 "2018-08-01T09:53:34Z")

</div>

Hello,

just a quick question. I tried to start julia 0.7.0 beta2 from some nightly build tar.gz available from the website in a VM which gave me an error  
`ERROR: Unable to find compatible target in system image.`  
The VM runs stock debian 9 (stretch) x86\_64, the CPU type is

```julia
head /proc/cpuinfo 
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel Celeron_4x0 (Conroe/Merom Class Core 2)

```

OK, fair enough, that is indeed ancient. I would assume that llvm and/or the instruction set extensions used when building julia would not run on a CPU with that feature set ? Is there some documentation/ table where I could look up what the basic requirements for those nightly builds are ? Also, If I would build it myself from source, would it be possible to get it to run on that VM ? What is the minimal CPU feature set in that case ?

Best Regards

---

<div class="post-metadata">

**Author:** ![gdkrmr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdkrmr/32/2791_2.png) [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Post date:** [August 1, 2018, 12:01pm UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/2 "2018-08-01T12:01:13Z")

</div>

The following is only if you build julia yourself, I am not sure how to apply that to downloaded executables:

I built julia on an older netbook with an atom processor and had to set `TARGET=atom` (this is from memory, so it might be slightly different) in the `Make.user`. I guess the build scripts have some problems with older processors, I think you can set `TARGET=pentium4` and it should work for almost anything.

---

<div class="post-metadata">

**Author:** ![ckoe-bccms](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ckoe-bccms/32/1816_2.png) [@ckoe-bccms](https://discourse.julialang.org/u/ckoe-bccms)\
**Post date:** [August 1, 2018, 12:24pm UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/3 "2018-08-01T12:24:22Z")

</div>

OK, thank you ! So the requirements when building from source are still pretty minimal. That is very good to know. I now vaguely remember that I read somewhere that there is an ARM port.

---

<div class="post-metadata">

**Author:** ![gdkrmr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdkrmr/32/2791_2.png) [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Post date:** [August 1, 2018, 12:26pm UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/4 "2018-08-01T12:26:20Z")

</div>

you should have at least 2GB of RAM for the build, else it will swap a lot and take forever.

---

<div class="post-metadata">

**Author:** ![flicaflow](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@flicaflow](https://discourse.julialang.org/u/flicaflow)\
**Post date:** [August 1, 2018, 12:27pm UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/5 "2018-08-01T12:27:04Z")

</div>

I have the same problem when deploying to a virtual box VM on a modern CPU:

cat /proc/cpuinfo  
processor : 0  
vendor\_id : GenuineIntel  
cpu family : 6  
model : 142  
model name : Intel(R) Core™ i7-8550U CPU @ 1.80GHz  
stepping : 10  
cpu MHz : 1992.008  
cache size : 8192 KB  
physical id : 0  
siblings : 1  
core id : 0  
cpu cores : 1  
apicid : 0  
initial apicid : 0  
fpu : yes  
fpu\_exception : yes  
cpuid level : 22  
wp : yes  
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant\_tsc rep\_good nopl xtopology nonstop\_tsc cpuid pni monitor ssse3 pcid sse4\_1 sse4\_2 x2apic hypervisor lahf\_lm invpcid\_single pti fsgsbase invpcid  
bugs : cpu\_meltdown spectre\_v1 spectre\_v2  
bogomips : 3984.01  
clflush size : 64  
cache\_alignment : 64  
address sizes : 39 bits physical, 48 bits virtual

The flags differ drastically from the host:  
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant\_tsc art arch\_perfmon pebs bts rep\_good nopl xtopology nonstop\_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds\_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4\_1 sse4\_2 x2apic movbe popcnt tsc\_deadline\_timer aes xsave avx f16c rdrand lahf\_lm abm 3dnowprefetch epb invpcid\_single intel\_pt ibrs ibpb stibp kaiser tpr\_shadow vnmi flexpriority ept vpid fsgsbase tsc\_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp\_notify hwp\_act\_window hwp\_epp

I’m deploying with nixops to the v-box provider and I’m not sure if I can manipulate the cpuid with nixops. However it would be very interesting to know if this is indeed the problem and what the necessary features are.

Best,  
Florian

---

<div class="post-metadata">

**Author:** ![ckoe-bccms](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ckoe-bccms/32/1816_2.png) [@ckoe-bccms](https://discourse.julialang.org/u/ckoe-bccms)\
**Post date:** [August 1, 2018, 12:32pm UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/6 "2018-08-01T12:32:03Z")

</div>

> [@gdkrmr](#):
>
> you should have at least 2GB of RAM for the build

Does have exactly that much 🙂 But, actually, starting julia at all on that VM was an accident in the first place. But it made me wonder.

---

<div class="post-metadata">

**Author:** ![gdkrmr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdkrmr/32/2791_2.png) [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Post date:** [August 1, 2018, 12:37pm UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/7 "2018-08-01T12:37:33Z")

</div>

> [@ckoe-bccms](#):
>
> I now vaguely remember that I read somewhere that there is an ARM port.

there is for 0.7: [Download Julia](https://julialang.org/downloads/)

---

<div class="post-metadata">

**Author:** ![ckoe-bccms](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ckoe-bccms/32/1816_2.png) [@ckoe-bccms](https://discourse.julialang.org/u/ckoe-bccms)\
**Post date:** [August 1, 2018, 12:40pm UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/8 "2018-08-01T12:40:43Z")

</div>

> [@gdkrmr](#):
>
> there is for 0.7: [Download Julia](https://julialang.org/downloads/)

Right !

---

<div class="post-metadata">

**Author:** ![ckoe-bccms](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ckoe-bccms/32/1816_2.png) [@ckoe-bccms](https://discourse.julialang.org/u/ckoe-bccms)\
**Post date:** [August 1, 2018, 12:51pm UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/9 "2018-08-01T12:51:24Z")

</div>

> [@flicaflow](#):
>
> hypervisor

Might it be checking for that flag indicating it is a VM? On the other hand that somehow does not make sense at all to me.

---

<div class="post-metadata">

**Author:** ![rened](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rened/32/19968_2.png) [@rened](https://discourse.julialang.org/u/rened)\
**Post date:** [August 2, 2018, 11:46am UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/10 "2018-08-02T11:46:28Z")

</div>

@flicaflow and I found out the following: Julia needs the `cx16` CPU flag [1] in its most generic sysimg build [2]. `cx16` is available since Pentium D / Core 2 Duo days. But when using Virtualbox, the setting `nested paging` needs to be turned on, so that the guest can see the `cx16` cpuflag (check with `cat /proc/cpuinfo`).

You can enable this in the Virtualbox UI in Machine → Settings → System → Acceleration → Enable Nested Paging. You can also use the `VBoxManage vmmodify` command in the terminal to set `--nestedpaging on`.

Alternatively [2] mentions that Julia can be built with the `-cx16` flag, which might make it work on even older CPUs / lower capabilities (we did not test this).

[1] [http://www.tomshardware.co.uk/answers/id-2396559/cmpxchg16b-compatible-cpu.html](http://www.tomshardware.co.uk/answers/id-2396559/cmpxchg16b-compatible-cpu.html)  
[2] [julia/processor\_x86.cpp at 906db16e52226ce142777a71fd246c4b820f58cf · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/blob/906db16e52226ce142777a71fd246c4b820f58cf/src/processor_x86.cpp#L149-L151)

---

<div class="post-metadata">

**Author:** ![ckoe-bccms](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ckoe-bccms/32/1816_2.png) [@ckoe-bccms](https://discourse.julialang.org/u/ckoe-bccms)\
**Post date:** [August 2, 2018, 12:09pm UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/11 "2018-08-02T12:09:21Z")

</div>

Hello,

apparently qemu/kvm which is used in my case does not expose that flag by default. Or the debian guest does not pick it up for some reason. A quick google does not come up with something directly useful why this flag might be missing. And the debian guest apparently does not care 🙂

EDIT: Or the CPU which is emulated (Conroe/Merom Class Core 2) is really to old, if I understand correctly @flicaflow uses virtualbox

EDIT2: Well, apparently the penryn 45 nm die shrink is the first CPU with cx16, the merom 65 nm (and presumably the 65 nm conroe) does not have it. Well, bad luck 🙂

---

<div class="post-metadata">

**Author:** ![Karsten](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karsten/32/565_2.png) [@Karsten](https://discourse.julialang.org/u/Karsten)\
**Post date:** [September 18, 2018, 10:17am UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/12 "2018-09-18T10:17:18Z")

</div>

I had the same problem ( `ERROR: Unable to find compatible target in system image.`) using VirtualBox . Although Nested Paging was enabled and my CPU does support `cx16` (CMPXCHG16B), that flag wasn’t exposed to the guest.

To fix this issue I had to manually enabled CMPXCHG16B via

```
VBoxManage setextradata global VBoxInternal/CPUM/CMPXCHG16B 1

```

---

<div class="post-metadata">

**Author:** ![Sofie8](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sofie8/32/24117_2.png) [@Sofie8](https://discourse.julialang.org/u/Sofie8)\
**Post date:** [April 16, 2021, 9:33pm UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/13 "2021-04-16T21:33:52Z")

</div>

This line didn’t work for us.  
Is not very clear what I need to do:  
[reference](https://github.com/JuliaLang/julia/issues/40503)

Building like this? When or where to add the -cx16 flag?

git clone git://github.com/JuliaLang/julia.git  
git checkout v1.6.0  
./julia

Thanks!

---

<div class="post-metadata">

**Author:** ![jameson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jameson/32/23_2.png) [@jameson](https://discourse.julialang.org/u/jameson)\
**Post date:** [April 16, 2021, 9:44pm UTC](https://discourse.julialang.org/t/julia-in-a-vm/12781/14 "2021-04-16T21:44:13Z")

</div>

You’re missing the `make` step, but yes. I think the `-cx16` may be autodetected then (since the default is to build for the current machine), but you’ll also need to specify `USE_BINARYBUILDER=0` (either on the same line as `make`, or in a file named `Make.user`)
