← Back to team overview

kicad-developers team mailing list archive

Re: Build error on Fedora KiCad copr

 

Hi,

This appears to be because something in the build is setting the CMake
BUILD_SHARED_LIBS option to ON (the default is not set at all). See
build log line 124.

qa_utils is not explicitly declared STATIC like the rest of KiCad
internal libs, but it depends on common, which is. This causes Bad
Things, like being unable to link qa_utils.

Attached is a patch to make qa_utils STATIC, since making KiCad
internals shareable is not (currently??) possible, so it should
override the build environment setting if given.

Patch is not Jenkins'ed but it does build for me.

Cheers,

John
On Sun, Nov 4, 2018 at 2:16 PM Steven A. Falco <stevenfalco@xxxxxxxxx> wrote:
>
> The following discussion is from [KiCad/fedora-packaging] Handle ambiguous Python shebang (#20).  I'm cross-posting to kicad-developers since I'm not sure who sees the fedora-packaging emails.  Please don't hate me. :-)
>
> On 11/4/18 6:05 AM, nickoe wrote:
> > The patch was merged upstream, I consider this the replacement for this pull request. I know the fedora packaging scripts will still warn, but the error is gone.
> >
> > Next up are some linking issues, if anyone cares to look at the latest copr build logs.
>
> According to the log, we have errors in io_benchmark.cpp:
>
> undefined reference to `IFSTREAM_LINE_READER::IFSTREAM_LINE_READER(wxFileName const&)'
> undefined reference to `STDISTREAM_LINE_READER::ReadLine()'
> undefined reference to `IFSTREAM_LINE_READER::Rewind()'
> undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
>
> This _might_ be due to b88121e377b7244519715b604bd50026b2af440e (Add an in-memory STREAM_LINE_READER benchmark), which is the only commit I see in 2018 that touches io_benchmark.cpp.  Or it could be something that changed in a Makefile.  I am not knowledgeable enough to determine that.
>
> For reference, here is the full text of the error log.  It also mentions qa_utils/stdstream_line_reader.h, which appears to be part of the same issue:
>
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader_reuse<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&)':
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader_reuse<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&)':
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/tools/io_benchmark/io_benchmark.cpp:143: undefined reference to `IFSTREAM_LINE_READER::IFSTREAM_LINE_READER(wxFileName const&)'
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/tools/io_benchmark/io_benchmark.cpp:143: undefined reference to `IFSTREAM_LINE_READER::IFSTREAM_LINE_READER(wxFileName const&)'
> BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/kicad-r14365-75896d76/tools/io_benchmark/io_benchmark.cpp:147: undefined reference to `STDISTREAM_LINE_READER::ReadLine()'
> BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/kicad-r14365-75896d76/tools/io_benchmark/io_benchmark.cpp:147: undefined reference to `STDISTREAM_LINE_READER::ReadLine()'
> BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/kicad-r14365-75896d76/tools/io_benchmark/io_benchmark.cpp:153: undefined reference to `IFSTREAM_LINE_READER::Rewind()'
> BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/kicad-r14365-75896d76/tools/io_benchmark/io_benchmark.cpp:153: undefined reference to `IFSTREAM_LINE_READER::Rewind()'
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader_reuse<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&)':
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader_reuse<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&)':
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&)':
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&)':
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/tools/io_benchmark/io_benchmark.cpp:126: undefined reference to `IFSTREAM_LINE_READER::IFSTREAM_LINE_READER(wxFileName const&)'
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/tools/io_benchmark/io_benchmark.cpp:126: undefined reference to `IFSTREAM_LINE_READER::IFSTREAM_LINE_READER(wxFileName const&)'
> BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/kicad-r14365-75896d76/tools/io_benchmark/io_benchmark.cpp:127: undefined reference to `STDISTREAM_LINE_READER::ReadLine()'
> BUILDSTDERR: /usr/bin/ld: /builddir/build/BUILD/kicad-r14365-75896d76/tools/io_benchmark/io_benchmark.cpp:127: undefined reference to `STDISTREAM_LINE_READER::ReadLine()'
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&)':
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&)':
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `IFSTREAM_LINE_READER::~IFSTREAM_LINE_READER()':
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `IFSTREAM_LINE_READER::~IFSTREAM_LINE_READER()':
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `IFSTREAM_LINE_READER::~IFSTREAM_LINE_READER()':
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `IFSTREAM_LINE_READER::~IFSTREAM_LINE_READER()':
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader_reuse<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&) [clone .cold.152]':
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader_reuse<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&) [clone .cold.152]':
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&) [clone .cold.153]':
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o: in function `void bench_line_reader<IFSTREAM_LINE_READER>(wxFileName const&, int, BENCH_REPORT&) [clone .cold.153]':
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /builddir/build/BUILD/kicad-r14365-75896d76/qa/qa_utils/stdstream_line_reader.h:62: undefined reference to `STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER()'
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o:(.data.rel.ro._ZTI20IFSTREAM_LINE_READER[_ZTI20IFSTREAM_LINE_READER]+0x10): undefined reference to `typeinfo for STDISTREAM_LINE_READER'
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o:(.data.rel.ro._ZTI20IFSTREAM_LINE_READER[_ZTI20IFSTREAM_LINE_READER]+0x10): undefined reference to `typeinfo for STDISTREAM_LINE_READER'
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o:(.data.rel.ro._ZTV20IFSTREAM_LINE_READER[_ZTV20IFSTREAM_LINE_READER]+0x20): undefined reference to `STDISTREAM_LINE_READER::ReadLine()'
> BUILDSTDERR: /usr/bin/ld: CMakeFiles/io_benchmark.dir/io_benchmark.cpp.o:(.data.rel.ro._ZTV20IFSTREAM_LINE_READER[_ZTV20IFSTREAM_LINE_READER]+0x20): undefined reference to `STDISTREAM_LINE_READER::ReadLine()'
> BUILDSTDERR: collect2: error: ld returned 1 exit status
> BUILDSTDERR: collect2: error: ld returned 1 exit status
> BUILDSTDERR: make[2]: *** [tools/io_benchmark/CMakeFiles/io_benchmark.dir/build.make:99: tools/io_benchmark/io_benchmark] Error 1
> BUILDSTDERR: make[2]: *** [tools/io_benchmark/CMakeFiles/io_benchmark.dir/build.make:99: tools/io_benchmark/io_benchmark] Error 1
>
>         Steve
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
From 233d3f9fb4b4c91896edd8f64ee7966ae04984a8 Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Mon, 5 Nov 2018 10:14:36 +0000
Subject: [PATCH] QA: qa_utils has to be static

If qa_utils is not explicitly declared with STATIC, the build
fails in environments where the BUILD_SHARED_LIBS CMake option is
present and set to "ON". An example of this is Fedora COPR.
---
 qa/qa_utils/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qa/qa_utils/CMakeLists.txt b/qa/qa_utils/CMakeLists.txt
index b5befaeee..529f9275b 100644
--- a/qa/qa_utils/CMakeLists.txt
+++ b/qa/qa_utils/CMakeLists.txt
@@ -30,7 +30,7 @@ add_library( qa_utils
 
 include_directories( BEFORE ${INC_BEFORE} )
 
-target_link_libraries( qa_utils
+target_link_libraries( qa_utils STATIC
     common
     ${wxWidgets_LIBRARIES}
 )
-- 
2.19.1


Follow ups

References