Running vmxpi_hal_cpp library in LabVIEW chroot jail

198 views
Skip to first unread message

HAO

unread,
Apr 16, 2021, 3:13:14 PM4/16/21
to vmx-pi
I want to develop VMX HAL Library for LabVIEW using vmxpi_hal_cpp library, but i dont know why the library is not executable in LabVIEW chroot jail running on Raspberry Pi 4?
螢幕擷取畫面 2021-04-16 032650.png
could you help me to building vmxpi_hal_cpp library in LabVIEW chroot?
or is there any way i can compile it by myself?
or is there actually no need to recompile, or is there a better way?

Scott Libert

unread,
Apr 17, 2021, 6:25:26 PM4/17/21
to vmx-pi
The relevant error message being output is:

"W:  Failed to change to directory /usr/local/lib/vmxpi':  No such file or directory"
"I:  This directory does not exist inside the chroot.  Use the --directory option to run the command in a different directory."

/usr/local/lib/vmxpi is the directory on linux where the vmx-pi HAL libraries are installed.  

I am not experienced with chroot, but it appears you will need to make the directory where the vmx-pi HAL libraries are installed visible within the chroot environment.

> could you help me to building vmxpi_hal_cpp_library in LabVIEW chroot?  or is there any way i can compile it by myself?

The VMX-pi HAL cpp Library is not open source, so you won't be able to build it.

> or is there actually no need to recompile, or is there a better way?

I believe the best approach is to determine how to make the library's installation path (/usr/local/lib/vmxpi) available to the chroot environment.  Perhaps the approach discussed here will help.

- scott

HAO

unread,
Apr 18, 2021, 5:29:25 PM4/18/21
to vmx-pi
I known why vmxpi_hal_cpp library not executable in LabVIEW chroot, because the chroot are using soft-float architecture.
Different from hard-float used outside of chroot.
so you just cross-compile the library using arm-none-linux-gnueabi-gcc.

螢幕擷取畫面 2021-04-19 052549.png
↑Outside of the chroot jail(hard-float)

螢幕擷取畫面 2021-04-19 052718.png
↑Inside of the chroot jail(soft-float)

Please help me, very very thank you!
scott...@gmail.com 在 2021年4月18日 星期日上午6:25:26 [UTC+8] 的信中寫道:

Scott Libert

unread,
Apr 18, 2021, 5:55:50 PM4/18/21
to vmx-pi
> the chroot are using soft-float architecture.
> Different from hard-float used outside of chroot.

My understanding is hard-float libraries can be used in a chroot environment.
Hardware FPU is available on Raspberry pi.
Soft-float by default will use hardware FPU, if it is available, and these libraries will also work on Raspberry Pi.

VMX-pi HAL library is used from multiple languages uses other pre-compiled libraries - all designed to run correctly on raspberry Pi.  What you are asking for is a very large change.  More importantly, I do not clearly understand why it should be required, or what other workarounds might exist to solve the issue you have.

The last error message reported was:  "W:  Failed to change to directory /usr/local/lib/vmxpi':  No such file or directory".  Did you resolve this issue already?

If you did resolve this error already, what new error messages are you getting now?

HAO

unread,
Apr 18, 2021, 6:15:26 PM4/18/21
to vmx-pi
/usr/local/lib/vmxpi is not in chroot jail, this error occurs because I log in to the chroot from this directory, but that’s not the point, nor the cause of the error.
I had copied libvmxpi_hal_cpp.so into the chroot /root directory, and running ldd command in there.
I tested write a Hello World c program, and compile it outside of the chroot, it cant running in the chroot, it can just work by compile it in the chroot.
so i think because some reasons, the LabVIEW chroot just can running a soft-float program.
scott...@gmail.com 在 2021年4月19日 星期一上午5:55:50 [UTC+8] 的信中寫道:

HAO

unread,
Apr 18, 2021, 9:05:38 PM4/18/21
to vmx-pi
螢幕擷取畫面 2021-04-19 090210.png
BTW, i found this in VMX HAL Library headers file, looks like the library is open source, so i think you must publish the source code.
HAO 在 2021年4月19日 星期一上午6:15:26 [UTC+8] 的信中寫道:

Scott Libert

unread,
Apr 18, 2021, 9:14:47 PM4/18/21
to vmx-pi
Kauai Labs is the author of the software code for the library.

The header files are open source, but the source code and the build environment for the library are not.

Scott Libert

unread,
Apr 18, 2021, 9:54:41 PM4/18/21
to vmx-pi
If the LabVIEW chroot process has a limitation that it can only run a soft-float program and not hard float, then one approach would be to create a separate process (which runs the existing VMX-pi HAL), then create an inter-process communication mechanism (e.g., via pipes or sockets) to invoke VMX-pi HAL functions within the from the LabVIEW chroot process.

A second alternative, which is likely simpler is to [since the VMX-pi HAL Platform Libraries include libvmxpi_hal_cpp.a (a static library version of the shared library .so file)], create a simple "shim" shared library that is called from the LabVIEW chroot.  This "shim" should be compiled with "mfloat-abi=softfp"; internally, this library would call the VMX-pi HAL functions in libvmxpi_hal_cpp.a.  My understanding is that the a softfp-compiled shared library can link to hardfloat static libraries.  I encourage you to research this option.

It's not a trivial task to recompile VMX-pi HAL library as soft float, because the current compile/build process runs directly on the Raspberry Pi, and the Raspberry Pi-based gcc/g++ compilers do not support the softfp compilation option.  This means a cross-compiler architecture would be necessary, which radically changes the build process for VMX-pi.  We might be able to accomplish, but there's no idea when this might be available, maybe not until Fall, 2021.

- scott

HAO

unread,
Apr 18, 2021, 10:14:42 PM4/18/21
to vmx-pi
Thank you.
I will try the  second alternative, but where is  libvmxpi_hal_cpp.a file?

scott...@gmail.com 在 2021年4月19日 星期一上午9:54:41 [UTC+8] 的信中寫道:

Scott Libert

unread,
Apr 18, 2021, 11:18:47 PM4/18/21
to vmx-pi
libvmxpi_hal_cpp.a is in the same location as libvmxpi_hal_cpp.so - which is /usr/local/lib/vmxpi.

HAO

unread,
Apr 19, 2021, 5:07:19 AM4/19/21
to vmx-pi
螢幕擷取畫面 2021-04-19 170506.png
Really? Why it not in there on my system?
Could you send a copy for me?
scott...@gmail.com 在 2021年4月19日 星期一上午11:18:47 [UTC+8] 的信中寫道:

HAO

unread,
Apr 19, 2021, 5:09:11 AM4/19/21
to vmx-pi
m83...@gmail.com
this's my email address
big thanks

HAO 在 2021年4月19日 星期一下午5:07:19 [UTC+8] 的信中寫道:

HAO

unread,
Apr 19, 2021, 6:19:41 PM4/19/21
to vmx-pi
螢幕擷取畫面 2021-04-20 061734.png
bad news
Your guess is wrong
HAO 在 2021年4月19日 星期一下午5:09:11 [UTC+8] 的信中寫道:

Scott Libert

unread,
Apr 20, 2021, 1:33:07 PM4/20/21
to vmx-pi
It looks like the linker won't allow this, that's good information to know.

So at this point, my only suggestion remaining is you could put the VMX-pi Platform HAL into a separate process, and then have the LabVIEW chroot-based code communicate with that process to make requests/get results from this new separate process - e.g., via sockets or pipes.  I have seen some discussion of workarounds like this being used to allow things like this w/the LabVIEW Chroot on Raspberry Pi (https://www.labviewmakerhub.com/doku.php?id=learn:libraries:linx:misc:chroot-ssh-trick).

Separately, I have heard of a group that used LINX and LabVIEW Community edition with VMX-pi Platform HAL.  If you're interested in this approach, I'd encourage you to check w/your Studica representative, and hopefully they can provide you more details.

Cheers,

- scott
Reply all
Reply to author
Forward
0 new messages