Bug #43715 Link errors when trying to link mysql_embedded.exe

Submitted: 17 Mar 2009 22:08 Modified: 13 Apr 2009 19:10
Reporter: Vladislav Vaintroub Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1, 6.0 OS:Windows
Assigned to: Vladislav Vaintroub CPU Architecture:Any

[17 Mar 2009 22:08] Vladislav Vaintroub
Description:
I'm using "NMake Makefiles" CMake generator , CMake 2.6.2 and build WITH_EMBEDDED_SERVER.

mysql_client_test_embedded & Co tools that need to link link to libmysqld do not link and I get bunch of errors a la
mysql_client_test.obj : error LNK2019: unresolved external symbol mysql_list_fie
lds referenced in function test_list_fields
mysql_client_test.obj : error LNK2019: unresolved external symbol mysql_real_que
...

How to repeat:
Build mysql-5.1 with 

cd repo-root
cscript win\configure.js WITH_EMBEDDED_SERVER
win\build-nmake.bat
nmake

Suggested fix:
There are errors within libmysqld\examples\CMakeLists.txt

Instead of 
ADD_DEPENDENCY(mysql_embedded libmysqld) there should be 
TARGET_LINK_LIBRARY(mysql_embedded libmysqld)
(we want to link executable with this library)

There is also an error in libmysqld\CMakeLists.txt 
ADD_LIBRARY(libmysqld MODULE cmake_dummy.c libmysqld.def)

It should be SHARED instead of MODULE, MODULE in CMake-speak means the library will be used in dlopen-like functions only, so it is impossible to have it in TARGET_LINK_LIBRARY

Not sure why this error popped up only with nmake generator, it seems to be worked in other generators "by accident".
[17 Mar 2009 22:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/69502

2841 Vladislav Vaintroub	2009-03-17
      Bug #43715 Link errors when trying to link mysql_embedded.exe
      
      The reason for the error is incorrectly specified link dependencies
      for mysql_embedded, mysqltest_embedded and mysql_client_test_embedded
      in CMakeLists.txt (ADD_DEPENDENCIES should be TARGET_LINK_LIBRARIES)
     @ libmysqld/CMakeLists.txt
        changed library type for libmysqld to SHARED instead of
        MODULE. MODULE in CMake notation is a shared library that 
        is used only in dlopen/dlsym/LoadLibrary scenarios.
        Hence it was impossible to use TARGET_LINK_LIBRARIES with
        a MODULE.
     @ libmysqld/examples/CMakeLists.txt
        Use TARGET_LINK_LIBRARIES (instead of previously incorrectly 
        used ADD_DEPENDENCIES) to specify link dependency from libmysqld
[27 Mar 2009 14:58] Bugs System
Pushed into 5.1.34 (revid:joro@sun.com-20090327143448-wuuuycetc562ty6o) (version source revid:leonard@mysql.com-20090316090622-sr8lylqvsl1jrcnv) (merge vers: 5.1.34) (pib:6)
[27 Mar 2009 23:04] Paul DuBois
Noted in 5.1.34 changelog.

On Windows, incorrectly specified link dependencies in CMakeLists.txt
resulted in link errors for mysql_embedded, mysqltest_embedded, and
mysql_client_test_embedded. 

Setting report to NDI pending push into 6.0.x
[13 Apr 2009 9:22] Bugs System
Pushed into 6.0.11-alpha (revid:alik@sun.com-20090413084402-snnrocwzktcl88ny) (version source revid:joro@sun.com-20090318165614-d6pbac7x3waux3lj) (merge vers: 6.0.11-alpha) (pib:6)
[13 Apr 2009 19:10] Paul DuBois
Noted in 6.0.11 changelog.
[9 May 2009 16:47] Bugs System
Pushed into 5.1.34-ndb-6.2.18 (revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (version source revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (merge vers: 5.1.34-ndb-6.2.18) (pib:6)
[9 May 2009 17:43] Bugs System
Pushed into 5.1.34-ndb-6.3.25 (revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (version source revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (merge vers: 5.1.34-ndb-6.3.25) (pib:6)
[9 May 2009 18:41] Bugs System
Pushed into 5.1.34-ndb-7.0.6 (revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (version source revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (merge vers: 5.1.34-ndb-7.0.6) (pib:6)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.060 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.