Build Instructions for RenumKicadPCB on Linux Mint

Recently Alan Miller pointed out that my Windows MSI installer had the debug version bundled which requires different DLLs. I fixed that but I had migrated to a new laptop and so ran into some issues I will have to revisit. See the link to a fixed MSI below, which I will add to the github page. I will have to revisit this problem but I want to make headway on the Kicad/Renum integration (I can’t do too many things at the same time).

In our interchange I discovered Alan was in fact doing most of his work in Linux and yet was using RenumKicadPCB under Windows. I suggested he build a Linux version to save having to move files, etc., to a Windows PC.

Although I had built and tested under Ubuntu, Alan ran into a few problems. One is that I used a linux reserved keyword default in the source on line 86 of RenumGUI0v0_410.cpp. He changed that to def so the proper code should be:

wxSize StringtoSize(std::string &SizeString, wxSize def )
{
wxSize retval;
retval.x = atoi(SizeString.c_str());
retval.y = atoi(SizeString.substr(( SizeString.find(‘,’) + 1 )).c_str());
if ((0 == retval.x) || (0 == retval.y))
retval = def;
return(retval);
}

I’ll probably use something else when I update the source.

In addition he had to tweak the make instructions:

g++ -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I/usr/local/lib/wx/include/gtk3-unicode-3.1 -I/usr/local/include/wx-3.1 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF”src/RenumGUI0v0_410.d” -MT”src/RenumGUI0v0_410.o” -o “src/RenumGUI0v0_410.o” “src/RenumGUI0v0_410.cpp”

g++ -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I/usr/local/lib/wx/include/gtk3-unicode-3.1 -I/usr/local/include/wx-3.1 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF”src/RenumKicadPCB_Base.d” -MT”src/RenumKicadPCB_Base.o” -o “src/RenumKicadPCB_Base.o” “src/RenumKicadPCB_Base.cpp”

g++ -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I/usr/local/lib/wx/include/gtk3-unicode-3.1 -I/usr/local/include/wx-3.1 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF”src/RenumKicadPCBClasses.d” -MT”src/RenumKicadPCBClasses.o” -o “src/RenumKicadPCBClasses.o” “src/RenumKicadPCBClasses.cpp”

g++ -pthread -L/usr/local/lib -L/home/alan/wxWidgets-3.1.3/lib -o “RenumKiCadPCB0410” ./src/RenumGUI0v0_410.o ./src/RenumKicadPCB_Base.o ./src/RenumKicadPCBClasses.o -lwx_gtk3u_xrc-3.1 -lwx_gtk3u_html-3.1 -lwx_gtk3u_qa-3.1 -lwx_gtk3u_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1 -lgtk-3

 

I will, of course, get around to updating all this on github but I am dealing with several issues concurrently so I thought it best to document it now in case I forgot or lost the instructions.

 

Building Kicad with QT Creator on Windows/Msys2

Building Kicad with QT Creator on Windows/Msys2

I have been working towards integrating RenumKicadPCB functionality (i.e. geographic back-annotation) into Kicad for some time. Actually, to be accurate I have been hoping to do that. A major roadblock has been an IDE which allows me to edit, build, and debug the code. I had experimented with Eclipse and Microsoft Visual Studio Community Edition but I couldn’t import the official cmake files as there was always something missing. I am, after all, a former hardware guy not a modern programmer.

Recently back-annotation came up in a Kicad developer’s thread and I made contact with Alexander Shuklin, who is not only a more advanced software guy but he has already contributed to Kicad. We agreed to collaborate on the project – a development which I am very happy with. Alexander uses QT-Creator and, while I was initially hoping he could help me get Kicad working on MSVC I realized it would probably be easier for me to get QT-Creator working since at least I know you can build Kicad on that IDE.

After several days of failure interspersed with a near success (I was so tired I forgot to document what I had done) I managed to get things going. Here is the procedure to build Kicad on Windows with QT-Creator. Note that this only seems to work with the Msys2 version of QT-Creator, not the Windows version of QT-Creator even if Msys2 is installed. Unfortunately this took a day and a half to figure out. I almost succeed with the QT-Creator on Windows (I actually got about 33% through the compile) but, as I mentioned I forgot to document what I done.

