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

Shared Library Build Broken on Windows #318

Closed
steji113 opened this issue Jan 19, 2018 · 1 comment · Fixed by #956
Closed

Shared Library Build Broken on Windows #318

steji113 opened this issue Jan 19, 2018 · 1 comment · Fixed by #956
Assignees
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@steji113
Copy link

System info

Operating System: Windows 10 x64 1709
Shaka Packager Version: 435d69c

Issue and steps to reproduce the problem

set GYP_DEFINES=target_arch=x64 libpackager_type=shared_library
gclient runhooks
cd src
ninja -C out/Debug_x64

What is the expected result?
libpackager should compile as a DLL successfully.

What happens instead?
Errors such as the following occur:

[1/47] CXX obj\status.status.obj
FAILED: obj/status.status.obj 
ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe" /nologo /showIncludes /FC @obj\status.status.obj.rsp /c ..\..\packager\status.cc /Foobj\status.status.obj /Fdobj\status.cc.pdb 
c:\users\stephen.daudell\documents\code\shaka_me\src\packager\status.h(110): error C2143: syntax error: missing ')' before '('
c:\users\stephen.daudell\documents\code\shaka_me\src\packager\status.h(110): error C2079: 'visibility' uses undefined class 'shaka::__attribute__'
c:\users\stephen.daudell\documents\code\shaka_me\src\packager\status.h(110): error C2059: syntax error: ')'
c:\users\stephen.daudell\documents\code\shaka_me\src\packager\status.h(110): error C2440: 'initializing': cannot convert from 'const char [8]' to 'int'
c:\users\stephen.daudell\documents\code\shaka_me\src\packager\status.h(110): note: There is no context in which this conversion is possible
c:\users\stephen.daudell\documents\code\shaka_me\src\packager\status.h(110): error C2146: syntax error: missing ';' before identifier 'Status'
c:\users\stephen.daudell\documents\code\shaka_me\src\packager\status.h(110): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\stephen.daudell\documents\code\shaka_me\src\packager\status.h(111): error C2059: syntax error: 'public'
c:\users\stephen.daudell\documents\code\shaka_me\src\packager\status.h(113): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\stephen.daudell\documents\code\shaka_me\src\packager\status.h(113): error C2365: 'shaka::Status': redefinition; previous definition was 'data variable'
...MORE ERRORS HERE
@kqyang kqyang added the type: bug Something isn't working correctly label Jan 19, 2018
@kqyang kqyang added this to the v2.2 milestone Apr 19, 2018
@kqyang kqyang modified the milestones: v2.2, v2.3 Apr 27, 2018
@hmchen-github
Copy link
Contributor

hmchen-github commented Aug 2, 2018

The build breaks. But I got a different error:

ninja: Entering directory `out/Debug_x64'
[264/661] CXX obj\status.status.obj
FAILED: obj/status.status.obj
ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe" /nologo /showIncludes /FC @obj\status.status.obj.rsp /c ....\packager\status.cc /Foobj\status.status.obj /Fdobj\status.cc.pdb
c:\users\hmchen\shaka_packager_github\src\packager\status.h(150): error C2220: warning treated as error - no 'object' file generated
c:\users\hmchen\shaka_packager_github\src\packager\status.h(150): warning C4251: 'shaka::Status::error_message_': class 'std::basic_string<char,std::char_traits,std::allocator>' needs to have dll-interface to be used by clients of class 'shaka::Status'
c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(2633): note: see declaration of 'std::basic_string<char,std::char_traits,std::allocator>'
[277/661] CXX obj\base\trace_event\base.trace_log.obj
ninja: build stopped: subcommand failed.

@kqyang kqyang modified the milestones: v2.3, v2.4 Nov 20, 2018
@kqyang kqyang modified the milestones: v2.4, v2.5 Feb 19, 2019
@kqyang kqyang modified the milestones: v2.5, v2.6 Aug 20, 2020
joeyparrish added a commit that referenced this issue Jun 14, 2021
At this point static_library builds are working in MSVS 2019. shared_library builds are still not working.

Closes #867 (MSVS 2019)
Issue #318 (progress toward shared_library support on Windows)
Issue #336 (progress toward replacing Travis & Appveyor with GitHub Actions, which uses MSVS 2019)
b/190743862 (internal; tracking replacement of Travis)
joeyparrish added a commit that referenced this issue Jun 15, 2021
To make shared_library builds work on Windows with MSVS 2019, this
commit:
 - Silences a useless warning about a private member in dll-exported
   Status class.
 - Exports the File class used by packager.exe
 - Removes the explicit File dependency in packager.exe in favor of
   libpackager, now that File is exported
 - Add missing defines in packager.exe and packager_test.exe that
   instruct the linker to import Status and File from the library

Closes #318 (shared_library builds on Windows)
Issue #336 (progress toward GitHub Actions workflow to replace Travis
  and Appveyor, where we need to build and test shared_library on all
  platforms)
b/190743862 (internal; tracking replacement of Travis)

Change-Id: I091f1655d88d36f353f7df497101eef17729eefe
joeyparrish added a commit that referenced this issue Jun 16, 2021
Shared library builds worked, but failed tests because they were made
with the wrong CRT linker settings.  Strings allocated within the
library could not be freed outside the library because the dynamic CRT
was not used.

This sets necessary gyp variables to link with a dynamic CRT on
Windows, thereby fixing tests running in shared library mode that
otherwise hung in a GitHub Actions environment.

Related to #318 (shared_library builds on Windows)

Issue #336 (progress toward GitHub Actions workflow to replace Travis
  and Appveyor, where we need to build and test shared_library on all
  platforms)

b/190743862 (internal; tracking replacement of Travis)

Change-Id: Iffefd27c2aa4ec479ce1d10b099483e417d2231f
joeyparrish added a commit that referenced this issue Jun 16, 2021
In e2efb5d, I fixed shared_library builds on Windows, but I
introduced another issue in which the libpackager_type variable was
not correctly defined by default.  This meant that the build only
worked with this variable explicitly-defined in GYP_DEFINES when
gclient sync was run.

This fixes the default definition so that libpackager_type does not
need to be defined explicity.

Related to #318 (shared_library builds on Windows)

Issue #336 (progress toward GitHub Actions workflow to replace Travis
  and Appveyor, where we need to build and test shared_library on all
  platforms)

b/190743862 (internal; tracking replacement of Travis)

Change-Id: If353e1d3c312ab0c568d4d4d2b789e922d7216e1
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Sep 3, 2021
@shaka-project shaka-project locked and limited conversation to collaborators Sep 3, 2021
sr1990 pushed a commit to sr1990/shaka-packager that referenced this issue Feb 18, 2023
To make shared_library builds work on Windows with MSVS 2019, this
commit:
 - Silences a useless warning about a private member in dll-exported
   Status class.
 - Exports the File class used by packager.exe
 - Removes the explicit File dependency in packager.exe in favor of
   libpackager, now that File is exported
 - Add missing defines in packager.exe and packager_test.exe that
   instruct the linker to import Status and File from the library

Closes shaka-project#318 (shared_library builds on Windows)
Issue shaka-project#336 (progress toward GitHub Actions workflow to replace Travis
  and Appveyor, where we need to build and test shared_library on all
  platforms)
b/190743862 (internal; tracking replacement of Travis)

Change-Id: I091f1655d88d36f353f7df497101eef17729eefe
sr1990 pushed a commit to sr1990/shaka-packager that referenced this issue Feb 18, 2023
To make shared_library builds work on Windows with MSVS 2019, this
commit:
 - Silences a useless warning about a private member in dll-exported
   Status class.
 - Exports the File class used by packager.exe
 - Removes the explicit File dependency in packager.exe in favor of
   libpackager, now that File is exported
 - Add missing defines in packager.exe and packager_test.exe that
   instruct the linker to import Status and File from the library

Closes shaka-project#318 (shared_library builds on Windows)
Issue shaka-project#336 (progress toward GitHub Actions workflow to replace Travis
  and Appveyor, where we need to build and test shared_library on all
  platforms)
b/190743862 (internal; tracking replacement of Travis)

Change-Id: I091f1655d88d36f353f7df497101eef17729eefe
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants