lordofhyphens / Slic3r

G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)
http://slic3r.org/
GNU Affero General Public License v3.0
6 stars 1 forks source link

CPPGUI - READ ME FIRST (SETUP) #31

Open lordofhyphens opened 6 years ago

lordofhyphens commented 6 years ago

Preamble

If you're here to get started on working on Slic3r, thank you!

The Windows instructions were developed with my laptop.

Linux instructions were developed through my setup for Travis CI (the build server) and my main development workstation (running Debian sid). OSX instructions were developed through the Travis CI setup (build server). They have not been tested by me on a local OSX system (yet).

Coding Standards (incomplete)

Code Checkout

Here's how to get going for the purposes of assisting with the CPPGUI port.

If you are planning on contributing code you should create a fork to stage your code:

  1. Click the github "fork" button on https://github.com/lordofhyphens/Slic3r
  2. Check out the cppgui branch of Slic3r:
    1. git clone https://github.com/lordofhyphens/Slic3r -b cppgui slic3r-cppgui
    2. git remote add me https://<username>@github.com/<username>/Slic3r

To get updates that I or other people have done: git pull origin cppgui

To get your code into lordofhyphens/slic3r

  1. git push me cppgui
  2. On Github website, open a pull request from <username>/Slic3r to lordofhyphens/Slic3r cppgui branch.
  3. Resolve any comments I have with your submitted code.

General notes

If you have problems with CMake not figuring out the build settings, you need to delete and re-create the build folder before trying again.

If you see /path/to/Slic3r this means replace that text with where you checked out Slic3r.

