Skip to content

CYGWIN: fix linker error on x11_in_qt5.

Carlo Bramini requested to merge carlo-bramini/suil:master into master

I tried to build suil on CYGWIN and I got these error messages at the end:

The Meson build system
Version: 1.2.3
Source dir: /home/carlo/packages/lv2.src/suil.src/suil-0.10.20-1.x86_64/src/suil-0.10.20
Build dir: /home/carlo/packages/lv2.src/suil.src/suil-0.10.20-1.x86_64/src/suil-0.10.20/x86_64-pc-cygwin
Build type: native build
Project name: suil
Project version: 0.10.20
C compiler for the host machine: gcc (gcc 11.4.0 "gcc (GCC) 11.4.0")
C linker for the host machine: gcc ld.bfd 2.42
C++ compiler for the host machine: g++ (gcc 11.4.0 "g++ (GCC) 11.4.0")
C++ linker for the host machine: g++ ld.bfd 2.42
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports link arguments -Wl,-z,nodelete: NO
Compiler for C++ supports link arguments -Wl,-z,nodelete: NO
Library dl found: YES
Found pkg-config: /usr/bin/pkg-config (2.2.0)
Run-time dependency lv2 found: YES 1.18.10
Run-time dependency x11 found: YES 1.8.9
Run-time dependency gtk+-2.0 found: YES 2.24.33
Run-time dependency gtk+-x11-2.0 found: YES 2.24.33
Run-time dependency gtk+-3.0 found: YES 3.24.41
Run-time dependency gtk+-x11-3.0 found: YES 3.24.41
Run-time dependency qt5widgets found: YES 5.9.4
Run-time dependency qt5x11extras found: YES 5.9.4
Program doxygen found: YES (/usr/bin/doxygen)
Program sphinx-build found: YES (/usr/bin/sphinx-build)
Program sphinxygen found: YES (/usr/local/bin/sphinxygen)
Program python3 (sphinx_lv2_theme) found: YES (/usr/bin/python3) modules: sphinx_lv2_theme
Configuring conf.py using configuration
Program doxygen found: YES (/usr/bin/doxygen)
Configuring Doxyfile using configuration
Build targets in project: 9
NOTICE: Future-deprecated features used:
 * 0.64.0: {'copy arg in configure_file'}

suil 0.10.20

  Directories
    HTML          : /usr/share/doc/suil-0/html
    Single HTML   : /usr/share/doc/suil-0/singlehtml
    Install prefix: /usr
    Headers       : /usr/include
    Libraries     : /usr/lib

  Components
    Documentation : YES

  User defined options
    auto_features : enabled
    buildtype     : plain
    localstatedir : /var
    prefix        : /usr
    sysconfdir    : /etc
    wrap_mode     : nodownload

Found ninja-1.12.0 at /usr/bin/ninja
ninja: Entering directory `x86_64-pc-cygwin'
[1/15] Generating doc/xml/index.xml with a custom command
[2/15] Compiling C object cygsuil-0-0.dll.p/src_host.c.o
[3/15] Compiling C object cygsuil_x11.dll.p/src_x11.c.o
[4/15] Generating doc/api/suil.rst with a custom command
[5/15] Compiling C object cygsuil-0-0.dll.p/src_instance.c.o
[6/15] Linking target cygsuil_x11.dll
[7/15] Linking target cygsuil-0-0.dll
[8/15] Generating doc/html/html with a custom command
[9/15] Generating doc/singlehtml/singlehtml with a custom command
[10/15] Compiling C object cygsuil_x11_in_gtk2.dll.p/src_x11_in_gtk2.c.o
[11/15] Linking target cygsuil_x11_in_gtk2.dll
[12/15] Compiling C object cygsuil_x11_in_gtk3.dll.p/src_x11_in_gtk3.c.o
[13/15] Linking target cygsuil_x11_in_gtk3.dll
[14/15] Compiling C++ object cygsuil_x11_in_qt5.dll.p/src_x11_in_qt5.cpp.o
[15/15] Linking target cygsuil_x11_in_qt5.dll
FAILED: cygsuil_x11_in_qt5.dll
g++  -o cygsuil_x11_in_qt5.dll cygsuil_x11_in_qt5.dll.p/src_x11_in_qt5.cpp.o -Wl,--as-needed -Wl,--allow-shlib-undefined -shared -Wl,--start-group -Wl,--out-implib=libsuil_x11_in_qt5.dll.a -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=3 -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=return-type -ffile-prefix-map=/home/carlo/packages/lv2.src/suil.src/suil-0.10.20-1.x86_64/build=/usr/src/debug/suil-0.10.20-1 -ffile-prefix-map=/home/carlo/packages/lv2.src/suil.src/suil-0.10.20-1.x86_64/src/suil-0.10.20=/usr/src/debug/suil-0.10.20-1 -lQt5Widgets -lQt5Gui -lQt5Core -lQt5X11Extras -lQt5Gui -lQt5Core -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -Wl,--end-group
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: cygsuil_x11_in_qt5.dll.p/src_x11_in_qt5.cpp.o: in function `sizeHint':
/usr/src/debug/suil-0.10.20-1/x86_64-pc-cygwin/../src/x11_in_qt5.cpp:61:(.text+0xe7): undefined reference to `XGetWindowAttributes'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: cygsuil_x11_in_qt5.dll.p/src_x11_in_qt5.cpp.o: in function `minimumSizeHint':
/usr/src/debug/suil-0.10.20-1/x86_64-pc-cygwin/../src/x11_in_qt5.cpp:73:(.text+0x1c2): undefined reference to `XGetWMNormalHints'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: cygsuil_x11_in_qt5.dll.p/src_x11_in_qt5.cpp.o: in function `wrapper_wrap':
/usr/src/debug/suil-0.10.20-1/x86_64-pc-cygwin/../src/x11_in_qt5.cpp:150:(.text+0x2a9): undefined reference to `XSync'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/src/debug/suil-0.10.20-1/x86_64-pc-cygwin/../src/x11_in_qt5.cpp:151:(.text+0x2bc): undefined reference to `XGetWindowAttributes'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/src/debug/suil-0.10.20-1/x86_64-pc-cygwin/../src/x11_in_qt5.cpp:152:(.text+0x2d1): undefined reference to `XGetWMNormalHints'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: cygsuil_x11_in_qt5.dll.p/src_x11_in_qt5.cpp.o: in function `resizeEvent':
/usr/src/debug/suil-0.10.20-1/x86_64-pc-cygwin/../src/x11_in_qt5.cpp:88:(.text+0x802): undefined reference to `XResizeWindow'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

It looks like the source is using X11 functions, but -lX11 is not set to the linker.

Attached patch fixes the issue.

Merge request reports