HELP: How to get started with CopperSpice?

Discuss issues related to installing or building
areriff
Posts: 11
Joined: Wed Nov 01 2017 2:51 pm

HELP: How to get started with CopperSpice?

Post by areriff »

I'm getting increasingly frustrated.
---------------------------------------------------------------------
I'm new. I have zero Qt knowledge. I'm using windows and latest MSVC.
Can't seem to get anything started on CopperSpice.
I "installed" the binary release.

Doing the usual include, link, compile like the other libraries get me nowhere.
Documentation didn't help at all and made me more confused compare to when I started.

I know my way around to build other libraries such as SFML and GLFW from source and get static lib out of it.
With CopperSpice, it is very very not straightforward. I gave up on compiling CopperSpice source months ago. I figure to just go with binary. But then I can't even get binary release to compile "myHelloWorld.cpp" let alone link.

I'm new. But with CopperSpice seems like I'm a baby. Can't do anything.
I really really like the idea though. The kitchenSink demo is fantastic.

btw... what are the files in the kitchensink source root folder?
what is autotools? makefile? configure.ac?
How are they relevant in Windows?

Somebody please make a tutorial on how to get started from scratched.
From scratched I mean from the state where you just finish install windows. From nothing. No MSVC no MinGW. I want to know what software, libraries and some other random things do I need to get it to compile.

And after that's done, please improve your documentation to include things that beginner might find it godsend useful.

I regularly watching your GitHub commit once a week for few years now but that's how far I managed to do. Getting it into my computer and get it working is impossible.

barbara
Posts: 172
Joined: Sat Apr 04 2015 2:32 am

Re: HELP: How to get started with CopperSpice?

Post by barbara »

Thank you so much your feedback. I appreciate your help with this process. I would like to provide a few suggestions and answers to help you get started. We will work on a CopperSpice video as we gather more information about what should be presented. I am a Windows developer and I really do understand this process can be messy at times.
I have zero Qt knowledge.
You will not need any Qt experience as our target is for C++ developers.
I'm using windows and latest MSVC.Can't seem to get anything started on CopperSpice.
I understand MSVC is a tool chain many people use. However it has some major limitations and we currently do not build using MSVC. As a Windows developer I use a programmers editor (Diamond to be specific) or you could even use QtCreator to write your code. There is a decent GUI editor in QtCreator for drag and drop UI design. I believe the real issue we need to address for you is how to set up your tool chain.

It is our goal to support MSVC for those who want to use it. The major problem is their compiler. The C++ compiler ( MSVC 2017 Update 3 ) finally supports some of the advanced features introduced in C++11 which CopperSpice requires. These are items like expression SFINAE, decltypes, etc. We have contributors who have made changes to CopperSpice with the goal of full support for MSVC.

There is a snag we have encountered since CopperSpice uses the STL. Microsoft made some odd choices when implementing their compiler and it has actually baffled developers we have talked to on the clang team. We have not exhausted all avenues we are working with some wonderful people to find the correct solution.

Building CopperSpice and KitchenSink from Source

We support the two major build systems for C++, Autotools and CMake. You can use either one to build CopperSpice, KitchenSink, or your own project.
Documentation didn't help at all and made me more confused compare to when I started.
We want to improve our documentation so it is clear. I would like to know if you read though the following which is located on our web site. On platforms like Unix they have many of the tools naturally installed. On Windows you will need to install MSYS.

Note: We are aware links do not work in this forum as an anti spam measure.

http://www.copperspice.com/docs/cs_over ... s-win.html

No matter which platform you are on, you will need to install a compiler. On Windows the best compiler to use (at this time) is gcc. There are lots of versions of gcc and this can be confusing. My suggestion is to use the version of MinGW we have tested CopperSpice with. If you look at our Requirements for Windows documentation you will see a link in the MinGW section. Follow that link and you will find a page on our web site which documents the exact versions of the compiler to use on Windows.

what is autotools? makefile? configure.ac? How are they relevant in Windows?
Autotools is a build system and the one we started with, the CMake build system has been added in the last two years. We did a video on Build Systems which was released on Dec 14 2017. Watching this video would be of value. No matter which build system you select, you will need to understand the basics about what goes into the set up files. Thankfully we have some good examples as part of KitchenSink.

If you are going to use Autotools then you should check out the documentation on the following page which will explain configure.ac and the other files used for building. These files are not platform specific and in fact written to support Unix, Windows, and Mac OS X.

http://www.copperspice.com/docs/cs_over ... tools.html

Let me know your questions about these doc pages and I will add more information as we work together. Your help will improve this process for everyone.

Barbara

areriff
Posts: 11
Joined: Wed Nov 01 2017 2:51 pm

