-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mac OS X 10.14.6 Cura 4.3.0 X3GWriter 1.1.10 FlashForge Creator Pro saving zero byte x3g #30
Comments
Looks like a libgcc dependency is required and missing |
Hmm, well since I don't have MacOS, I'm not able to compile it. I've previously asked a friend to test it on his MacOS and there it did run (but he is a developer so he'd have GCC installed fully I guess). What I did was take the GPX binary from their releases and rename it to prevent a name collision with the Linux version. To test, could you try these steps?
Does it still complain about libgcc? |
Sorry, haven't had time due to power outages, work, and fire chaos. I got a chance to try things today, gpx runs fine, even the installed one. If I copy the gpx-macos command line and run it manually redirecting the output to my home directory, I get a valid sized file. I tried saving a gcode file, and then converting it with the gpx-macos command as well. Will have to print it and see what comes out. |
The generated x3g doesn't print. |
If anything in the process fails, the plug-in tends to generate a zero-byte file. This is some technicality from Cura as it creates a file first before allowing the plug-in to write to it. |
When I'm home I'll try updating the GPX version inside the package for you. Maybe there is some fix in the meanwhile. My version is 2 commits behind. Hoping you can try it for me. I'll need to update the package anyway for the 7.0.0 SDK version increment. |
The GPX version in my plug-in is bit-for-bit identical to the latest release that I took the binary from. I'm unable to compile for MacOS myself or provide that libgcc library since I don't have an Apple computer, so there's no real way that I can find to debug or fix this for you. There's a possible workaround here: haskell/haskell-platform#231 (comment) So that would be these commands in the terminal:
|
That works and it lets me save the file. |
I took a 20mm retraction cube stl, and ran it through the X3Gwriter, then tried to print it. |
I'm suspecting that the problem lies with the printer settings there. What printer are you using in Cura? Because there is no definition for FlashForge Creator Pro as far as I know. We'll probably need to configure a few settings to match the FlashForge firmware settings. X3G encodes steps per mm in there so Cura needs to know those and the position of the endstops. |
I deleted and reinstalled everything. I'm using the Flash Forge for Cura profile files from here I also pulled just the single needed lib from the full gcc5 install and left it in place, deleting everything else, and gpx-macos works fine now, even from the command line. Since this libgcc_s.1.dylib is required, you could just take that single.dylib and embed it in the X3GWriter itself, and then use the install_name_tool to change the expected install path to it to be in your plugin. That would prevent folks from having to install anything else. |
The FlashForge Creator profiles you linked to already specify the profile for FlashForge Creator Pro, like this:
in the metadata of the I'll look into the install_name_tool trick. But it might take a while because I'm about to go on vacation to a place where I don't have internet and also can't ask a colleague or something to help me try things on MacOS. Keeping this ticket open in the meanwhile. |
Looks like the issue is not related to GPX executable at all, but to Python version that Cura is using on MacOS. So if you run the same command in the terminal it works fine with the same binary, but it doesn't work via Popen from the plugin... |
The MacOS builds of Cura are running Python 3.5.2 (like all platforms; Ultimaker builds those from the same source). I don't think it should matter though; the Popen functionality of Python hasn't changed much. Maybe it's about the working directory of the executable? |
@Ghostkeeper - it looks like the dependency on gcc5 libraries are related to bundled Python, not GPX binary itself as it (gpx) runs just fine without gcc5 in the system. It only complains when running from Cura via popen. |
This ultimately worked for me as well, although when I tried to run homebrew/versions is got hungup on trying to log in and homebrew/versions is deprecated, so I ran |
I just installed the latest gcc with
This allowed me to create the x3g file and print. |
It looks like
It warned me that I should be using |
As BenBergman found out in #35, apparently calling the executable directly on the command line works, but calling it from Python doesn't. Based on that I'd like to ask one of you to test this for me on MacOS. I'd like to see if the working directory has anything to do with it, so could you run this on a command line?
This should give you an error that you need to provide an input file or enable standard I/O. Means that the program was running correctly. Apparently this works fine. But now try this:
This is more like how Cura is calling the application. Maybe this behaves different because the working directory is different? |
I uninstalled gcc5 to try running from the different locations (note that my As an aside, with gcc5 installed I had been able to generate a non-zero x3g file. I was just able to attempt printing it but the printer did not recognize the file (even the zero byte files from pre-gcc5 were shown on the printer screen). Doing the manual gcode - CLI GPX conversion got the file to show up. I forgot to compare the x3g files to see if they are different though. |
Well as long as we know whether or not the executable gets executed is enough. I wouldn't expect the results to be any different. I really wish now that I had a MacOS installation somewhere on which I could try stuff, but I don't. The Cura team has a Macbook but it's been out of commission the past few weeks. The question remains why calling the GPX binary from python ( |
+1 |
That's strange though. Previously this was specific to MacOS. I'm not seeing this problem myself on Windows. Is there something blocking GPX from executing, like a firewall? Maybe there's something in the log file? It seems to work for most people. |
Got a second report here about Windows: Ultimaker/Cura#8093 |
On Windows I'm also still getting normal X3G files: MM_cube.zip |
I cant send the Logs right now, would need 2 Weeks from now since i am on Holiday. |
Unsure if I should create a new issue for this, or continue on this one. On Catalina (10.15.5) the gcc5 and gcc@5 won't install due to (I'm assuming) 32/64-Bit compatibility issues. Per the request above I did - As expected this returned But note- the path I had to use to get that failure has X3GWriter in it 2 times. I then tried -
(Which I think is what you wanted) I'm updating my gcc to the current version. I'll try the file copy approach recommended in the thread if it still applies and update the issue. Let me know how else I can help. |
This is easy to undo if you want me to be a tester for any approaches / fixes. Also willing to do a screen share for more realtime debugging if someone wants. |
From the comment from @Ghostkeeper on October 22, I installed the GPX directly using To double check, I also downloaded the GPX release and put it in its own folder. Attempting to run there got the same error set I reported attempting to call above - So the version from home-brew appears to work, but the version that is just copying the binary to a location and invoking that directly fails. That failure appears to be the same as seen when attempting to invoke the gpx bundled in this plugin. |
Thanks for the help! Is the binary from Home Brew different from the binary on GPX's Github page? I've copied the one from Github into the plug-in release. Maybe the binary from Home Brew is statically linked to libgcc. Or maybe Home Brew does some things around the installation of GPX to make it work. I think that I can't just link libgcc myself on the first run of the plug-in though. Wouldn't you need administrator privileges to create a link like that? Its location might also depend on the MacOS version (or the GCC version). |
I corrected my statement. The link approach didn't work. I'll try and track down today where home-brew has the bits for GPX and compare that to the one in the binary. I'll also see what happens if I try to use GPX from their distribution rather than home-brew to see if the behavior differs. I'll update when I've run those to ground. |
Update - I uninstalled the home brew version of GPX and confirmed it was gone (the command failed). I removed the gcc hack above from the file system. I downloaded the gpx distribution copied it to my OS, and executed it from the terminal. It worked with the "provide an input file" response. The md5 for that gpx file is MD5 (gpx) = b8d37d817e0e7ccead285833dc3f763e This is the same as the one in the X3GWriter build - MD5 (./gpx_macos) = b8d37d817e0e7ccead285833dc3f763e So it seems like the binaries are the same. The problem is how it is getting invoked. I can confirm this as I have the downloaded gpx file in my Downloads folder. If I'm in that folder and issue the command to either gpx binary as Attempting to troubleshoot I tailed the cura log file. In there I can still see the gcc5 reference, so it feels like something in the execution path is based off of a flawed assumption -
From my command prompt the call The error says the problem is in I'm not a python guy at all, but I'll look and see if the problem is that the python invocation of the command is causing a problem. It feels like it is at this point, since the command it claims it is invoking actually works when I attempt it at the command line. |
Thanks for your help. My suspicion now is that the environment that Cura is running in is more at fault. Maybe it's not got that libgcc on its linkage path or something. I can also imagine that MacOS is protecting plug-in binaries from calling upon system binaries for security reasons. |
Then using: fixed it for me. Basically it's looking in /usr/local/lib/gcc/5 and it's not there. |
That's the same as what Apaier and GaryL8N said (but a different version of GCC). It's a decent workaround, but impossible for me to implement in the plug-in. Maybe we'd need a statically linked version of the GPX executable? |
I have a Mac running Catalina 10.15.5 with Cura doing the zero byte file thing. Can I help test? I tried creating the link @bpatters suggested 29 days ago but no joy. |
My current problem is that I don't really have the means to create a build of GPX for MacOS that statically links this libgcc library. I believe that statically linking libgcc would solve this issue since it wouldn't need to dynamically load anything then, and the correct version of the required library would get shipped along with the plug-in. There are some inherent security issues with it though. If any of you would help me with compiling this, they are downloading a binary blob from some person on the internet which nobody can verify the integrity of. Currently people have to trust Markwal for the GPX source code which is semi-verifiable assuming the GPX executable is reproducible on Mac. And people have to trust me which is easy since the Python code is stored in the open on their computers. But if one of you provides a build of GPX with statically linked libgcc they'd have to trust one more person to not inject malicious code, and this trust is not easily verified since linking libgcc statically is harder to reproduce byte-for-byte. I think the ideal situation is that I'd get my hands on a computer running MacOS and build the GPX executable with static linking myself. They'd still only have to trust Markwal and me, and I will be harder to trust since the GPX executable is harder to reproduce, but it's a little bit better open-source wise. |
Markwal created a new release of GPX that apparently includes bug fixes to the way the MacOS binary is built: https://github.com/markwal/GPX/releases/tag/2.6.7 (particularly markwal/GPX@3864548). It's probably good to update GPX regardless, but updating might also solve this issue. |
I have a new release of the X3GWriter in progress. Would anyone like to try this release candidate on MacOS? To install this version, drop the .curapackage file onto the Cura window. Then restart Cura. To uninstall it, if anything is awry or whatever, go to the Marketplace, and in the "installed" tab find the X3GWriter plug-in and press the "Uninstall" button. You could then re-install the version from the Marketplace. Edit: For my colleague the plug-in worked on MacOS (Catalina). |
I'll assume it is fixed then. |
2019-10-21 22:28:35,242 - DEBUG - [Thread-7] X3GWriter.X3GWriter.write [50]: Using configured machine: fcp (FlashForge Creator Pro)
2019-10-21 22:28:35,249 - DEBUG - [Thread-7] X3GWriter.X3GWriter.gpx_executable [109]: GPX executable: /Users/mikkyo/Library/Application Support/cura/4.3/plugins/X3GWriter/X3GWriter/gpx_macos
2019-10-21 22:28:35,251 - DEBUG - [Thread-7] X3GWriter.X3GWriter.gpx_command [130]: GPX command: /Users/mikkyo/Library/Application Support/cura/4.3/plugins/X3GWriter/X3GWriter/gpx_macos -g -p -m fcp /var/folders/b_/95l86vcs4xd16wqzf_33ymk40000gp/T/tmptmyrr25h /var/folders/b_/95l86vcs4xd16wqzf_33ymk40000gp/T/tmpwbiq8zsp
2019-10-21 22:28:35,311 - DEBUG - [Thread-7] X3GWriter.X3GWriter.write [62]: (b'', b'dyld: Library not loaded: /usr/local/lib/gcc/5/libgcc_s.1.dylib\n Referenced from: /Users/mikkyo/Library/Application Support/cura/4.3/plugins/X3GWriter/X3GWriter/gpx_macos\n Reason: image not found\n')
The text was updated successfully, but these errors were encountered: