Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined references when building TigerVNC server #1691

Closed
LMattsson opened this issue Oct 30, 2023 · 20 comments
Closed

Undefined references when building TigerVNC server #1691

LMattsson opened this issue Oct 30, 2023 · 20 comments
Labels
bug Something isn't working

Comments

@LMattsson
Copy link
Contributor

Describe the bug
When doing an out-of-tree build of the TigerVNC server on RHEL 8 I get the following errors (os::Mutex, rdr::Zlib..., rdr::RandomStream):

Error output
$ make TIGERVNC_SRCDIR=/home/cendio/tigervnc TIGERVNC_BUILDDIR=/home/cendio/tigervnc/build
...
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::BinaryParameter::getValueStr[abi:cxx11]() const':
Configuration.cxx:(.text+0x142): undefined reference to `os::Mutex::lock()'
Configuration.cxx:(.text+0x15a): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::StringParameter::getValueStr[abi:cxx11]() const':
Configuration.cxx:(.text+0x188): undefined reference to `os::Mutex::lock()'
Configuration.cxx:(.text+0x1ce): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::VoidParameter::VoidParameter(char const*, char const*, rfb::ConfigurationObject)':
Configuration.cxx:(.text+0x77d): undefined reference to `os::Mutex::Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::VoidParameter::~VoidParameter()':
Configuration.cxx:(.text+0x7cc): undefined reference to `os::Mutex::~Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::StringParameter::setParam(char const*)':
Configuration.cxx:(.text+0xce2): undefined reference to `os::Mutex::lock()'
Configuration.cxx:(.text+0xd35): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::BinaryParameter::setParam(unsigned char const*, unsigned long)':
Configuration.cxx:(.text+0xd9b): undefined reference to `os::Mutex::lock()'
Configuration.cxx:(.text+0xe0f): undefined reference to `os::Mutex::unlock()'
Configuration.cxx:(.text+0xe24): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::BinaryParameter::getData() const':
Configuration.cxx:(.text+0x16a6): undefined reference to `os::Mutex::lock()'
Configuration.cxx:(.text+0x1703): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::BinaryParameter::getValueStr[abi:cxx11]() const [clone .cold.58]':
Configuration.cxx:(.text.unlikely+0x1a): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::StringParameter::getValueStr[abi:cxx11]() const [clone .cold.59]':
Configuration.cxx:(.text.unlikely+0x2a): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::StringParameter::setParam(char const*) [clone .cold.61]':
Configuration.cxx:(.text.unlikely+0x73): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::BinaryParameter::setParam(unsigned char const*, unsigned long) [clone .cold.62]':
Configuration.cxx:(.text.unlikely+0x84): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o):Configuration.cxx:(.text.unlikely+0xe2): more undefined references to `os::Mutex::unlock()' follow
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(KeyRemapper.cxx.o): In function `rfb::KeyRemapper::remapKey(unsigned int) const':
KeyRemapper.cxx:(.text+0x2c1): undefined reference to `os::Mutex::lock()'
KeyRemapper.cxx:(.text+0x30b): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(KeyRemapper.cxx.o): In function `rfb::KeyRemapper::~KeyRemapper()':
KeyRemapper.cxx:(.text+0x334): undefined reference to `os::Mutex::~Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(KeyRemapper.cxx.o): In function `rfb::KeyRemapper::setMapping(char const*)':
KeyRemapper.cxx:(.text+0x3a1): undefined reference to `os::Mutex::lock()'
KeyRemapper.cxx:(.text+0x5a9): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(KeyRemapper.cxx.o): In function `rfb::KeyRemapper::KeyRemapper(char const*)':
KeyRemapper.cxx:(.text+0x61e): undefined reference to `os::Mutex::Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(KeyRemapper.cxx.o): In function `rfb::KeyRemapper::setMapping(char const*) [clone .cold.39]':
KeyRemapper.cxx:(.text.unlikely+0x6): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Logger_file.cxx.o): In function `rfb::Logger_File::write(int, char const*, char const*)':
Logger_file.cxx:(.text+0x2a): undefined reference to `os::Mutex::lock()'
Logger_file.cxx:(.text+0x1a0): undefined reference to `os::Mutex::unlock()'
Logger_file.cxx:(.text+0x22e): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Logger_file.cxx.o): In function `rfb::Logger_File::Logger_File(char const*)':
Logger_file.cxx:(.text+0x2b3): undefined reference to `os::Mutex::Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Logger_file.cxx.o): In function `rfb::Logger_File::~Logger_File()':
Logger_file.cxx:(.text+0x33c): undefined reference to `os::Mutex::~Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Logger_file.cxx.o): In function `rfb::Logger_File::write(int, char const*, char const*) [clone .cold.0]':
Logger_file.cxx:(.text.unlikely+0x6): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SMsgReader.cxx.o): In function `rfb::SMsgReader::readExtendedClipboard(int)':
SMsgReader.cxx:(.text+0x1eed): undefined reference to `rdr::ZlibInStream::ZlibInStream()'
SMsgReader.cxx:(.text+0x1f01): undefined reference to `rdr::ZlibInStream::setUnderlying(rdr::InStream*, unsigned long)'
SMsgReader.cxx:(.text+0x21d0): undefined reference to `rdr::ZlibInStream::flushUnderlying()'
SMsgReader.cxx:(.text+0x21dc): undefined reference to `rdr::ZlibInStream::setUnderlying(rdr::InStream*, unsigned long)'
SMsgReader.cxx:(.text+0x223e): undefined reference to `rdr::ZlibInStream::~ZlibInStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SMsgReader.cxx.o): In function `rfb::SMsgReader::readExtendedClipboard(int) [clone .cold.87]':
SMsgReader.cxx:(.text.unlikely+0x5c4): undefined reference to `rdr::ZlibInStream::~ZlibInStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SMsgWriter.cxx.o): In function `rfb::SMsgWriter::writeClipboardProvide(unsigned int, unsigned long const*, unsigned char const* const*)':
SMsgWriter.cxx:(.text+0x40fd): undefined reference to `rdr::ZlibOutStream::ZlibOutStream(rdr::OutStream*, int)'
SMsgWriter.cxx:(.text+0x4136): undefined reference to `rdr::ZlibOutStream::setUnderlying(rdr::OutStream*)'
SMsgWriter.cxx:(.text+0x424f): undefined reference to `rdr::ZlibOutStream::flush()'
SMsgWriter.cxx:(.text+0x43f6): undefined reference to `rdr::ZlibOutStream::~ZlibOutStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SMsgWriter.cxx.o): In function `rfb::SMsgWriter::writeClipboardProvide(unsigned int, unsigned long const*, unsigned char const* const*) [clone .cold.88]':
SMsgWriter.cxx:(.text.unlikely+0x59e): undefined reference to `rdr::ZlibOutStream::~ZlibOutStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SSecurityVncAuth.cxx.o): In function `rfb::SSecurityVncAuth::processMsg()':
SSecurityVncAuth.cxx:(.text+0x7d6): undefined reference to `rdr::RandomStream::RandomStream()'
SSecurityVncAuth.cxx:(.text+0x87d): undefined reference to `rdr::RandomStream::~RandomStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SSecurityVncAuth.cxx.o): In function `rfb::SSecurityVncAuth::processMsg() [clone .cold.53]':
SSecurityVncAuth.cxx:(.text.unlikely+0x7e): undefined reference to `rdr::RandomStream::~RandomStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(TightEncoder.cxx.o): In function `rfb::TightEncoder::TightEncoder(rfb::SConnection*)':
TightEncoder.cxx:(.text+0x24c): undefined reference to `rdr::ZlibOutStream::ZlibOutStream(rdr::OutStream*, int)'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(TightEncoder.cxx.o): In function `rfb::TightEncoder::getZlibOutStream(int, int, unsigned long)':
TightEncoder.cxx:(.text+0x56f): undefined reference to `rdr::ZlibOutStream::setUnderlying(rdr::OutStream*)'
TightEncoder.cxx:(.text+0x579): undefined reference to `rdr::ZlibOutStream::setCompressionLevel(int)'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(TightEncoder.cxx.o): In function `rfb::TightEncoder::flushZlibOutStream(rdr::OutStream*)':
TightEncoder.cxx:(.text+0x5f1): undefined reference to `typeinfo for rdr::ZlibOutStream'
TightEncoder.cxx:(.text+0x635): undefined reference to `rdr::ZlibOutStream::setUnderlying(rdr::OutStream*)'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(ZRLEEncoder.cxx.o): In function `rfb::ZRLEEncoder::ZRLEEncoder(rfb::SConnection*)':
ZRLEEncoder.cxx:(.text+0x6b): undefined reference to `rdr::ZlibOutStream::ZlibOutStream(rdr::OutStream*, int)'
ZRLEEncoder.cxx:(.text+0xce): undefined reference to `rdr::ZlibOutStream::setUnderlying(rdr::OutStream*)'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(ZRLEEncoder.cxx.o): In function `rfb::ZRLEEncoder::~ZRLEEncoder()':
ZRLEEncoder.cxx:(.text+0x121): undefined reference to `rdr::ZlibOutStream::setUnderlying(rdr::OutStream*)'
ZRLEEncoder.cxx:(.text+0x14c): undefined reference to `rdr::ZlibOutStream::~ZlibOutStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(ZRLEEncoder.cxx.o): In function `rfb::ZRLEEncoder::writeRect(rfb::PixelBuffer const*, rfb::Palette const&)':
ZRLEEncoder.cxx:(.text+0x7d7): undefined reference to `rdr::ZlibOutStream::flush()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(ZRLEEncoder.cxx.o): In function `rfb::ZRLEEncoder::writeSolidRect(int, int, rfb::PixelFormat const&, unsigned char const*)':
ZRLEEncoder.cxx:(.text+0x9a9): undefined reference to `rdr::ZlibOutStream::flush()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(ZRLEEncoder.cxx.o): In function `rfb::ZRLEEncoder::ZRLEEncoder(rfb::SConnection*) [clone .cold.12]':
ZRLEEncoder.cxx:(.text.unlikely+0x23): undefined reference to `rdr::ZlibOutStream::~ZlibOutStream()'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:849: Xvnc] Error 1
make[2]: Leaving directory '/home/cendio/tigervnc/build/unix/xserver/hw/vnc'
make[1]: *** [Makefile:624: all-recursive] Error 1
make[1]: Leaving directory '/home/cendio/tigervnc/build/unix/xserver/hw'
make: *** [Makefile:824: all-recursive] Error 1

To Reproduce
Steps to reproduce the behavior:

  1. Set up a new RHEL 8 VM.
  2. Install building requirements according to BUILDING.txt
  3. Clone TigerVNC repo
  4. cd tigervnc; mkdir build; cd build
  5. cmake -G "Unix Makefiles" -DENABLE_H264=OFF -DENABLE_GNUTLS=OFF -DENABLE_NLS=OFF ..
  6. make
  7. All building steps under Building the TigerVNC Server on Unix/Linux Systems in BUILDING.txt.
  8. make TIGERVNC_SRCDIR=/home/cendio/tigervnc TIGERVNC_BUILDDIR=/home/cendio/tigervnc/build

Expected behavior
Was expecting to be able to build.

Client (please complete the following information):
N/A

Server (please complete the following information):
N/A

Additional context
Found a similar problem when building on Windows in issue #981. That issue had no clear solution, but hinted towards multiple zlib:s on the system. This does not seem to be the case here.

@CendioOssman
Copy link
Member

Odd. It seems like librdr and libos were omitted from the link line.

Can you run make V=1 and see what the link line for Xvnc looks like?

@LMattsson
Copy link
Contributor Author

Heres the output:
make V=1 TIGERVNC_SRCDIR=/home/cendio/tigervnc TIGERVNC_BUILDDIR=/home/cendio/tigervnc/build

/bin/sh ../../libtool  --tag=CXX   --mode=link g++  -g -O2 -export-dynamic  -o Xvnc Xvnc-xvnc.o Xvnc-stubs.o
Xvnc-miinitext.o Xvnc-fbcmap_mi.o Xvnc-buildtime.o ../../fb/libfb.la ../../xfixes/libxfixes.la ../../Xext/libXext.la
../../dbe/libdbe.la ../../record/librecord.la ../../glx/libglx.la ../../glx/libglxvnd.la ../../randr/librandr.la 
../../render/librender.la ../../damageext/libdamageext.la  ../../present/libpresent.la ../../miext/sync/libsync.la 
../../miext/damage/libdamage.la ../../miext/shadow/libshadow.la ../../Xi/libXi.la ../../xkb/libxkb.la 
../../xkb/libxkbstubs.la ../../composite/libcomposite.la ../../dix/libmain.la ../../dix/libdix.la ../../mi/libmi.la
 ../../os/libos.la libvnccommon.la /home/cendio/tigervnc/build/common/network/libnetwork.la 
/home/cendio/tigervnc/build/common/rfb/librfb.la /home/cendio/tigervnc/build/common/rdr/librdr.la
/home/cendio/tigervnc/build/common/os/libos.la /home/cendio/tigervnc/build/unix/common/libunixcommon.la -lpixman-1 -lXfont2 -lXau
-lm   -lGL  -lX11 -lm  

libtool: link: g++ -g -O2 -o Xvnc Xvnc-xvnc.o Xvnc-stubs.o Xvnc-miinitext.o Xvnc-fbcmap_mi.o Xvnc-buildtime.o
 -Wl,--export-dynamic  ../../fb/.libs/libfb.a ../../xfixes/.libs/libxfixes.a ../../Xext/.libs/libXext.a ../../dbe/.libs/libdbe.a
 ../../record/.libs/librecord.a ../../glx/.libs/libglx.a ../../glx/.libs/libglxvnd.a ../../randr/.libs/librandr.a ../../render/.libs
/librender.a ../../damageext/.libs/libdamageext.a ../../present/.libs/libpresent.a ../../miext/sync/.libs/libsync.a
 ../../miext/damage/.libs/libdamage.a ../../miext/shadow/.libs/libshadow.a ../../Xi/.libs/libXi.a ../../xkb/.libs/libxkb.a 
../../xkb/.libs/libxkbstubs.a ../../composite/.libs/libcomposite.a ../../dix/.libs/libmain.a ../../dix/.libs/libdix.a ../../mi/.libs
/libmi.a ../../os/.libs/libos.a -ldl ./.libs/libvnccommon.a -L/usr/lib64 /home/cendio/tigervnc/build/common/network/.libs/libnetwork.a 
-ljpeg -lpam -lhogweed -lgmp /home/cendio/tigervnc/build/common/rdr/.libs/librdr.a -lz 
/home/cendio/tigervnc/build/common/os/.libs/libos.a /home/cendio/tigervnc/build/common/rfb/.libs/librfb.a -lnettle
-lpthread /home/cendio/tigervnc/build/unix/common/.libs/libunixcommon.a -lpixman-1 -lXfont2 -lXau -lGL -lX11 -lm -pthread

@CendioOssman
Copy link
Member

Something is wrong there. This is the output when I run it on my Fedora 38 here:

/bin/sh ../../libtool  --tag=CXX   --mode=link g++  -g -O2 -export-dynamic  -o Xvnc Xvnc-xvnc.o Xvnc-stubs.o
Xvnc-miinitext.o Xvnc-fbcmap_mi.o Xvnc-buildtime.o ../../fb/libfb.la ../../xfixes/libxfixes.la ../../Xext/libXext.la
../../dbe/libdbe.la ../../record/librecord.la ../../glx/libglx.la ../../glx/libglxvnd.la ../../randr/librandr.la
../../render/librender.la ../../damageext/libdamageext.la ../../dri3/libdri3.la ../../present/libpresent.la ../../miext/sync/libsync.la
../../miext/damage/libdamage.la ../../miext/shadow/libshadow.la ../../Xi/libXi.la ../../xkb/libxkb.la
../../xkb/libxkbstubs.la ../../composite/libcomposite.la ../../dix/libmain.la ../../dix/libdix.la ../../mi/libmi.la
../../os/libos.la libvnccommon.la /home/ossman/devel/tigervnc/builddir/native/common/network/libnetwork.la
/home/ossman/devel/tigervnc/builddir/native/common/rfb/librfb.la /home/ossman/devel/tigervnc/builddir/native/common/rdr/librdr.la
/home/ossman/devel/tigervnc/builddir/native/common/os/libos.la /home/ossman/devel/tigervnc/builddir/native/unix/common/libunixcommon.la -lpixman-1 -lXfont2 -lXau -lsystemd -lxshmfence -lXdmcp
-lm   -lGL  -lX11 -lm  
libtool: link: g++ -g -O2 -o Xvnc Xvnc-xvnc.o Xvnc-stubs.o Xvnc-miinitext.o Xvnc-fbcmap_mi.o Xvnc-buildtime.o
-Wl,--export-dynamic  ../../fb/.libs/libfb.a ../../xfixes/.libs/libxfixes.a ../../Xext/.libs/libXext.a ../../dbe/.libs/libdbe.a
../../record/.libs/librecord.a ../../glx/.libs/libglx.a ../../glx/.libs/libglxvnd.a ../../randr/.libs/librandr.a ../../render/.libs
/librender.a ../../damageext/.libs/libdamageext.a ../../dri3/.libs/libdri3.a ../../present/.libs/libpresent.a ../../miext/sync/.libs/libsync.a
../../miext/damage/.libs/libdamage.a ../../miext/shadow/.libs/libshadow.a ../../Xi/.libs/libXi.a ../../xkb/.libs/libxkb.a
../../xkb/.libs/libxkbstubs.a ../../composite/.libs/libcomposite.a ../../dix/.libs/libmain.a ../../dix/.libs/libdix.a ../../mi/.libs
/libmi.a ../../os/.libs/libos.a -lcrypto -lunwind ./.libs/libvnccommon.a /home/ossman/devel/tigervnc/builddir/native/common/network/.libs/libnetwork.a /home/ossman/devel/tigervnc/builddir/native/common/rfb/.libs/librfb.a -L/usr/lib64 /home/ossman/devel/tigervnc/builddir/native/common/rdr/.libs/librdr.a /local/home/ossman/devel/tigervnc/builddir/native/common/network/.libs/libnetwork.a
-ljpeg -lavcodec -lavutil -lswscale -lpam -lhogweed -lgmp /home/ossman/devel/tigervnc/builddir/native/common/os/.libs/libos.a /local/home/ossman/devel/tigervnc/builddir/native/common/rdr/.libs/librdr.a -lz
/local/home/ossman/devel/tigervnc/builddir/native/common/os/.libs/libos.a /local/home/ossman/devel/tigervnc/builddir/native/common/rfb/.libs/librfb.a -lgnutls -lnettle
/usr/lib64/libpthread.a /home/ossman/devel/tigervnc/builddir/native/unix/common/.libs/libunixcommon.a -lpixman-1 -lXfont2 -lXau -lsystemd -lxshmfence -lXdmcp -lGL -lX11 -lm -pthread