Re: HELP: How to get started with CopperSpice?

Post by areriff »

a simple build.bat would not be able to build it?
Usually, I use build.bat script, 4Coder for text editing and MSVC ide for debugging.

Must I use CMake to create even a simple test project?

I understand MSVC wouldn't be able to compile CopperSpice even in the current version.
But I'm asking here on using the binary release.

I'm asking this because the usual method of setting the include directory to use "include" directory in the CopperSpice root folder using MSVC IDE or batch file will fail immediately during compilation.
Forget about creating an object, the very first line #include <QtGui/Qapplication.h> will fail because it can't find another subheader file inside qapplication.h.
I don't think this error related to compiler support because it simply can't find the file unless I modified every call in the header to match the directory where the sub files are in.

I'm trying to not install anymore program except that I absolutely need.
i tried installing MSYS2 but in the end that get me nowhere.
It seems like GCC is Linux thing.
You can assume I don't know about Linux at all.
So far I never experience using GCC but I managed to compiled Clang from source, but I usually only use cl.exe

Can you please guide me here the step by step to get a blank empty window shows up using CS.
From there I can refer to the API doc or kitchenSink code to learn more.
The step leading there is missing. And it can be useful for future beginner wonderer like me to refer to.
I know making a video about it can be difficult to you.
Hopefully typing it here would be easier.

barbara
Posts: 172
Joined: Sat Apr 04 2015 2:32 am

Re: HELP: How to get started with CopperSpice?

Post by barbara »

The following Q & A is intended to provide an introduction to building a program in C++. Some parts may be a bit basic, however the overall information will serve as a good basis for learning what is required to create an executable.
A simple build.bat would not be able to build it? Must I use CMake to create even a simple test project?
This is not a limitation or restriction related to CopperSpice, this is how you build a program namely, by compiling the source code and linking with specific libraries as required.

CMake and Autotools are build systems which are used to create the complicated build files which make or nmake or ninja will use to compile your source code. These are generator tools and do not actually build your project but rather create the build files. Creating build files by hand is painful, inaccurate, and a full time job.

Have a look at the Makefile.in in the root of our KitchenSink demo. This was generated by Autotools and it is used to create the Makefile. This process is explained in our CS Overview documentation. This file is rather small but creating it by hand and getting it correct would be a lot of work and maintaining it would be awful. The Makefile generated for CopperSpice using Autotools is almost 30K lines. The CMake generated build.ninja file is 18 MB.

The advent of using a build system has reduced the burden of the build process. Doing this by hand is simply not a good idea. You will not necessarily need to learn the fine details of a build system but you do need to know the basics. This is why we have supplied the build files for KitchenSink, DoxyPress, DoxyPressApp, and Diamond. Reading these will help you to set up build files for your own project.

Compiling

Since you can not use MSVC to compile your program you need to do this from a Bash window or you can set up a tool chain in Qt Creator. We have information about this latter process in our CS Overview documentation.
i tried installing MSYS2 but in the end that get me nowhere
You will need to install MSYS and we have links to a good version documented in our CS Overview docs. You download the the 7z file and just copy to a folder normally called C:\MSys.
It seems like GCC is Linux thing
Both gcc and clang are compilers for C++ and not specific to any platform. On Windows the gcc compiler is provided by the installation of MinGW. Gcc is a bit older than clang. The clang compiler for Windows is not as well supported at but it will get there in due time.

As a dedicated Windows developer I use gcc when building my projects. Most of my builds are started by a Bash window. On a personal note I would like to add that using Bash was a bit awkward in the beginning. I realized using a Bash window was just like a glorified Dos window. The reason you need to the Bash window is to run make to build your project. Make can not be run from a Dos window as it needs other utilities. Bash and these other utilities are part of the MSYS installation.

You can use CMake or Autotools but on Windows I would suggest you use gcc as your compiler.

As I have mentioned, I am here to help and will explain each piece as best I can. Let me know your next question and we will continue this conversation.

Barbara

areriff
Posts: 11
Joined: Wed Nov 01 2017 2:51 pm

Re: HELP: How to get started with CopperSpice?

Post by areriff »

Thank you.
I installed QtCreator without Any other Qt components.

To warm up with this IDE, I'm trying to create a non-Qt project from within Qt Creator.
Greeted with this error message
Starting to parse CMake project.
The C compiler identification is GNU 7.3.0
The CXX compiler identification is GNU 7.3.0
Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: "jom" "/NOLOGO" "cmTC_ed089\fast"
Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe -- broken
CMake Error at C:/msys64/mingw64/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler

"C:/msys64/mingw64/bin/gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: D:/testQtCreatorIDE/build-testQtCreatorIDE-Desktop-Default/CMakeFiles/CMakeTmp

