Menu

VTS on Linux via WINE

2017-05-24
2017-05-24
  • Christopher Grey

    I'm trying to see if I can get VTS to run on my Ubuntu 14.04 (32-bit) Linux machine with WINE installed. I've been able to install the vcredist_x86.exe, but VTS.exe doesn't seem to do anything. It doesn't throw any errors, it just doesn't work. It seems to have some error and then quietly exit but without indicating what the problem is.

    Usually the problem with programs that don't run correctly under WINE are related to missing or outdated DLL files. To solve these problems, the failing program usually declares that it couldn't find a specific file (usually a .dll). In these cases, I copy the missing file from a Windows machine where the same program runs correctly and place it in the same directory as the EXE that I'm trying to run under WINE.

    However without VTS giving me any kind of feedback, I'm at a loss as to how to satisfy what ailes it. Is there any chance there's a command-line argument I can pass to VTS to tell it not to quietly exit when fatal errors are encountered and instead declare to the terminal or via modal popup the details of the problem?

    Any other feedback you can give me at making headway towards this effort, let me know.

    I'm also fully willing to work with experimental builds. I'm a firmware developer for Automated Logic, so that's not an unusual thing for me to do.

     
  • John Hartman

    John Hartman - 2017-05-24

    I don't know anything about WINE. On Windows, the "can't find DLL" messages usally come from the OS as it tries to load the application, not from code in the application itself.

    Run VTS on Windows, and use Dependency Walker, a debugger, or a similar tool to see what DLLs it loads. Do this on RUNNING VTS, since some DLLs may be loaded at runtime rather than specified in the link.

    VTS uses WinPCAP for naked Ethernet access. I don't recall whether VTS links to it or loads it manually.

    VTS uses (or used to use) NBLink for MS/TP. I don't know whether or how that is loaded.

    If all you need is BACnet/IP, you might try getting the source and removing the WinPCAP and NBLink code.

     
  • Christopher Grey

    Well with a good bit of debugging, I've been able to glean a good number of the DLLs that are required just to get VTS to launch. Most of them were installed by vcredist_x86.exe, however the one that was holding up the show was mfc42.dll. That one was evidently needed by nb_link_settings.dll. I copied it and mfc42u.dll over to the same folder VTS.exe is in and now I have VTS launching in Linux by WINE!

    However this only got me to the next stumbling point. When I go to Edit>Ports to configure for IP communications, I get a VTS popup that says:
    Encountered an improper argument.

    I've seen this error trying to run VTS from Windows before. However I don't remember what I did to get rid of it. I'll search around the forum here and see if I can find any indication as to what that might be. But suffice to say, I cannot select the IP tab in the Port Configuration window...which is the same exact behavior I've experienced running VTS from a Windows PC where I got this same error.

    I'll post back with more info as I find it. However it may be simpler for me to simply recompile without the MSTP support. Is there any chance a version of VTS without that included could be posted? MOST people, here in the office, only need B/IP support and would never miss it if MSTP support was missing.

     
  • Christopher Grey

    I was able to get a little more success. There is still some GUI bugginess with the Port Configuration window while running in WINE. However I was able to add an IP port and select the ethernet port I wanted, get it saved, and then I was able to actually send packets using it. However I cannot edit the port due to the GUI display issues that prevent proper painting of the IP tab. So to "edit" the port, I have to delete the old one and readd a new one. But that's at least better than nothing.

    However if I keep messing with VTS, I can get it to completely crash. Attached is the backtrace. For someone more familiar with VTS code might be able to make use of this and determine some simple code fix (i.e. check and prevent a NULL pointer possibility).

     
  • Christopher Grey

    I'm also finding that sometimes just deleting the Port entry and readding it just results in a crash and thus I can't modify or edit the port entry. The only way I was able to avoid this was to "reboot" VTS by deleting the vts3.cfg file and allow VTS to regenerate that info which seems to work without crashing. So the good news is I now have a way to limp VTS along within Linux via WINE. It's not pretty, but it at least works.

    I messed around with VTS enough to realize there's a feature needed or at least an existing feature that isn't intuitive as to how to setup. I want to be able to set VTS to send broadcast (discovery) packets using a the standard 0xBAC0 port while VTS is listening on the port (e.g. 0xBAC1) defined in the PORT CONFIGURATION page. I need this while developing an application that is opening 0xBAC0 while I discover it from VTS, which thus needs to open a different port. Right now, when I do a discovery, the broadcast goes out on the same port number as defined by my Port in Port Configuration, which is not what I want. I get that 99% of the time, people use VTS on a PC and direct it at devices that are NOT their PC. But in my case, my "device" is the PC. My guess is this is a feature request which I don't expect to get any attention here. I'm just writing notes here as I find things.

    Just for curiosity, I installed the latest version of VS (2017 Community Ed) installed in a Win7 VM on my Ubuntu machine. I opened VTS.vsxproj and I got immediately prompted to update the project from v100 (VS 2010) to v141 (VS2017). And I didn't have a choice but to target Win8.1 or Win10 (I chose Win8.1 since my dev version of Windows is Win7).

    But even after that, there were a number of build errors.
    The first build error was an indication that /ZI and /Gy- were incompatible, so I setup all projects to use /Gy instead of /Gy-. This won't mean anything to you if you aren't familiar with VC++. It only means something to me because I had to track it down to fix it.

    That got me to the next set of errors which hinged around the 2017 C++ preparser's inability to replace the #define FW correctly. It appears this was being used in a number of sprintf() statements to configure formatting. Just to get things to compile, I brute-force replaced all instances of FW with its actual value. There were still sprintf() warnings, which are possible causes for the bugginess I'm seeing. Add to that, it appears that while the Encountered an improper argument shows up in a popup titled VTS, the error is actually generated by a library file. The causes for this are all over the map, so I couldn't form a conclusion reven a good speculation as to what might be responsible for this at the moment the Port Configuration window opens.

    Finally, PTP was failing to compile because OutputPath wasn't getting defined. So updated the project to inherit the build location from Parent.

    At this point, all I was left with were warnings. Unfortunately even with the code now building, the resulting application would not run correctly. The HashForKeyword.exe returned with -1 which according to the code is an indication of insufficient arguments. Setting a breakpoint in the code confirmed that there was only 1 arg being passed to it. Unfortunately I don't yet know the codebase well enough to know where HashForKeyword.exe is being invoked. If I knew that, I could breakpoint there and find out why the arg count is not correct. The stack trace wasn't helpful in telling me this. If someone more familiar with the codebase can tell me where else to breakpoint, I might be able to get more info.

    Ideally I'd like to get my compile to work in VS so I can deploy it and see if there's any chance the "updates" make it run any differently/better in WINE. If not, then perhaps the stack traces would be more useful in pointing me to the exact line(s) of code responsible for the crashes.

     

Log in to post a comment.