As you can note here, the TigerVNC libraries (e.g. librdr) occur multiple times in the link line. Which is needed for things to link correctly, as there are circular dependencies.

What does your /home/cendio/tigervnc/build/common/rfb/librfb.la look like? This is what mine looks line:

# librfb.la - a libtool library file
# Generated by ltmain.sh (GNU libtool) 2.2.6b
dlname=''

library_names=''

old_library='librfb.a'

inherited_linker_flags=''

dependency_libs='  /local/home/ossman/devel/tigervnc/builddir/native/common/os/libos.la /local/home/ossman/devel/tigervnc/builddir/native/common/rdr/librdr.la /local/home/ossman/devel/tigervnc/builddir/native/common/network/libnetwork.la -L/usr/lib64 -ljpeg -L/usr/lib64 -lpixman-1 -L/usr/lib64 -lavcodec -L/usr/lib64 -lavutil -L/usr/lib64 -lswscale -L/usr/lib64 -lpam -L/usr/lib64 -lgnutls -L/usr/lib64 -lhogweed -L/usr/lib64 -lnettle -L/usr/lib64 -lgmp'

weak_library_names=''

current=
age=
revision=

installed=no

shouldnotlink=no

dlopen=''
dlpreopen=''

libdir='/usr/lib'

@LMattsson
Copy link
Contributor Author

My file librfb.la looks very similar to yours. librdr.la is included under dependency_libs and that file exists.

Your file includes these additional flags under dependency_libs, not sure if that is relevant?
-L/usr/lib64 -lavcodec -L/usr/lib64 -lavutil -L/usr/lib64 -lswscale -L/usr/lib64 -lgnutls

# librfb.la - a libtool library file
# Generated by ltmain.sh (GNU libtool) 2.2.6b
dlname=''

library_names=''

old_library='librfb.a'

inherited_linker_flags=''

dependency_libs='  /home/cendio/tigervnc/build/common/os/libos.la /home/cendio/tigervnc/build/common/rdr/librdr.la /home/cendio/tigervnc/build/common/network/libnetwork.la -L/usr/lib64 -ljpeg -L/usr/lib64 -lpixman-1 -L/usr/lib64 -lpam -L/usr/lib64 -lhogweed -L/usr/lib64 -lnettle -L/usr/lib64 -lgmp'

weak_library_names=''

current=
age=
revision=

installed=no

shouldnotlink=no

dlopen=''
dlpreopen=''

libdir='/usr/lib'

@LMattsson
Copy link
Contributor Author

Tested building again from the start, but with the following cmake (had to install a few more build deps):
cmake -G "Unix Makefiles" ..

Also noticed that I used some bad paths in the configure step, mainly using --with-serverconfig-path=/usr/lib[64]/xorg --with-dri-driver-path=/usr/lib[64]/dri \ instead of the correct --with-serverconfig-path=/usr/lib64/xorg --with-dri-driver-path=/usr/lib64/dri \.

Unfortunately, I'm still getting the same error.

