Building nightly with Msys2

Hi,
(In case automatically closed duplicate of my post can be reopened, please inform me… (Duplicate - closed post here))

I am trying to build fresh KiCad nightly with Msys2 (Win 10 x64). Steps I have taken:

  1. Launch “msys2_mingw64”;

  2. Use these commands:

    pacman -Suy
    pacman -Su

    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
    mingw-w64-x86_64-gtk3

    git clone https://gitlab.com/kicad/code/kicad.git

    cd kicad
    mkdir -p build/debug
    cd build/debug

    cmake -DCMAKE_BUILD_TYPE=Debug
    -G “MSYS Makefiles”
    -DCMAKE_PREFIX_PATH=/mingw64
    -DCMAKE_INSTALL_PREFIX=/mingw64
    -DDEFAULT_INSTALL_PATH=/mingw64
    …/…/

    make -j 4

  3. And this is there ld fails with:

collect2.exe: error: ld returned 1 exit status
make[2]: *** [pcbnew/CMakeFiles/pcbnew_kiface.dir/build.make:658: pcbnew/_pcbnew.kiface] Error 1
make[1]: *** [CMakeFiles/Makefile2:3327: pcbnew/CMakeFiles/pcbnew_kiface.dir/all] Error 2
make: *** [Makefile:161: all] Error 2

The same (similar output) happens if switching OFF most of the flags inside \kicad\CMakeLists.txt, LD returns the same an errors.
I have attached console output inside txt file.
Output log 2020-09-02.txt (996.2 KB)

What am I doing wrong?

D:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: DWARF error: could not find variable specification at offset 33bc7e
D:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: DWARF error: could not find variable specification at offset 33bce4
CMakeFiles/pcbnew_kiface.dir/objects.a(pcbnew_wrap.cxx.obj):pcbnew_wrap.cxx:(.text+0x23cd): undefined reference to `.refptr.PyObject_GenericGetAttr'
D:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/pcbnew_kiface.dir/objects.a(pcbnew_wrap.cxx.obj): in function `std::invalid_argument::invalid_argument(std::invalid_argument const&)':
D:/Apps/msys64/mingw64/include/c++/10.2.0/stdexcept:174: undefined reference to `.refptr._ZTVSt16invalid_argument'
D:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/pcbnew_kiface.dir/objects.a(pcbnew_wrap.cxx.obj):pcbnew_wrap.cxx:(.rdata$_ZTVN4swig20SwigPyIteratorOpen_TISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPP14ZONE_CONTAINERSt6vectorIS5_SaIS5_EEEEES5_NS_9from_operIS5_EEEE[_ZTVN4swig20SwigPyIteratorOpen_TISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPP14ZONE_CONTAINERSt6vectorIS5_SaIS5_EEEEES5_NS_9from_operIS5_EEEE]+0x30): undefined reference to `swig::SwigPyIteratorOpen_T<std::reverse_iterator<__gnu_cxx::__normal_iterator<ZONE_CONTAINER**, std::vector<ZONE_CONTAINER*, std::allocator<ZONE_CONTAINER*> > > >, ZONE_CONTAINER*, swig::from_oper<ZONE_CONTAINER*> >::decr(unsigned long long)'

Linker is failing because it fails to lookup some symbols.
Here’s a few things to try

  1. Do a release build instead of debug
  2. Disable python (KICAD_SCRIPTING and KICAD_SCRIPTING_WXPYTHON cmake flags)

If you need python and debug build, you may get more help on dev mailing list.

Wow! Thank you @qu1ck, release version with almost all cmake flags set to OFF have been built successfully!

For the record, here are complete commands to get binaries (date 2020-09-02):

pacman -Suy
pacman -Su

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 \
          mingw-w64-x86_64-gtk3

git clone https://gitlab.com/kicad/code/kicad.git

cd kicad

mkdir -p build/release              
cd build/release

cmake -DCMAKE_BUILD_TYPE=Release \
      -G "MSYS Makefiles" \
      -DCMAKE_PREFIX_PATH=/mingw64 \
      -DCMAKE_INSTALL_PREFIX=/mingw64 \
      -DDEFAULT_INSTALL_PATH=/mingw64 \
      ../../
      
make -j 4
make install

Got these commands from this post

1 Like

One more semi-related question: What is the correct way to get debug messages from inside kicad at runtime (release build)?

Here is an example: I add this “debug” line somewhere inside the source:
printf("Hello world\n");

I recompile release build, call pcbnew.exe from the command line. I expect to see this Hello world in the console when this line is executed. But I get this output only after pcbnew.exe is closed, or at random timeslots, depending of the source code i put this line (probably because of multithreading / thread switching).

image

Is there a some kind of dedicated debug_printf("Value of interst = %f", var_of_interst); function, which outputs debug messages from within the kicad at runtime?

I have found wxLogWarning( "Hello world" ); function, but it is a GUI warning message, intrusive GUI locking…

Try doing fflush(stdout); after printing.

I personally prefer wx logging, it’s not actually locking, you can ignore that popup. More info here https://docs.wxwidgets.org/3.0/overview_log.html

1 Like

fflush(stdout); was sufficient for my case, thank you very much for this valuable information! :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.