[SERVER-53054] The ninja builder fails to link on Windows with `LNK1561: entry point must be defined` Created: 24/Nov/20  Updated: 29/Oct/23  Resolved: 08/Jan/21

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 4.9.0, 4.4.7

Type: Task Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Daniel Moody
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.4
Sprint: Dev Platform 2020-12-14, Dev Platform 2020-12-28, Dev Platform 2021-01-11
Participants:

 Description   

As of a week or so (haven't found the exact offending commit), using ninja on Windows fails to link the executables with the following error:

E:\workspace\mongo>buildscripts\scons.py --jlink=4 --ssl --win-version-min=win10 --detect-odr-violations --install-mode=hygienic --dbg=on --opt=off CPPPATH="D:/workspace/libs/snmp/include D:/workspace/libs/sasl/include" LIBPATH="D:/workspace/libs/snmp/lib D:/workspace/libs/sasl/lib" MONGO_GIT_HASH="unknown" MONGO_VERSION="0.0.0" VARIANT_DIR=ninja --build-tools=next --ninja generate-ninja
...
E:\workspace\mongo>ninja install-mongo
...
[53/104] Linking build\ninja\mongo\shell\mongo.exe
FAILED: build/ninja/mongo/shell/mongo.exe
link @build\ninja\mongo\shell\mongo.exe.rsp
   Creating library build\ninja\mongo\shell\mongo.lib and object build\ninja\mongo\shell\mongo.exp
LINK : fatal error LNK1561: entry point must be defined
[84/104] Compiling build\ninja\mongo\db\index_builds_coordinator.obj
ninja: build stopped: subcommand failed.

The same problem doesn't exist when using scons directly:

E:\workspace\mongo>buildscripts\scons.py --jlink=4 --ssl --win-version-min=win10 --detect-odr-violations --install-mode=hygienic --dbg=on --opt=off CPPPATH="D:/workspace/libs/snmp/include D:/workspace/libs/sasl/include" LIBPATH="D:/workspace/libs/snmp/lib D:/workspace/libs/sasl/lib" MONGO_GIT_HASH="unknown" MONGO_VERSION="0.0.0" VARIANT_DIR=ninja --build-tools=next install-mongo



 Comments   
Comment by Githook User [ 28/Jun/21 ]

Author:

{'name': 'Daniel Moody', 'email': 'daniel.moody@mongodb.com', 'username': 'dmoody256'}

Message: SERVER-53054: fixed issue for WINLINK where inputs where not correctly given to ninja.

(cherry picked from commit 503c08c5cf2a68b56b46b2a5c52126fa65848c44)
Branch: v4.4
https://github.com/mongodb/mongo/commit/23311306d0af7e3de01ccd025ca608c3d53ec111

Comment by Kaloian Manassiev [ 12/Jan/21 ]

Apologies, I should have confirmed in time: Yes, with this change now the --build-tools=next option works for me on Windows, so feel free to resolve this ticket.

Comment by Daniel Moody [ 11/Jan/21 ]

kaloian.manassiev could you update if this fixed the issue you were seeing?

Comment by Githook User [ 08/Jan/21 ]

Author:

{'name': 'Daniel Moody', 'email': 'daniel.moody@mongodb.com', 'username': 'dmoody256'}

Message: SERVER-53054: fixed issue for WINLINK where inputs where not correctly given to ninja.
Branch: master
https://github.com/mongodb/mongo/commit/503c08c5cf2a68b56b46b2a5c52126fa65848c44

Comment by Daniel Moody [ 30/Dec/20 ]

kaloian.manassiev I was able to reproduce on my own machine, maybe you could take the patch from the code review and verify as well?

Comment by Daniel Moody [ 22/Dec/20 ]

kaloian.manassiev this doesn't reproduce on the builders in evergreen, could you give me some info about your system? Specifically the Visual Studio Version you're using?

 

EDIT: after this was resolved I have discovered that the evergreen builders for ninja have been failing the ninja build but passing the task. I am going to fix it in my current ticket SERVER-48203

Comment by Kaloian Manassiev [ 25/Nov/20 ]

Per suggestion from daniel.moody I tried removing --build-tools=next and the linking works. Suspected cause is SERVER-48691.

Generated at Thu Feb 08 05:29:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.