Windows Build Instructions

  1. Install mingw-w64 7.3.0 with posix threads and seh exceptions
  2. Install Cmake (at least version 3.9)
  3. Download wxwidgets 3.1.1
  4. Build wxwidgets and install it.
    1. Extract wxwidgets to C:\dev\wxwidgets-3.1.1-src
      • While you can extract this anywhere, you need to replace C:\dev in the instructions with the new path.
    2. mkdir C:\dev\wxwidgets-3.1.1-build
    3. cd C:\dev\wxwidgets-3.1.1-build
    4. cmake -G"MinGW Makefiles" C:\dev\wxwidgets-3.1.1-src -DwxBUILD_SHARED=OFF -DCMAKE_INSTALL_PREFIX=C:\dev\wxWidgets-3.1.1-static
    5. cmake --build . --target install -- -j4 (reference: http://docs.wxwidgets.org/3.1/overview_cmake.html)
  5. Set WXWIN environment variable `image
  6. Download and build Boost as per the wiki.
  7. Checkout Slic3r source (see above)
  8. mkdir /path/to/Slic3r/build
  9. cd /path/to/Slic3r/build
  10. cmake -G"MinGW Makefiles" ..\src\ -DBOOST_ROOT=C:\dev\boost_1_63_0 -DSLIC3R_STATIC=1

Expected output from CMake:

-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-7.3.0-posix-seh-rt_v5-rev0/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-7.3.0-posix-seh-rt_v5-rev0/mingw64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files/mingw-w64/x86_64-7.3.0-posix-seh-rt_v5-rev0/mingw64/bin/g++.exe
-- Check for working CXX compiler: C:/Program Files/mingw-w64/x86_64-7.3.0-posix-seh-rt_v5-rev0/mingw64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Found Boost
-- Found wxWidgets: C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxbase31u_net.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxmsw31u_gl.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxmsw31u_html.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxmsw31u_aui.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxmsw31u_core.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxbase31u.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxpng.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxtiff.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxjpeg.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxzlib.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxregexu.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxexpat.a;opengl32;glu32;winmm;comctl32;oleacc;rpcrt4;shlwapi;version;wsock32 (found version "3.1.1")
wx found!
-- Configuring done
-- Generating done
  1. cmake --build . -- -j4
  2. Watch Slic3r build.

Linux

  1. Install wxWidgets development files (3.0 minimum, prefer 3.1) from your distro packages.
    • Using a custom wxWidgets 3.1 build is slightly more involved and is not covered here. It involves making sure that the custom wx-config is on the path, etc.
  2. Make sure your compiler fully supports C++11.
    • clang 3.3 should be fine by default.
    • If you have to install a new GCC/G++ package, export CC and CXX accordingly
  3. Install Boost development files from your distro packages.
    • Building Boost 1.63 from Slic3r wiki is feasible you'll have to add -DBOOST_ROOT=/path/to/boost in the later cmake call.
  4. Open a terminal.
  5. cd to the Slic3r checkout.
  6. mkdir build
  7. cd build
  8. cmake ../src
    • If you are using a custom Boost build, add -DBOOST_ROOT=/path/to/boost
  9. cmake --build .
    • You can usually append -- -j4 to build with 4 threads.

OSX

  1. Make sure that you have the XCode tools to build C++ applications.
    • Install CMake separately if you don't have it.
  2. Install wxwidgets via homebrew brew install wxmac
    • If you install it any other way, you're on your own to make sure that CMake can find it.
    • Homebrew documentation
  3. Ensure boost is installed (usually via homebrew)
    • brew install boost
  4. Open a terminal.
  5. cd to the Slic3r checkout.
  6. mkdir build
  7. cd build
  8. cmake ../src
    • If you are using a custom Boost build, add -DBOOST_ROOT=/path/to/boost
  9. cmake --build .
EitanSomething commented 6 years ago

When doing step 1:cmake --build . -- -j4 i get the following errors.

CMakeFiles\slic3r.dir/objects.a(slic3r.cpp.obj): In function `__static_initialization_and_destruction_0':
C:/dev/boost_1_63_0/boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()'
<snip> -- long list of repeated undefined reference errors -- </snip>
Makefile:82: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
lordofhyphens commented 6 years ago

@EitanSomething Looks to me like boost didn't build right on your system.

lordofhyphens commented 6 years ago

@EitanSomething update your slic3r source checkout and delete/remake your build directory. I've made boost a hard requirement so if it doesn't detect right it'll die earlier.

EitanSomething commented 6 years ago

When doing step 10 I get CMake Error at C:/Program Files/CMake/share/cmake-3.11/Modules/FindBoost.cmake:2044 (message): Unable to find the requested Boost libraries.

Boost version: 1.63.0

Boost include path: C:/dev/boost_1_63_0

Could not find the following Boost libraries:

      boost_system
      boost_thread
      boost_filesystem

Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost. Call Stack (most recent call first): CMakeLists.txt:50 (find_package)

lordofhyphens commented 6 years ago

@EitanSomething I'd rebuild Boost then and make sure you used gcc to build it (instead of MSVC). CMake's telling you what is wrong and what it can't find.

The Slic3r Wiki instructions will work so long as the version of GCC you are using is first in the PATH (or the only gcc in your path).

Related discussion somewhere else

Clean up your environment and figure out what is going on, I can't help you anymore unless you sort out your system environment. Remove other MinGW installs, make sure MinGW is in your PATH variable. Ensure Boost is built.

As a last resort you could probably overwrite C:\dev\boost_1_63_0 with https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=boost_1_63_0-x64-gcc-6.3.0-seh.7z

It may work, or it may not (it probably won't).

EitanSomething commented 6 years ago

Figured it out. I needed to rename files in C:\dev\boost_1_63_0\stage\lib libboost_system-mgw63-mt-s-1_63.a ->boost_system.a libboost_thread-mgw63-mt-s-1_63.a ->boost_thread.a libboost_filesystem-mgw63-mt-s-1_63 .a -> boost_filesystem.a

lordofhyphens commented 6 years ago

@EitanSomething I'm glad it worked out for you, but that should not have been necessary.

EitanSomething commented 6 years ago

At least now we know it could happen

EitanSomething commented 6 years ago
capture

Is this normal

lordofhyphens commented 6 years ago

I've seen it; the operation on Windows is barely tested. So no, it should not happen, but it probably isn't something incorrect in your environment.

Since you are primarily working on Windows you can figure it out (or ignore it until I get to it).

robbycandra commented 6 years ago

Same problem with @EitanSomething .

in My case : I rename

libboost_filesystem-mgw73-mt-s-1_63.a => libboost_filesystem-mgw73-mt-1_63.a libboost_system-mgw73-mt-s-1_63.a => libboost_system-mgw73-mt-1_63.a libboost_thread-mgw73-mt-s-1_63.a => libboost_thread-mgw73-mt-1_63.a

And the result

D:\MyApps\Slicer\Slic3r\build>cmake -G"MinGW Makefiles" ..\src\ -DBOOST_ROOT=C:\dev\boost_1_63_0 -DSLIC3R_STATIC=1
-- Boost version: 1.63.0
-- Found the following Boost libraries:
--   system
--   thread
--   filesystem
wx found!
-- Configuring done
-- Generating done
-- Build files have been written to: D:/MyApps/Slicer/Slic3r/build
robbycandra commented 6 years ago

I also have wxWidget debug alert .

lordofhyphens commented 6 years ago

I have updated the issue with a short list of minimum standards and guidelines. Code that is submitted that doesn't meet these will be required to change before it is merged.

EitanSomething commented 6 years ago

Trying to get this to work using visual Studios

lordofhyphens commented 6 years ago

@EitanSomething You are largely on your own with that (although you could probably reference some of the work on Prusa3d, as they do their debug on VS IIRC).

robbycandra commented 6 years ago

@lordofhyphens , what IDE you used to build this CPPGUI ?

EitanSomething commented 6 years ago

We currently aren’t using an IDE, but I am trying to get it to work with Visual studios 2017

lordofhyphens commented 6 years ago

@robbycandra I don't use an IDE and I don't plan to officially support one. I use CMAKE to build, my editor is gvim.

EitanSomething commented 5 years ago

I'm getting this error when building slic3r. I'm using Windows 10 Home MINGW 7.3.0 boost 1.63.0 wxwidgets 3.1.1 cmake 3.13.1

   liblibslic3r.a(AMF.cpp.obj):AMF.cpp: 
   (.rdata$.refptr._ZN5boost6nowide4cerrE[.refptr._ZN5boost6nowide4cerrE]+0x0): undefined reference 
   to `boost::nowide::cerr'
   collect2.exe: error: ld returned 1 exit status
   mingw32-make.exe[2]: *** [CMakeFiles\slic3r_test.dir\build.make:308: slic3r_test.exe] Error 1
   mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:495: CMakeFiles/slic3r_test.dir/all] Error 2
   mingw32-make.exe: *** [Makefile:94: all] Error 2
lordofhyphens commented 5 years ago

Odd, cmake should be compiling in nowide.

Could you pull from slic3r/Slic3r:cppgui and give it a try?

EitanSomething commented 5 years ago

I built slic3r/Slic3r:cppgui and I get

C:\Users\Eitan\Documents\slic3r-cppgui\xs\src\boost\nowide\iostream.cpp:9:10: fatal error: 
boost/nowide/iostream.hpp: No such file or directory
#include <boost/nowide/iostream.hpp>
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
 mingw32-make.exe[2]: *** [CMakeFiles\boost-nowide.dir\build.make:63: CMakeFiles/boost- 
 nowide.dir/C_/Users/Eitan/Documents/slic3r-cppgui/xs/src/boost/nowide/iostream.cpp.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:413: CMakeFiles/boost-nowide.dir/all] Error 2
mingw32-make.exe: *** [Makefile:94: all] Error 2
lordofhyphens commented 5 years ago

I bet I missed a spot when I pulled apart the include definitions.

Odds are the target definition for boost nowide just needs an include directory added for ${LIBDIR}

EitanSomething commented 5 years ago

I’ve tried to fix it, but haven’t succeeded so can you try to fix the issue.

EitanSomething commented 5 years ago

I will just run slic3r in a virtual machine until the errors are fixed

lordofhyphens commented 5 years ago

I don't usually develop at all on Windows, so figuring out weird linking issues because Windows is usually the last on my list of things to do.

Also you should be using Slic3r/Slic3r:cppgui

On Wed, Dec 5, 2018, 11:27 AM EitanSomething <notifications@github.com wrote:

I will just run slic3r in a virtual machine until the errors are fixed

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lordofhyphens/Slic3r/issues/31#issuecomment-444570772, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB8CoppM0HH5kJ7d5hRt3TZ6g467vU2ks5u2AH8gaJpZM4T_8sm .

lordofhyphens commented 5 years ago

I am pushing an update now for this in the build system. It was just adding 2 lines to CMakeFiles.

On Wed, Dec 5, 2018, 1:40 PM Joe Lenox <lordofhyphens@gmail.com wrote:

I don't usually develop at all on Windows, so figuring out weird linking issues because Windows is usually the last on my list of things to do.

Also you should be using Slic3r/Slic3r:cppgui

On Wed, Dec 5, 2018, 11:27 AM EitanSomething <notifications@github.com wrote:

I will just run slic3r in a virtual machine until the errors are fixed

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lordofhyphens/Slic3r/issues/31#issuecomment-444570772, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB8CoppM0HH5kJ7d5hRt3TZ6g467vU2ks5u2AH8gaJpZM4T_8sm .

lordofhyphens commented 5 years ago

@EitanSomething https://github.com/slic3r/Slic3r/commit/cd80dacf8b76a3becd6a6284b0e04060896458d3 builds on my system now (that I have it put back together).

EitanSomething commented 5 years ago

the slicer.exe says the gui has not been built.

lordofhyphens commented 5 years ago

Configure with -DEnable_GUI

On Wed, Dec 5, 2018, 7:56 PM EitanSomething <notifications@github.com wrote:

the slicer.exe says the gui has not been built.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lordofhyphens/Slic3r/issues/31#issuecomment-444719972, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB8Cpjlvs_sMb4b8KZG7Pt7gRndJuUKks5u2HlMgaJpZM4T_8sm .

EitanSomething commented 5 years ago

I get errors a bunch of errors when Enabling the GUI

C:In file included from C:/dev/wxWidgets-3.1.1-static/include/wx/glcanvas.h:324:0, from C:/Users/Eitan/Documents/slic3r-cppgui/src/GUI/Scene3D.hpp:8, from C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\Dialogs\ObjectCutDialog.hpp:7, from C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\Dialogs\ObjectCutDialog.cpp:1: C:/dev/wxWidgets-3.1.1-static/include/wx/msw/glcanvas.h:104:40: error: 'PIXELFORMATDESCRIPTOR' has not been declared PIXELFORMATDESCRIPTOR ppfd = NULL); ^~~~~ C:/dev/wxWidgets-3.1.1-static/include/wx/msw/glcanvas.h:107:42: error: 'PIXELFORMATDESCRIPTOR' has not been declared PIXELFORMATDESCRIPTOR pfd = NULL); ^~~~~ C:/dev/wxWidgets-3.1.1-static/include/wx/msw/glcanvas.h:171:17: error: 'PIXELFORMATDESCRIPTOR' has not been declared int DoSetup(PIXELFORMATDESCRIPTOR &pfd, const int attribList); ^~~~~ In file included from C:/dev/wxWidgets-3.1.1-static/include/wx/glcanvas.h:324:0, from C:/Users/Eitan/Documents/slic3r-cppgui/src/GUI/Scene3D.hpp:8, from C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\Plater/Plate3D.hpp:8, from C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\Plater.hpp:25, from C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\MainFrame.hpp:16, from C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\GUI.cpp:11: C:/dev/wxWidgets-3.1.1-static/include/wx/msw/glcanvas.h:104:40: error: 'PIXELFORMATDESCRIPTOR' has not been declared PIXELFORMATDESCRIPTOR ppfd = NULL); ^~~~~ C:/dev/wxWidgets-3.1.1-static/include/wx/msw/glcanvas.h:107:42: error: 'PIXELFORMATDESCRIPTOR' has not been declared PIXELFORMATDESCRIPTOR pfd = NULL); ^~~~~ C:/dev/wxWidgets-3.1.1-static/include/wx/msw/glcanvas.h:171:17: error: 'PIXELFORMATDESCRIPTOR' has not been declared int DoSetup(PIXELFORMATDESCRIPTOR &pfd, const int attribList); ^~~~~ In file included from C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\Plater.hpp:25:0, from C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\MainFrame.hpp:16, from C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\GUI.cpp:11: C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\Plater/Plate3D.hpp:43:5: error: 'uint' does not name a type; did you mean 'u_int'? uint hover_volume, hover_object, moving_volume; ^~~~ u_int In file included from C:/dev/wxWidgets-3.1.1-static/include/wx/glcanvas.h:324:0, from C:/Users/Eitan/Documents/slic3r-cppgui/src/GUI/Scene3D.hpp:8, from C:/Users/Eitan/Documents/slic3r-cppgui/src/GUI/Plater/Plate3D.hpp:8, from C:/Users/Eitan/Documents/slic3r-cppgui/src/GUI/Plater.hpp:25, from C:/Users/Eitan/Documents/slic3r-cppgui/src/GUI/MainFrame.hpp:16, from C:/Users/Eitan/Documents/slic3r-cppgui/src/GUI/GUI.hpp:4, from C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\Dialogs\PresetEditor.cpp:3: C:/dev/wxWidgets-3.1.1-static/include/wx/msw/glcanvas.h:104:40: error: 'PIXELFORMATDESCRIPTOR' has not been declared PIXELFORMATDESCRIPTOR ppfd = NULL); ^~~~~ C:/dev/wxWidgets-3.1.1-static/include/wx/msw/glcanvas.h:107:42: error: 'PIXELFORMATDESCRIPTOR' has not been declared PIXELFORMATDESCRIPTOR pfd = NULL); ^~~~~ C:/dev/wxWidgets-3.1.1-static/include/wx/msw/glcanvas.h:171:17: error: 'PIXELFORMATDESCRIPTOR' has not been declared int DoSetup(PIXELFORMATDESCRIPTOR &pfd, const int *attribList); ^~~~~ In file included from C:/Users/Eitan/Documents/slic3r-cppgui/src/GUI/Plater.hpp:25:0, from C:/Users/Eitan/Documents/slic3r-cppgui/src/GUI/MainFrame.hpp:16, from C:/Users/Eitan/Documents/slic3r-cppgui/src/GUI/GUI.hpp:4, from C:\Users\Eitan\Documents\slic3r-cppgui\src\GUI\Dialogs\PresetEditor.cpp:3: C:/Users/Eitan/Documents/slic3r-cppgui/src/GUI/Plater/Plate3D.hpp:43:5: error: 'uint' does not name a type; did you mean 'u_int'? uint In member function 'virtual bool Slic3r::GUI::App::OnInit()

lordofhyphens commented 5 years ago

Don't know what is going on with the errors in wxWidgets itself, odds are the Plate3D error need includes of cstdint, the include rules are slightly different between different compilers.

lordofhyphens commented 5 years ago

Remember that the c++ GUI is experimental and I currently do not guarantee that it works on all platforms.

EitanSomething commented 5 years ago

I built it in an ubuntu virtual machine when I open it an everything works.