Author Topic: meshmixer on ANY Linux release: here's how  (Read 8007 times)

Patola

  • Newbie
  • *
  • Posts: 14
    • View Profile
meshmixer on ANY Linux release: here's how
« on: February 05, 2016, 12:31:18 AM »
Hi, people, if you follow my posts you'll know that I was struggling to get meshmixer working in my Ubuntu 15.10 and even tried to 'hack' into the package to change its dependencies.

I just found out a method that allows me to use it in my computer in whichever version of Ubuntu I am, and I would like to share.

The way to accomplish that is by using the lightweight virtualization solution "LXC", based in containers. So you just need lxc installed on your distro and then you need to install a container with Ubuntu 14.04 64-bits in it, set up necessary conditions for display and then install Ubuntu.

I borrowed from two guides from St├ęphane Graber, this one and this one. I skipped the pulseaudio part, since meshmixer does not use sound.

After I installed LXC, I just created a trusty tahr (Ubuntu LTS 14.04) container from the templates:

Code: [Select]
sudo lxc-create -n ubuntu1404 -t ubuntu -- --release trusty
After LXC took its time to download and install Ubuntu and set up the 'ubuntu' user, I changed its configuration, from outside the container, to allow for GUI redirection (note: the container by default in Ubuntu resides under /var/lib/lxc/your_container_name (in my case, /var/lib/lxc/ubuntu1404). You better ensure there is enough space since it can take a couple gigabytes (took 3 in my installation).

Note: wherever a ubuntu1404 appears, change for your container name.

Then I proceeded to edit its configuration (I use vi, you might change for your favorite text editor here):

Code: [Select]
sudo vi /var/lib/lxc/ubuntu1404/config
And added the following, at the end of the file:

Code: [Select]
lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none bind,optional,create=dir
lxc.mount.entry = /dev/video0 dev/video0 none bind,optional,create=file

lxc.cgroup.devices.allow = c 195:* rwm

I started the container. It gives you a prompt, and that is the way we will get to it to run meshmixer when it's ready:

Code: [Select]
sudo lxc-start -n ubuntu1404 -F
Enter login ubuntu / password ubuntu at the prompt.
You will have to uninstall lightdm / gdm / kdm because its startup script removes the all-important file /tmp/.X11-unix/X0 which is an unix socket for communicating with the graphics subsystem. You will also have to prevent the initialization cleaning of /tmp because it also removes this file.
And, as a bonus, you might want to add the i386 architecture, since it comes unconfigured by default.
You will need to add some stuff to ~/.bashrc and also add yourself to the 'video' group.

Code: [Select]
sudo apt-get --purge remove gdm kdm lightdm
sudo dpkg --add-architecture i386
sudo apt-get update
sudo sed -i '/^#TMPTIME.*/TMPTIME=60/' /etc/default/rcS
echo -e '\n# For X11 to work\nexport DISPLAY=:0.0\nexport QT_X11_NO_MITSHM=1\nexport GNOME_DESKTOP_SESSION_ID=this_is_deprecated' >> ~/.bashrc
sudo adduser ubuntu video

Now, install some opengl software just so that it has the necessary libraries to render everything correctly. You also need to install the very same libraries that make GPU acceleration work in your system. In my case, I installed nvidia-libopencl1-340 and nvidia-340. Let's also download gdebi and wget, to download and install meshmixer.

Code: [Select]
sudo apt-get install nvidia-libopencl1-340 nvidia-340 glmark2 mesa-utils wget gdebi xterm
sudo apt-get clean
wget https://s3.amazonaws.com/autodesk-meshmixer/meshmixer/amd64/meshmixer_2.9_amd64.deb

You might want to stop your lxc after that and reboot the host, since from its first invocation it erased your /tmp/.X11-unix/X0. From a terminal outside lxc:

Code: [Select]
sudo lxc-stop -n ubuntu1404
After rebooting and starting your lxc again, having logged in, proceed to install meshmixer with its dependencies:

Code: [Select]
sudo gdebi meshmixer_2.9_amd64.deb
cd ~/Documents
wget https://meshmixer.s3.amazonaws.com/meshmixer.zip
unzip meshmixer.zip && rm meshmizer.zip

It's done. You can start meshmixer through the terminal now but you might want to test the graphical subsystem and acceleration before. The programs xterm, glxinfo and glmark2 will help you with that. Try them in sequence:
Code: [Select]
xterm
glxinfo
glmark2
meshmixer

This recipe can easily be generalized for whatever software you need to run in a specific version of Ubuntu.

Please let me know if you have any problems! I hope to have told you all the steps I have taken, although I skipped the "banging the head on the wall" part.

« Last Edit: February 05, 2016, 04:29:09 PM by MagWeb »

MagWeb

  • Administrator
  • Hero Member
  • *****
  • Posts: 1176
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #1 on: February 05, 2016, 05:51:28 PM »
@ my Edit above:
Sorry - due to forum settings there was a problem to approve posts. So I tried different things as running your post through an Admin-Edit process without changing any of your content.  This issue should be fixed now.
I'm just a user as you are. Being no Autodesk employee: I do not know where this road will lead to, nor do I claim to've all stuff got right.

Patola

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #2 on: February 06, 2016, 01:56:00 AM »
Thanks!

mattcaron

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #3 on: February 06, 2016, 09:40:26 AM »
So, if any if the devs are reading this, look at https://www.docker.com. It automates the above and would allow you to run on different Linux distros pretty painlessly.

Heck, if you have a version of 3.0 that runs on Ubuntu 14.04 which you can release, I'll make a Docker package of it. I've never done it before, but I've been wanting to play with it and this gives me an excuse.
« Last Edit: February 06, 2016, 09:43:31 AM by mattcaron »

Patola

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #4 on: February 09, 2016, 11:12:11 AM »
So, if any if the devs are reading this, look at https://www.docker.com. It automates the above and would allow you to run on different Linux distros pretty painlessly.

Heck, if you have a version of 3.0 that runs on Ubuntu 14.04 which you can release, I'll make a Docker package of it. I've never done it before, but I've been wanting to play with it and this gives me an excuse.

Ok, just achieved the same result with docker. However it is still not generalized, won't work with many GPUs, and it needs heavy improvements, but for the time being I am sharing the Dockerfile I used to build the image and the command to run the container (you'll have to change the container id in the beginning of the file). If you wish to modify these to generalize them, feel free do that!

The Dockerfile has a section where it creates a phony "zenity" and "notify-send" and puts their directory in the beginning of the $PATH system variable so that they are ran instead of the "real" commands. This part is necessary to sidestep the user-assisted post-installation script of meshmixer, which asks the user if it should add the meshmixer repository. So it adds the repository without user intervention. I would advise the developers who built the .deb package's postinst script to check for a terminal or for the $DISPLAY variable before asking the user, according to the debian policy guidelines. I could adapt the script if external collaboration is accepted.

« Last Edit: February 09, 2016, 02:41:32 PM by Patola »

Patola

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #5 on: February 18, 2016, 11:53:55 PM »
Is anybody having any success with my recipes?
I really have an interest in people running meshmixer on their linuxes. It's of great value. So if I can make this as easy as it gets, I would be happy.

ezrec

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #6 on: April 24, 2016, 07:32:49 PM »
The docker recipe worked for me, as follows:

Code: [Select]
$ mkdir meshmixer
$ cd meshmixer
$ cp ~/Downloads/Dockerfile.txt Dockerfile
$ docker build -t "meshmixer:ubuntu" .
.... wait for the build to complete ...
Removing intermediate container 94bb3eafe244
Successfully built f6e1394343c7
$ sed -e 's/mydockerimage=.*/mydockerimage=f6e1394343c7/' <~/Downloads/run-docker-meshmixer.sh.txt >meshmixer.sh
$ chmod +x meshmixer.sh
$ ./meshmixer.sh

I added '--volume "${HOME}:/root:rw"' to the meshmixer.sh script, to make it easier to get to my files.

Thanks for the starting point!

Typhon

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #7 on: April 28, 2016, 01:39:59 AM »
I'm attempting to get your docker/meshmixer to work on Fedora 23, with mixed results... though a good way to re-learn what little I knew of Linux.

Initially it took a while to get it to play nice with X server, which I later realized was an issue with SELinux locking out access, remedied temporarily with "setenforce 0"
Second issue was the script used a couple devices not present on my system "-- device /dev/nvidia0..."  changed to --device=/dev/dri/card0:/dev/dri/card0"

Now meshmixer will load, but Opengl is not functional