Error output
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::BinaryParameter::getValueStr[abi:cxx11]() const':
Configuration.cxx:(.text+0x142): undefined reference to `os::Mutex::lock()'
Configuration.cxx:(.text+0x15a): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::StringParameter::getValueStr[abi:cxx11]() const':
Configuration.cxx:(.text+0x188): undefined reference to `os::Mutex::lock()'
Configuration.cxx:(.text+0x1ce): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::VoidParameter::VoidParameter(char const*, char const*, rfb::ConfigurationObject)':
Configuration.cxx:(.text+0x77d): undefined reference to `os::Mutex::Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::VoidParameter::~VoidParameter()':
Configuration.cxx:(.text+0x7cc): undefined reference to `os::Mutex::~Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::StringParameter::setParam(char const*)':
Configuration.cxx:(.text+0xce2): undefined reference to `os::Mutex::lock()'
Configuration.cxx:(.text+0xd35): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::BinaryParameter::setParam(unsigned char const*, unsigned long)':
Configuration.cxx:(.text+0xd9b): undefined reference to `os::Mutex::lock()'
Configuration.cxx:(.text+0xe0f): undefined reference to `os::Mutex::unlock()'
Configuration.cxx:(.text+0xe24): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::BinaryParameter::getData() const':
Configuration.cxx:(.text+0x16a6): undefined reference to `os::Mutex::lock()'
Configuration.cxx:(.text+0x1703): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::BinaryParameter::getValueStr[abi:cxx11]() const [clone .cold.58]':
Configuration.cxx:(.text.unlikely+0x1a): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::StringParameter::getValueStr[abi:cxx11]() const [clone .cold.59]':
Configuration.cxx:(.text.unlikely+0x2a): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::StringParameter::setParam(char const*) [clone .cold.61]':
Configuration.cxx:(.text.unlikely+0x73): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o): In function `rfb::BinaryParameter::setParam(unsigned char const*, unsigned long) [clone .cold.62]':
Configuration.cxx:(.text.unlikely+0x84): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Configuration.cxx.o):Configuration.cxx:(.text.unlikely+0xe2): more undefined references to `os::Mutex::unlock()' follow
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(KeyRemapper.cxx.o): In function `rfb::KeyRemapper::remapKey(unsigned int) const':
KeyRemapper.cxx:(.text+0x2c1): undefined reference to `os::Mutex::lock()'
KeyRemapper.cxx:(.text+0x30b): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(KeyRemapper.cxx.o): In function `rfb::KeyRemapper::~KeyRemapper()':
KeyRemapper.cxx:(.text+0x334): undefined reference to `os::Mutex::~Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(KeyRemapper.cxx.o): In function `rfb::KeyRemapper::setMapping(char const*)':
KeyRemapper.cxx:(.text+0x3a1): undefined reference to `os::Mutex::lock()'
KeyRemapper.cxx:(.text+0x5a9): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(KeyRemapper.cxx.o): In function `rfb::KeyRemapper::KeyRemapper(char const*)':
KeyRemapper.cxx:(.text+0x61e): undefined reference to `os::Mutex::Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(KeyRemapper.cxx.o): In function `rfb::KeyRemapper::setMapping(char const*) [clone .cold.39]':
KeyRemapper.cxx:(.text.unlikely+0x6): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Logger_file.cxx.o): In function `rfb::Logger_File::write(int, char const*, char const*)':
Logger_file.cxx:(.text+0x2a): undefined reference to `os::Mutex::lock()'
Logger_file.cxx:(.text+0x1a0): undefined reference to `os::Mutex::unlock()'
Logger_file.cxx:(.text+0x22e): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Logger_file.cxx.o): In function `rfb::Logger_File::Logger_File(char const*)':
Logger_file.cxx:(.text+0x2b3): undefined reference to `os::Mutex::Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Logger_file.cxx.o): In function `rfb::Logger_File::~Logger_File()':
Logger_file.cxx:(.text+0x33c): undefined reference to `os::Mutex::~Mutex()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(Logger_file.cxx.o): In function `rfb::Logger_File::write(int, char const*, char const*) [clone .cold.0]':
Logger_file.cxx:(.text.unlikely+0x6): undefined reference to `os::Mutex::unlock()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SMsgReader.cxx.o): In function `rfb::SMsgReader::readExtendedClipboard(int)':
SMsgReader.cxx:(.text+0x1eed): undefined reference to `rdr::ZlibInStream::ZlibInStream()'
SMsgReader.cxx:(.text+0x1f01): undefined reference to `rdr::ZlibInStream::setUnderlying(rdr::InStream*, unsigned long)'
SMsgReader.cxx:(.text+0x21d0): undefined reference to `rdr::ZlibInStream::flushUnderlying()'
SMsgReader.cxx:(.text+0x21dc): undefined reference to `rdr::ZlibInStream::setUnderlying(rdr::InStream*, unsigned long)'
SMsgReader.cxx:(.text+0x223e): undefined reference to `rdr::ZlibInStream::~ZlibInStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SMsgReader.cxx.o): In function `rfb::SMsgReader::readExtendedClipboard(int) [clone .cold.87]':
SMsgReader.cxx:(.text.unlikely+0x5c4): undefined reference to `rdr::ZlibInStream::~ZlibInStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SMsgWriter.cxx.o): In function `rfb::SMsgWriter::writeClipboardProvide(unsigned int, unsigned long const*, unsigned char const* const*)':
SMsgWriter.cxx:(.text+0x40fd): undefined reference to `rdr::ZlibOutStream::ZlibOutStream(rdr::OutStream*, int)'
SMsgWriter.cxx:(.text+0x4136): undefined reference to `rdr::ZlibOutStream::setUnderlying(rdr::OutStream*)'
SMsgWriter.cxx:(.text+0x424f): undefined reference to `rdr::ZlibOutStream::flush()'
SMsgWriter.cxx:(.text+0x43f6): undefined reference to `rdr::ZlibOutStream::~ZlibOutStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SMsgWriter.cxx.o): In function `rfb::SMsgWriter::writeClipboardProvide(unsigned int, unsigned long const*, unsigned char const* const*) [clone .cold.88]':
SMsgWriter.cxx:(.text.unlikely+0x59e): undefined reference to `rdr::ZlibOutStream::~ZlibOutStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SSecurityVncAuth.cxx.o): In function `rfb::SSecurityVncAuth::processMsg()':
SSecurityVncAuth.cxx:(.text+0x7d6): undefined reference to `rdr::RandomStream::RandomStream()'
SSecurityVncAuth.cxx:(.text+0x87d): undefined reference to `rdr::RandomStream::~RandomStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SSecurityVncAuth.cxx.o): In function `rfb::SSecurityVncAuth::processMsg() [clone .cold.53]':
SSecurityVncAuth.cxx:(.text.unlikely+0x7e): undefined reference to `rdr::RandomStream::~RandomStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SSecurityTLS.cxx.o): In function `rfb::SSecurityTLS::processMsg()':
SSecurityTLS.cxx:(.text+0x723): undefined reference to `rdr::TLSInStream::TLSInStream(rdr::InStream*, gnutls_session_int*)'
SSecurityTLS.cxx:(.text+0x743): undefined reference to `rdr::TLSOutStream::TLSOutStream(rdr::OutStream*, gnutls_session_int*)'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SSecurityRSAAES.cxx.o): In function `rfb::SSecurityRSAAES::SSecurityRSAAES(rfb::SConnection*, unsigned int, int, bool)':
SSecurityRSAAES.cxx:(.text+0x19c): undefined reference to `rdr::RandomStream::RandomStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SSecurityRSAAES.cxx.o): In function `rfb::SSecurityRSAAES::setCipher()':
SSecurityRSAAES.cxx:(.text+0xd7f): undefined reference to `rdr::AESInStream::AESInStream(rdr::InStream*, unsigned char const*, int)'
SSecurityRSAAES.cxx:(.text+0xde2): undefined reference to `rdr::AESOutStream::AESOutStream(rdr::OutStream*, unsigned char const*, int)'
SSecurityRSAAES.cxx:(.text+0xe68): undefined reference to `rdr::AESInStream::AESInStream(rdr::InStream*, unsigned char const*, int)'
SSecurityRSAAES.cxx:(.text+0xecb): undefined reference to `rdr::AESOutStream::AESOutStream(rdr::OutStream*, unsigned char const*, int)'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(SSecurityRSAAES.cxx.o): In function `rfb::SSecurityRSAAES::~SSecurityRSAAES()':
SSecurityRSAAES.cxx:(.text+0x1f40): undefined reference to `rdr::RandomStream::~RandomStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(TightEncoder.cxx.o): In function `rfb::TightEncoder::TightEncoder(rfb::SConnection*)':
TightEncoder.cxx:(.text+0x24c): undefined reference to `rdr::ZlibOutStream::ZlibOutStream(rdr::OutStream*, int)'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(TightEncoder.cxx.o): In function `rfb::TightEncoder::getZlibOutStream(int, int, unsigned long)':
TightEncoder.cxx:(.text+0x56f): undefined reference to `rdr::ZlibOutStream::setUnderlying(rdr::OutStream*)'
TightEncoder.cxx:(.text+0x579): undefined reference to `rdr::ZlibOutStream::setCompressionLevel(int)'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(TightEncoder.cxx.o): In function `rfb::TightEncoder::flushZlibOutStream(rdr::OutStream*)':
TightEncoder.cxx:(.text+0x5f1): undefined reference to `typeinfo for rdr::ZlibOutStream'
TightEncoder.cxx:(.text+0x635): undefined reference to `rdr::ZlibOutStream::setUnderlying(rdr::OutStream*)'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(ZRLEEncoder.cxx.o): In function `rfb::ZRLEEncoder::ZRLEEncoder(rfb::SConnection*)':
ZRLEEncoder.cxx:(.text+0x6b): undefined reference to `rdr::ZlibOutStream::ZlibOutStream(rdr::OutStream*, int)'
ZRLEEncoder.cxx:(.text+0xce): undefined reference to `rdr::ZlibOutStream::setUnderlying(rdr::OutStream*)'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(ZRLEEncoder.cxx.o): In function `rfb::ZRLEEncoder::~ZRLEEncoder()':
ZRLEEncoder.cxx:(.text+0x121): undefined reference to `rdr::ZlibOutStream::setUnderlying(rdr::OutStream*)'
ZRLEEncoder.cxx:(.text+0x14c): undefined reference to `rdr::ZlibOutStream::~ZlibOutStream()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(ZRLEEncoder.cxx.o): In function `rfb::ZRLEEncoder::writeRect(rfb::PixelBuffer const*, rfb::Palette const&)':
ZRLEEncoder.cxx:(.text+0x7d7): undefined reference to `rdr::ZlibOutStream::flush()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(ZRLEEncoder.cxx.o): In function `rfb::ZRLEEncoder::writeSolidRect(int, int, rfb::PixelFormat const&, unsigned char const*)':
ZRLEEncoder.cxx:(.text+0x9a9): undefined reference to `rdr::ZlibOutStream::flush()'
/home/cendio/tigervnc/build/common/rfb/.libs/librfb.a(ZRLEEncoder.cxx.o): In function `rfb::ZRLEEncoder::ZRLEEncoder(rfb::SConnection*) [clone .cold.12]':
ZRLEEncoder.cxx:(.text.unlikely+0x23): undefined reference to `rdr::ZlibOutStream::~ZlibOutStream()'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:849: Xvnc] Error 1
make[2]: Leaving directory '/home/cendio/tigervnc/build/unix/xserver/hw/vnc'
make[1]: *** [Makefile:624: all-recursive] Error 1
make[1]: Leaving directory '/home/cendio/tigervnc/build/unix/xserver/hw'
make: *** [Makefile:824: all-recursive] Error 1

