Vcpkg: [freeglut] x86-windows : cannot open file 'freeglutd.lib'

Created on 24 Sep 2019  路  7Comments  路  Source: microsoft/vcpkg

Describe the bug
When I use x86-windows freeglut and build as Release/Win32, I get a link error "cannot open file 'freeglutd.lib'".

Environment

  • OS: Win10 1903
  • Compiler: VS2019

To Reproduce
Steps to reproduce the behavior:

  1. Add new project in VS
  2. Write some code, and build as Release/Win32.

Expected behavior
When build as Release, compiler should search for freeglut.lib, not freeglutd.lib.

port-bug port-update

All 7 comments

BTW freeglut 3.2.0 is released, maybe it's time for an upgrade.

FYI - I have the same problem with x64-windows triplet. All release configurations built with freeglut with either system-wide or project only integration fail trying to link freeglutd.lib.

@LilyWangL @JackBoosY @theoractice
I think I found the issue, but how to fix, incorporate into a fix file I'm not sure. Researching it seem for MSVC the NDEBUG/DEBUG macros have to be defined before using them - the one that is, which is unique to MSVC (at least from my research on the internet ) is _DEBUG. So in the file include/GL/freeglut_std.h if I change lines 73 and 91 from:
#ifdef NDEBUG to:
#ifndef _DEBUG
then freeglut release links using the freeglut.lib and debug links using the freeglutd.lib as is expected.
Otherwise the ifdef NDEBUG is always false as its not defined in MSVC and both the release and debug versions link with the freeglutd.lib - thus anytime you use freeglut.dll in other projects the release links fail looking for freeglutd.lib.

Thank you and have a wonderful day.

So this is curious -- line 66 of freeglut_std.h:

/* Windows static library */
#   if 1 //ifdef FREEGLUT_STATIC

Reverting that hack gets freeglut:x64-windows building successfully on my system (previously was failing to link freeglutd.lib as described by OP). Still waiting to see whether my ultimate goal of qt5:x64-windows will finally succeed...

FWIW, the ifndef _DEBUG vs ifdef NDEBUG thing made no difference in my case.

@calonx If you built dynamic freeglut, it should not be changed.
This place is changed because ports that depend on it may not include this macro FREEGLUT_STATIC, resulting in link errors.

@JackBoosY cc: @isanych

@timautry Please feel free to open a PR to fix it.

Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PhilLab picture PhilLab  路  3Comments

F0I0l0I0P picture F0I0l0I0P  路  3Comments

grandprixgp picture grandprixgp  路  3Comments

jack17529 picture jack17529  路  3Comments

husseinalihazime picture husseinalihazime  路  3Comments