-Added Intel Opengl drivers (info found here https://ask.fedoraproject.org/en/question/24736/how-to-install-intel-linux-graphics-drivers-using-the-official-installer/)

Still no dice on the Opengl yet.... any thoughts?

Patola

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #8 on: April 28, 2016, 03:17:31 AM »
I'm attempting to get your docker/meshmixer to work on Fedora 23, with mixed results... though a good way to re-learn what little I knew of Linux.

I am sorry for robbing you of productive time. I wish I could have made a simpler recipe!

Initially it took a while to get it to play nice with X server, which I later realized was an issue with SELinux locking out access, remedied temporarily with "setenforce 0"

Hmm, I did not think of that. Indeed, Fedora uses SELinux while Ubuntu uses AppArmor, which takes care of these things by the LXC container automatically.

Second issue was the script used a couple devices not present on my system "-- device /dev/nvidia0..."  changed to --device=/dev/dri/card0:/dev/dri/card0"

Now meshmixer will load, but Opengl is not functional

Aren't there any other devices the Intel GPU driver creates? Like /dev/video0 or /dev/dri/somethingelse ? That might be the problem. The only computer where I had an Intel video driver to check this info is not available anymore and I could not find it yet through a quick google search.

-Added Intel Opengl drivers (info found here https://ask.fedoraproject.org/en/question/24736/how-to-install-intel-linux-graphics-drivers-using-the-official-installer/)

Still no dice on the Opengl yet.... any thoughts?

Not yet. Do you have any error message to help find the issue? Have you ran glxinfo, glxgears etc. within the container to check?

Typhon

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #9 on: April 29, 2016, 01:59:11 AM »
I am sorry for robbing you of productive time. I wish I could have made a simpler recipe!
Hmm, I did not think of that. Indeed, Fedora uses SELinux while Ubuntu uses AppArmor, which takes care of these things by the LXC container automatically.

Aren't there any other devices the Intel GPU driver creates? Like /dev/video0 or /dev/dri/somethingelse ? That might be the problem. The only computer where I had an Intel video driver to check this info is not available anymore and I could not find it yet through a quick google search.


Not yet. Do you have any error message to help find the issue? Have you ran glxinfo, glxgears etc. within the container to check?


No worries! I appreciate the fact someone smarter than I is looking into solving the issue.

The SElinux issue was minor once I realized what was happening.

The GPU related devices I included in my docker script are as follows:
        --device=/dev/video0:/dev/video0 \
        --device=/dev/dri/card0:/dev/dri/card0 \
        --device=/dev/dri/controlD64:/dev/dri/controlD64 \
        --device=/dev/dri/renderD128:/dev/dri/renderD128 \

The /dri devices are Direct Rendering Infrastructure, so I assumed they might be necessary for X server, GLX and Opengl

Checking glxinfo on my system indicates direct rendering is functional, and glxgears et all function correctly. HOWEVER.. when I execute any glx related commands in the docker I get:
Quote
Running glxinfo in docker
name of display: :0.0
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  31
  Current serial number in output stream:  32

I'm trying to wrap my head around how the docker interacts with the main system environment, as it seems odd that GLX works externally...Is something missing from the docker?

JustinHorb

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • ?????? ????? ??? ??????????? ??? ??????
meshmixer on ANY Linux release heres how
« Reply #10 on: September 27, 2016, 10:09:34 PM »
i am finally going to make the jump to linux and wanted to know how things are working of late. ive kinda been reading mixed results of late on how well it runs under wine.  im going to be using Ubuntu.  any problems using the latest build of newsbin?
?????? ????? ??? ??????????? ??? ??????  More info>>>

Patola

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #11 on: September 27, 2016, 10:20:22 PM »
The latest builds of meshmixer for Windows, including the latest beta, work wonderfully if and only if you use the right mfc110u.dll library with it. See your windows installations to check if you can find this file. It has to be this type, for the 32 bits version of meshmixer:

Code: [Select]
[23:09] [4938] [patola@ovo Meshmixer]% file mfc110u.dll
mfc110u.dll: PE32 executable (DLL) (console) Intel 80386, for MS Windows

Then you can use PlayOnLinux to create a 32-bit "windows/wine" Installation (I could not make the 64-bit version work correctly and I gave up after I got the 32 bit working. Don't worry, you can use the 32-bit version in a 64-bit computer). After you finish the install (don't make it run meshmixer yet), copy the mfc110u.dll file to the meshmixer directory (~/.PlayOnLinux/wineprefix/meshmixer/drive_c/Program Files/Autodesk/Meshmixer/). You should need no other DLLs.

Just for completeness, the version I am using of mfc110u.dll here has this md5sum:

Code: [Select]
[23:09] [4939] [patola@ovo Meshmixer]% md5sum mfc110u.dll
b8de851298e99a005bfd34aa906b3fe8  mfc110u.dll

I hope yours work ok.

Best scenario would be if autodesk people made a snap or flatpak of meshmixer... But they seem to have given up on Linux :(
« Last Edit: September 27, 2016, 10:23:57 PM by Patola »

mattcaron

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #12 on: December 01, 2016, 01:29:55 PM »
As an addendum to the above. If you do the install under play on linux, and select the "Install Some Libraries" option, then "32 bits windows installation", then scroll down the big list of things to install and find "POL_Install_vcrun2012", it will get the mfc110u.dll you need as part of the VC redistributable package from Microsoft.

leonard7e

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: meshmixer on ANY Linux release: here's how
« Reply #13 on: April 17, 2017, 04:11:41 PM »
This is my first posting ...
got meshmixer working on ubuntu 16.10 with your docker image. Thank you!

Would flatpak be an idea to share MeshMixer accross different linux distributions?