First install Msys2 (see http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20161025.exe )

Everything below is from a mingw64 terminal window. It does not seem to work if you pick from the Msys2 pop-up. I show 64 bit development because that is what is recommended. Similar steps would apply to a 32 bit development environment.

There may be redundant or unnecessary steps in this recipe. I completely deleted Msys2 a few times and re-ran this procedure but there are only so many hours in a day.

From the Mingw64 terminal (comments marked by //)

pacman -Syuu //Answer yes to remove conflicts close the window via task manager when done

pacman -Syuu //Takes a long time close the window via task manager when done

pacman -Syuu //To make sure all is up to date

Copy and paste the following lines into your Mingw64 terminal (all the way from pacman -S to the blank line)

pacman -S base-devel \
git \
mingw-w64-x86_64-cmake \
mingw-w64-x86_64-doxygen \
mingw-w64-x86_64-gcc \
mingw-w64-x86_64-python2 \
mingw-w64-x86_64-pkg-config \
mingw-w64-x86_64-swig \
mingw-w64-x86_64-boost \
mingw-w64-x86_64-cairo \
mingw-w64-x86_64-glew \
mingw-w64-x86_64-curl \
mingw-w64-x86_64-wxPython \
mingw-w64-x86_64-wxWidgets \
mingw-w64-x86_64-toolchain \
mingw-w64-x86_64-glm \
mingw-w64-x86_64-oce \
mingw-w64-x86_64-ngspice
mercurial \
cvs \
p7zip \
ruby \
mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain

Now copy these lines one at a time (it may be possible to combine these with the above)

pacman -S mingw-w64-i686-qt-creator mingw-w64-x86_64-qt-creator

pacman -S mingw-w64-x86_64-clang

pacman -Syuu

Run qtcreator to make sure it works then exit qtcreator.

qtcreator

Download source files eg kicad-5.1.4.tar.xz into a suitable location such as /home source files can be found at http://kicad-pcb.org/download/source/ then

tar -xaf kicad-5.1.4.tar.xz

Run qtcreator from the ming64 terminal (for some reason, it doesn’t work if you pin it to the taskbar)

qtcreator

Select Open File or Project and open the Kicad source directory. Wait for it to parse

Note that QT will make its own build directory. This doesn’t seem to matter.

Select Build, rebuild project. On my machine it takes about 2 hours to compile Kicad

RenumKiCadPCB0410 Bug Fix

I have fixed a bug found by Paul P. where V0410 would not run properly if there was no existing RenumKiCadPCB directory in /users/appdata/roaming (Thanks Paul!).

Also at his suggestion I now show a warning and do not save the updated netlist file if there are netlist errors. This is usually because the netlist is out of date with the schematic and PCB so it makes it easier to fix (just regenerate the netlist from the schematic).

Here’s the link on Github https://github.com/BrianAtDocumentedDesigns/RenumKiCadPCB0401_July12_2019/tree/master

 

RenumKiCadPCB v0.410 Released

Version 410 has been significantly rewritten as I move towards KiCad integration.
On the journey some bugs were reported (Thanks Alan!)

These bugs which were reported and fixed are:
1) Under some circumstances KiCad uses quotes around reference designations internally. This caused RenumKiCadPCB to treat each refdes as a different type.

2) Renumbering by refdes didn’t work.

3) Selecting “Sort by Refdes” wasn’t remembered after exiting the program even though “Sort by Modules”was.

Also I added a reminder warning that you have to close other versions of the relevant .sch and .kicad_pcb files before renumbering. KiCad doesn’t refresh externally modified files and I didn’t see the benefit of sorting out file lock on Windows, Linux, and Apple given I hope to integrate the code into KiCad and therefore the issue will be moot.

Edit: I rather stupidly forgot the link to the new version ….