My new linkline still only contains librdr.la twice, while your linkline contains it 3 times.

/bin/sh ../../libtool  --tag=CXX   --mode=link g++  -g -O2 -export-dynamic  -o Xvnc Xvnc-xvnc.o Xvnc-stubs.o Xvnc-miinitext.o 
Xvnc-fbcmap_mi.o Xvnc-buildtime.o ../../fb/libfb.la ../../xfixes/libxfixes.la ../../Xext/libXext.la  ../../dbe/libdbe.la ../../record/librecord.la 
../../glx/libglx.la ../../glx/libglxvnd.la ../../randr/librandr.la ../../render/librender.la ../../damageext/libdamageext.la  
../../present/libpresent.la ../../miext/sync/libsync.la ../../miext/damage/libdamage.la ../../miext/shadow/libshadow.la ../../Xi/libXi.la 
../../xkb/libxkb.la ../../xkb/libxkbstubs.la ../../composite/libcomposite.la ../../dix/libmain.la ../../dix/libdix.la ../../mi/libmi.la 
../../os/libos.la libvnccommon.la /home/cendio/tigervnc/build/common/network/libnetwork.la 
/home/cendio/tigervnc/build/common/rfb/librfb.la /home/cendio/tigervnc/build/common/rdr/librdr.la 
/home/cendio/tigervnc/build/common/os/libos.la /home/cendio/tigervnc/build/unix/common/libunixcommon.la 
-lpixman-1 -lXfont2 -lXau    -lm   -lGL  -lX11 -lm  

libtool: link: g++ -g -O2 -o Xvnc Xvnc-xvnc.o Xvnc-stubs.o Xvnc-miinitext.o Xvnc-fbcmap_mi.o Xvnc-buildtime.o -Wl,--export-dynamic  
../../fb/.libs/libfb.a ../../xfixes/.libs/libxfixes.a ../../Xext/.libs/libXext.a ../../dbe/.libs/libdbe.a ../../record/.libs/librecord.a 
../../glx/.libs/libglx.a ../../glx/.libs/libglxvnd.a ../../randr/.libs/librandr.a ../../render/.libs/librender.a ../../damageext/.lib/libdamageext.a 
../../present/.libs/libpresent.a ../../miext/sync/.libs/libsync.a ../../miext/damage/.libs/libdamage.a ../../miext/shadow/.libs/libshadow.a 
../../Xi/.libs/libXi.a ../../xkb/.libs/libxkb.a ../../xkb/.libs/libxkbstubs.a ../../composite/.libs/libcomposite.a ../../dix/.libs/libmain.a 
../../dix/.libs/libdix.a ../../mi/.libs/libmi.a ../../os/.libs/libos.a -ldl ./.libs/libvnccommon.a -L/usr/lib64 /home/cendio/tigervnc/build/common/network/.libs/libnetwork.a 
-ljpeg -lavcodec -lavutil -lswscale -lpam -lhogweed -lgmp /home/cendio/tigervnc/build/common/rdr/.libs/librdr.a -lz 
/home/cendio/tigervnc/build/common/os/.libs/libos.a /home/cendio/tigervnc/build/common/rfb/.libs/librfb.a -lgnutls -lnettle -lpthread 
/home/cendio/tigervnc/build/unix/common/.libs/libunixcommon.a -lpixman-1 -lXfont2 -lXau -lGL -lX11 -lm -pthread