Run Build Command:"jom" "/NOLOGO" "cmTC_ed089\fast"
The system cannot find the file specified
Generator: execution of make failed. Make command was: "jom" "/NOLOGO" "cmTC_ed089\fast"

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

Configuring incomplete, errors occurred!
See also "D:/testQtCreatorIDE/build-testQtCreatorIDE-Desktop-Default/CMakeFiles/CMakeOutput.log".
See also "D:/testQtCreatorIDE/build-testQtCreatorIDE-Desktop-Default/CMakeFiles/CMakeError.log".
CMake Project parsing failed.
Not a very warm welcome by QtCreator.
Now it seems I have a new problem with the IDE.
What do I do now?

QtCreator seems intelligence enough to detect compilers but arent' able to use them.

Note: Apart from QtCreator, I also (already) have CMake installed because I always use them to generate MSVC solutions for some of the libraries I use.
It seems that MinGW also have their own version of CMake.

Another question is Bash here seems to limit the "/" root to C:/Msys64 folder where MinGW is installed. How to get to the other drive? I can't "cd .." all the way to the other drive it seems.

barbara
Posts: 172
Joined: Sat Apr 04 2015 2:32 am

Re: HELP: How to get started with CopperSpice?

Post by barbara »

We wrote some basic documentation for setting up a non Qt project in Qt Creator. In my work I set up the tool chain to use MinGW. I would suggest you use the version of this compiler we have tested. Links for MinGW are on our CopperSpice website. This was last tested on version 4.0

http://www.copperspice.com/docs/cs_over ... chain.html

Bash here seems to limit the "/" root to C:/Msys64 folder where MinGW is installed. How to get to the other drive? I can't "cd .." all the way to the other drive it seems.
Bash uses the Unix syntax and you will need to learn a minor amount of this. Slashes on Unix go the other way. On Windows you would type c:\ and in Bash this is typed as /c/.

Setting up a .bash_profile is a good idea and will help you configure your environment. This file is normally located in "Documents and Settings/UserName" and is loaded each time Bash starts.

(1) Adding the following line will display the current directory in normal Windows syntax. The reason it appears that you can not go "up" a directory is that MSys views its SYS directory as the root. This means the C drive is actually "below" C:\Msys.

Code: Select all

  export PS1="\$(pwd -W) $ "
(2) This line will be needed to compile a CopperSpice application. This environment variable is discussed in our CS Overview docs.

Code: Select all

export CS_HOME=/c/copperspice
Barbara

CandL
Posts: 40
Joined: Mon Oct 14 2019 6:37 pm

Re: HELP: How to get started with CopperSpice?

Post by CandL »

Barbra:

Seems you are rather fond of mingw and gcc on Windows, and I can understand that having spent time on HP/Apollo/SGI boxes. Yes I am old.

With MS newer MSVS Community edition licenses, you can use it commercially for free as long as:
  • 5 or fewer developers
  • less than $1 Million dollars revenue
Details: https://visualstudio.microsoft.com/license-terms/mlt553321/

barbara
Posts: 172
Joined: Sat Apr 04 2015 2:32 am

Re: HELP: How to get started with CopperSpice?

Post by barbara »

Seems you are rather fond of mingw and gcc on Window
I do use MinGW and GCC exclusively on Windows and this is my preferred environment. Amazingly I can use Qt Creator to develop complex UI's and they works great with CopperSpice. I am well aware that some prefer MSVC but it adds a layer of complexity and not my cup of tea. Ansel does tease me that I am more like a Debian user than the typical Windows developer.

We have other team members who prefer MSVC. This is the beauty of open source projects.

Barbara

CandL
Posts: 40
Joined: Mon Oct 14 2019 6:37 pm

Re: HELP: How to get started with CopperSpice?

Post by CandL »

Agreed , but they pay me to drink coffee not tea, and the wife like the mortgage to be paid....so.

As for Qt creator, yup use it too with CMake there is a lot of work to be done there though to get it quick enough.

MSVS2019 seems to have done a good job with the CMake/Ninja work ... to good in fact. It is crushing my home machine , 4 core 8 Gb WIn 10 machine ... it wants to keep 10 compiles going and that swamps the memory. Gotta reign that boy in.

Who is the resident MSVS guy/gal?

barbara
Posts: 172
Joined: Sat Apr 04 2015 2:32 am

Re: HELP: How to get started with CopperSpice?

Post by barbara »

Who is the resident MSVS guy/gal?
There is no one person who supports any particular platform for CopperSpice. We have various people who prefer one over the other so more of their usage and testing is done on that platform. Many people use MSVC and it has been fully supported since August 2018.

Barbara

Post Reply