https://github.com/BrianAtDocumentedDesigns/RenumKiCadPCBo410

 

RenumKiCadPCB v0.400 Released!

I have entirely re-written RenumKiCadPCB into c++ and made it into a GUI (Windows-like) program. All the source files as well as build instructions and a Windows 10 installation file (RenumKiCadPCB.msi) can be found at https://github.com/BrianAtDocumentedDesigns/RenumKiCadPCB0400

I also added a few features and fixed a number of bugs.

As usual, please contact brian@documenteddesigns.com with bug reports or feature requests.

 

 

RenumKiCadPCB V0.352 on Github

I just uploaded V0.352 to Github. This (hopefully) fixed a bug where the system could chose the wrong “Top Layer”. It also (hopefully) corrected an issue with the undocumented AR field in the schematic. The field is not only undocumented, as implemented it can lead to “ghost” components in the file which are not visible to eeSchema or PCBNew. This, in turn led to errors in renumbering which could previously only be corrected by manually editing the schematic file with a text editor.

Although I have tested the code on my system I have not received feedback with respect to whether it works (or builds) for others.

I am re-writing RenumKiCadPCB from scratch in c++. I am doing so in order to learn c++ and wxWidgets and then create a GUI version of the program. Doing so may provide enough of a grounder to produce a version of eeSchema and/or PCBNew with integral renumbering. It should be quite easy to do this once I get the hang of a few parts of the KiCad source. The developers would like to see renumbering “pushed” from PCB to schematic via a netlist update. This probably makes sense in the broader context of things like pin swapping but since no progress has been mode in this direction it will have to work.

I intend to add a number of features to V0.400 (which I might release before V0.500, the GUI version). These are:

  1. Enable global change to module text angle;
  2. Enable global change to module text location (i.e. align Value and/or User with Ref, center the text fields on the module;
  3. Generate a Was/Is file from the PCB;
  4. Update schematic only using a Was/Is file.

The last two items may seem odd but it looks like updating the schematic only and then using eeSchema to update the PCB using timestamps regenerates the PCB and the netlist directly using KiCad internal functions so this would be a stepping stone to full integration, or at least less likelihood of RenumKiCadPCB getting out of sync with the file formats which appear to evolve and not be well documented. The net result of was/is generation followed by update PCB is substantially identical to pushing a netlist from PCB to schematic.

I would greatly appreciate any feature suggestions, bug reports, or general encouragement.

 

RenumKicadPCB Project moved to Github

When I started having trouble with WordPress and zip files I moved the repository for RenumKicadPCB to DropBox. I recently was alerted that for some I had to give a user “permission” to access the link even though it was supposed to be shared. I have no problem with this but I understand some users might so I decided to move the project to Github. Here is the link https://github.com/BrianAtDocumentedDesigns/RenumKicadPCB

 

RenumKicadPCB V0.351

I completed a rewrite a couple months but didn’t do all the testing I wish I had.

I’ve found no problems with this code but admit I have been focusing on Kicad proper with the hope the developers will add renumbering to V6.

Let me know if there are issues.

For some reason WordPress is blocking me from using zip files. Here is a link to the file on Dropbox

https://www.dropbox.com/s/jekf97odywc5bdx/RenumKiCadPCBV0351.zip?dl=0

Direct link (no log in) View file

 

 

Eeek! Issues with RenumKiCadPCBV0300 Zip

Thanks to Michael I learned that there are issues with at least the two most recent exe files zip files I posted.

Somehow I was distributing without a dll which can be corrected by compiling like this under msys2

gcc RenumKiCadPCB.c -static-libgcc -static-libstdc++ then renamining a.exe to renum.exe (or whatever).

Here is the corrected file RenumKiCadPCBV0300-fixed

Sorry about the screw up. I had been trying to compile Kicad sources and must have modifile my compiler settings or something.

There appears to be a bug I thought I had fixed, namely that a windows file path with a “.” (i.e. ver1.c.pro) gets trimmed wrongly. I will update soon.