My librfb.la has the same content as yours now too:

# librfb.la - a libtool library file
# Generated by ltmain.sh (GNU libtool) 2.2.6b
dlname=''

library_names=''

old_library='librfb.a'

inherited_linker_flags=''

dependency_libs='  /home/cendio/tigervnc/build/common/os/libos.la /home/cendio/tigervnc/build/common/rdr/librdr.la /home/cendio/tigervnc/build/common/network/libnetwork.la -L/usr/lib64 -ljpeg -L/usr/lib64 -lpixman-1 -L/usr/lib64 -lavcodec -L/usr/lib64 -lavutil -L/usr/lib64 -lswscale -L/usr/lib64 -lpam -L/usr/lib64 -lgnutls -L/usr/lib64 -lhogweed -L/usr/lib64 -lnettle -L/usr/lib64 -lgmp'

weak_library_names=''

current=
age=
revision=

installed=no

shouldnotlink=no

dlopen=''
dlpreopen=''

libdir='/usr/lib'

I got a warning when running configure, could this be relevant?

configure: WARNING: unrecognized options: --disable-config-dbus, --enable-install-libxf86config, --with-fontdir, --with-dri-driver-path

@CendioOssman
Copy link
Member

No, I don't think any of those flags are relevant here, unfortunately.

@LMattsson
Copy link
Contributor Author

I managed to build TigerVNC when adding a slash (/) to the end of my TIGERVNC_BUILDDIR path. Below are the lines I used, but V=1 should be optional.

This line builds successfully:
make V=1 TIGERVNC_SRCDIR=/home/cendio/tigervnc TIGERVNC_BUILDDIR=/home/cendio/tigervnc/build/

This line gives build errors:
make V=1 TIGERVNC_SRCDIR=/home/cendio/tigervnc TIGERVNC_BUILDDIR=/home/cendio/tigervnc/build

Adding a slash to TIGERVNC_SRCDIR did not seem to have an impact. Either way, the building should be more robust than crashing on a missed slashed, I'll see if I can find the underlying reason for this behaviour.

@CendioOssman
Copy link
Member

That is extremely odd. I don't have a slash in my builds here. And the automated builds here on GitHub also lack that slash.

@LMattsson
Copy link
Contributor Author

Is it possible that the slash only makes a difference in out-of-tree build, and not in in-tree builds?

@CendioOssman
Copy link
Member

That, unfortunately, doesn't seem to be it. I have the same setup here. :/

@CendioOssman
Copy link
Member

Somewhat good news. I was able to reproduce the issue by tweaking the builds here:

https://github.com/CendioOssman/tigervnc/actions/runs/7196969468/job/19603024854

@CendioOssman
Copy link
Member

Again, it has something to do with how the directories are specified.

Works:

2023-12-13T15:22:21.7527568Z + make -j4 TIGERVNC_SRCDIR=/home/rpm/rpmbuild/BUILD/tigervnc-1.13.80/builddir/unix/xserver/../../.. TIGERVNC_BUILDDIR=/home/rpm/rpmbuild/BUILD/tigervnc-1.13.80/builddir/unix/xserver/../..

Broken:

2023-12-13T15:14:52.2746867Z + make -j4 TIGERVNC_SRCDIR=/home/rpm/rpmbuild/BUILD/tigervnc-1.13.80 TIGERVNC_BUILDDIR=/home/rpm/rpmbuild/BUILD/tigervnc-1.13.80/builddir

@CendioOssman CendioOssman added the bug Something isn't working label Jan 10, 2024
@logeable
Copy link

I managed to build TigerVNC when adding a slash (/) to the end of my TIGERVNC_BUILDDIR path. Below are the lines I used, but V=1 should be optional.

This line builds successfully: make V=1 TIGERVNC_SRCDIR=/home/cendio/tigervnc TIGERVNC_BUILDDIR=/home/cendio/tigervnc/build/

This line gives build errors: make V=1 TIGERVNC_SRCDIR=/home/cendio/tigervnc TIGERVNC_BUILDDIR=/home/cendio/tigervnc/build

Adding a slash to TIGERVNC_SRCDIR did not seem to have an impact. Either way, the building should be more robust than crashing on a missed slashed, I'll see if I can find the underlying reason for this behaviour.

You saved me.

@logeable
Copy link

The circular dependencies

[root@localhost vnc]# grep dependency_libs  /root/workstation/tigervnc/build/common/network/libnetwork.la
dependency_libs='  /root/workstation/tigervnc/build/common/os/libos.la /root/workstation/tigervnc/build/common/rdr/librdr.la /root/workstation/tigervnc/build/common/rfb/librfb.la'

[root@localhost vnc]# grep dependency_libs  /root/workstation/tigervnc/build/common/os/libos.la
dependency_libs='  /root/workstation/tigervnc/build/common/rdr/librdr.la -L/usr/lib64 -lpthread'

[root@localhost vnc]# grep dependency_libs  /root/workstation/tigervnc/build/common/rdr/librdr.la
dependency_libs='  -L/usr/lib64 -lz /root/workstation/tigervnc/build/common/os/libos.la /root/workstation/tigervnc/build/common/rfb/librfb.la -L/usr/lib64 -lgnutls -L/usr/lib64 -lnettle'

[root@localhost vnc]# grep dependency_libs  /root/workstation/tigervnc/build/common/rfb/librfb.la
dependency_libs='  /root/workstation/tigervnc/build/common/os/libos.la /root/workstation/tigervnc/build/common/rdr/librdr.la /root/workstation/tigervnc/build/common/network/libnetwork.la -L/usr/lib64 -ljpeg -L/usr/lib64 -lpixman-1 -L/usr/lib64 -lavcodec -L/usr/lib64 -lavutil -L/usr/lib64 -lswscale -L/usr/lib64 -lpam -L/usr/lib64 -lgnutls -L/usr/lib64 -lhogweed -L/usr/lib64 -lnettle -L/usr/lib64 -lgmp'

@logeable
Copy link

If I run make command set TIGERVNC_BUILDDIR slash at the end. I get link command as below:

g++ -g -O2 -o Xvnc Xvnc-xvnc.o Xvnc-stubs.o Xvnc-miinitext.o Xvnc-buildtime.o -Wl,--export-dynamic ../../fb/.libs/libfb.a ../../xfixes/.libs/libxfixes.a ../../Xext/.libs/libXext.a ../../dbe/.libs/libdbe.a ../../record/.libs/librecord.a ../../glx/.libs/libglx.a ../../glx/.libs/libglxvnd.a ../../randr/.libs/librandr.a ../../render/.libs/librender.a ../../damageext/.libs/libdamageext.a ../../present/.libs/libpresent.a ../../miext/sync/.libs/libsync.a ../../miext/damage/.libs/libdamage.a ../../miext/shadow/.libs/libshadow.a ../../Xi/.libs/libXi.a ../../xkb/.libs/libxkb.a ../../xkb/.libs/libxkbstubs.a ../../composite/.libs/libcomposite.a ../../dix/.libs/libmain.a ../../dix/.libs/libdix.a ../../mi/.libs/libmi.a ../../os/.libs/libos.a -ldl ./.libs/libvnccommon.a /root/workstation/tigervnc/build//common/network/.libs/libnetwork.a /root/workstation/tigervnc/build//common/rfb/.libs/librfb.a -L/usr/lib64 /root/workstation/tigervnc/build//common/rdr/.libs/librdr.a /root/workstation/tigervnc/build/common/network/.libs/libnetwork.a -ljpeg -lavcodec -lavutil -lswscale -lpam -lhogweed -lgmp /root/workstation/tigervnc/build//common/os/.libs/libos.a /root/workstation/tigervnc/build/common/rdr/.libs/librdr.a -lz /root/workstation/tigervnc/build/common/os/.libs/libos.a /root/workstation/tigervnc/build/common/rfb/.libs/librfb.a -lgnutls -lnettle -lpthread /root/workstation/tigervnc/build//unix/common/.libs/libunixcommon.a -lpixman-1 -lXfont2 -lXau -lGL -lm -pthread

if no slash at the end, I get output as below:

libtool: link: g++ -g -O2 -o Xvnc Xvnc-xvnc.o Xvnc-stubs.o Xvnc-miinitext.o Xvnc-buildtime.o -Wl,--export-dynamic ../../fb/.libs/libfb.a ../../xfixes/.libs/libxfixes.a ../../Xext/.libs/libXext.a ../../dbe/.libs/libdbe.a ../../record/.libs/librecord.a ../../glx/.libs/libglx.a ../../glx/.libs/libglxvnd.a ../../randr/.libs/librandr.a ../../render/.libs/librender.a ../../damageext/.libs/libdamageext.a ../../present/.libs/libpresent.a ../../miext/sync/.libs/libsync.a ../../miext/damage/.libs/libdamage.a ../../miext/shadow/.libs/libshadow.a ../../Xi/.libs/libXi.a ../../xkb/.libs/libxkb.a ../../xkb/.libs/libxkbstubs.a ../../composite/.libs/libcomposite.a ../../dix/.libs/libmain.a ../../dix/.libs/libdix.a ../../mi/.libs/libmi.a ../../os/.libs/libos.a -ldl ./.libs/libvnccommon.a -L/usr/lib64 /root/workstation/tigervnc/build/common/network/.libs/libnetwork.a -ljpeg -lavcodec -lavutil -lswscale -lpam -lhogweed -lgmp /root/workstation/tigervnc/build/common/rdr/.libs/librdr.a -lz /root/workstation/tigervnc/build/common/os/.libs/libos.a /root/workstation/tigervnc/build/common/rfb/.libs/librfb.a -lgnutls -lnettle -lpthread /root/workstation/tigervnc/build/unix/common/.libs/libunixcommon.a -lpixman-1 -lXfont2 -lXau -lGL -lm -pthread

From chatgpt:

Cyclic Dependencies: If you have cyclic dependencies (e.g., libA.a depends on libB.a, and libB.a also depends on libA.a), you may need to link them both in the same command. In this case, specify them multiple times:

@CendioOssman
Copy link
Member

It seems libtool doesn't support cyclic dependencies. It happens to work with that extra slash, simply because we trick libtool in to thinking they are different libraries and hence get added twice to the link line.

Trying to reconstruct the loop using just libtool fails early because libtool fails to generate the .la files, as it cannot find the other .la files in the loop. Further cementing the idea that this is not a case, libtool cares about.

We could consider adding more workarounds, but loops are extremely fragile. It is unknown how many times the loop needs to be specified to resolve all dependencies. It could easily break, even for CMake, if things get jumbled in the wrong way.

I see a couple of proper fixes:

  • Have everything in a single library. Not desirable as it makes our source tree messier.
  • Try to get --whole-archive in there so that order doesn't matter. Needs a redesign of some libraries as we rely on client object files not getting included in the servers, or they'd present client only settings.
  • Reorganise the libraries, so there are no loops.

I think the last one is the only really robust method. Some variation on the first might be possible as an interim step to get the Xvnc builds more stable.

@CendioOssman
Copy link
Member

I tried adding an intermediate library that bundles all the common libraries in to a single library, before linking that to Xvnc. It partly worked, but libtool isn't reliably propagating external dependencies to that new library. It seems to skip everything that is given with a file path.

@CendioOssman
Copy link
Member

I've added a62b575 as a band-aid to keep things going for now. But we should look at a new structure to avoid the issue more robustly.

@CendioOssman
Copy link
Member

This should hopefully be resolved now, via #1868.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants