axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
868 stars 195 forks source link

Building on Windows 11 #1695

Closed urcereal closed 7 months ago

urcereal commented 7 months ago

Cloned the repo (default branch: dev), ran pwsh .\setup.ps1, restarted terminal, then axmol build -p win32 which fails with (which is unzip I think):

 Creating library E:/tutorials/AxmolEngine/axmol/build_x64/tests/HelloCpp/Release/HelloCpp.lib and object E:/tutorials/AxmolEngine/axmol/build_x64/tests/HelloCpp/Release/HelloCpp.exp

axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol imp_unzOpen2_64 referenced in function "public: static class ax::ZipFile * cdecl ax::ZipFile::createFromFile(class std::basic_string_view<char,struct std::char_traits >,class std::basic_string_view<char,struct std::char_traits >)" (?createFromFile@ZipFile@ax@@SAPEAV12@V?$basic_string_view@DU?$char_traits@D@std@@@std@@0@Z) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol imp_unzClose referenced in function "public: virtual __cdecl ax::ZipFile::~ZipFile(void)" (??1ZipFile@ax@@UEAA@XZ) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol imp_unzOpenCurrentFile referenced in function "public: bool cdecl ax::ZipFile::getFileData(class std::basic_string_view<char,struct std::char_traits >,class ax::ResizableBuffer *)" (?getFileData@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@PEAVResizableBuffer@2@@Z) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol imp_unzReadCurrentFile referenced in function "public: bool cdecl ax::ZipFile::getFileData(class std::basic_string_view<char,struct std::char_traits >,class ax::ResizableBuffer *)" (?getFileData@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@PEAVResizableBuffer@2@@Z) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol imp_unzGetCurrentFileInfo referenced in function "private: int cdecl ax::ZipFile::getCurrentFileInfo(class std::basic_string<char,struct std::char_traits,class std::allocator > ,struct unz_file_info_s )" (?getCurrentFileInfo@ZipFile@ax@@AEAAHPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAUunz_file_info_s@@@Z) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzCloseCurrentFile referenced in function "public: bool cdecl ax::ZipFile::getFileData(class std::basic_string_view<char,struct std::char_traits >,class ax::ResizableBuffer )" (?getFileData@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@PEAVResizableBuffer@2@@Z) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol imp_unzGoToFirstFile referenced in function "public: class std::basic_string<char,struct std::char_traits,class std::allocator > __cdecl ax::ZipFile::getFirstFilename(void)" (?getFirstFilename@ZipFile@ax@@QEAA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol imp_unzGoToFirstFile2 referenced in function "public: bool cdecl ax::ZipFile::setFilter(class std::basic_string_view<char,struct std::char_traits >)" (?setFilter@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@@Z) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol imp_unzGoToNextFile referenced in function "public: class std::basic_string<char,struct std::char_traits,class std::allocator > cdecl ax::ZipFile::getNextFilename(void)" (?getNextFilename@ZipFile@ax@@QEAA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzGoToNextFile2 referenced in function "public: bool cdecl ax::ZipFile::setFilter(class std::basic_string_view<char,struct std::char_traits >)" (?setFilter@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@@Z) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol imp_unzGetFilePos referenced in function "public: bool cdecl ax::ZipFile::setFilter(class std::basic_string_view<char,struct std::char_traits >)" (?setFilter@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@@Z) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol imp_unzGoToFilePos referenced in function "public: bool cdecl ax::ZipFile::getFileData(class std::basic_string_view<char,struct std::char_traits >,class ax::ResizableBuffer )" (?getFileData@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@PEAVResizableBuffer@2@@Z) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzSeek64 referenced in function "public: int __cdecl ax::ZipFile::vread(struct ax::ZipEntryInfo ,void ,unsigned int)" (?vread@ZipFile@ax@@QEAAHPEAUZipEntryInfo@2@PEAXI@Z) [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] E:\tutorials\AxmolEngine\axmol\build_x64\bin\HelloCpp\Release\HelloCpp.exe : fatal error LNK1120: 13 unresolved externals [E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp\HelloCpp.vcxproj] 1kiss: Build done

If I use dumpbin on unzip.lib I get:

08A 00000000 SECT28 notype () External | unzSeek 08B 00000000 SECT29 notype () External | unzSeek64 08C 00000000 SECT7 notype () External | unzEndOfFile 08D 00000000 SECT25 notype () Static | unzReadUInt16

and in axmol.lib: E:\tutorials\AxmolEngine\axmol\build_x64\lib\Release>dumpbin /SYMBOLS axmol.lib | findstr "unzSeek64" 1AD 00000000 UNDEF notype External | __imp_unzSeek64

Is this a config issue I've got? Sorry, don't do a lot of windows builds.

rh101 commented 7 months ago

Can you please note down step-by-step what you typed into the terminal? From what you posted above, the paths are strange. Also, please surround the logs or code sections in your post with the 3 backtick characters at the start and end, so it's formatted correctly to be read in your post. For example, it should look something like this after it's done:

08A 00000000 SECT28 notype () External | unzSeek
08B 00000000 SECT29 notype () External | unzSeek64
08C 00000000 SECT7 notype () External | unzEndOfFile
08D 00000000 SECT25 notype () Static | unzReadUInt16

From my understanding, you have the engine code in E:\tutorials\AxmolEngine\axmol. Is that correct? If it is correct, then I don't understand why you have E:\tutorials\AxmolEngine\axmol\build_x64 and also E:\tutorials\AxmolEngine\axmol\build_x64\tests\HelloCpp. You didn't note any commands relating to creating the build folder in the root of axmol folder, or even the command to create the HelloCpp project (which is in a strange location too).

If you want others to reproduce the issue, then you can't leave out any information.

These are the steps you should have taken:

1 - Download an Axmol release or clone the repo\ 2 - Navigate to the axmol folder in Powershell, and run ./setup.ps1 3 - If your aim is to create a new project, then do so in a folder outside of the axmol folder. Do not place them in axmol/tests folder, for your sake. For example, create new projects in E:\tutorials\AxmolEngine\projects\.

As an example, you run these commands:

cd E:\tutorials\AxmolEngine\axmol (press ENTER)
./setup.ps1 (press ENTER)
(restart terminal)
cd E:\tutorials\AxmolEngine\projects (press ENTER)
axmol new -p org.someid.test -d . -l cpp HelloCpp (press ENTER)
cd E:\tutorials\AxmolEngine\projects\HelloCpp (press ENTER)
axmol build -p win32 (if you want to create the VS solution and build it in the console) or 
axmol build -p win32 -c (if you want to create the VS solution without building it in the console)
urcereal commented 7 months ago

Hi rh101,

Initially I followed the install instructions in the DevSetup.md. In the section 'How to quick build the engine for host targets' it states 'Go to axmol root directory and run build.ps1 without any parameters. It will build HelloCpp by default.' which is how the build_x64 gets created under axmol. Just did the same on macOS and it creates a build_arm64 under axmol and builds HelloCpp under that directory.

On Windows deleted the axmol directory and deleted the environment variables created by setup.ps1. Did the following:



E:\>cd tutorials\AxmolEngine

E:\tutorials\AxmolEngine>git clone --recursive https://github.com/axmolengine/axmol.git
Cloning into 'axmol'...
remote: Enumerating objects: 59191, done.
remote: Counting objects: 100% (2500/2500), done.
remote: Compressing objects: 100% (1250/1250), done.
remote: Total 59191 (delta 1471), reused 2098 (delta 1176), pack-reused 56691
Receiving objects: 100% (59191/59191), 86.14 MiB | 3.94 MiB/s, done.
Resolving deltas:   0% (0/43691)
Resolving deltas: 100% (43691/43691), done.

E:\tutorials\AxmolEngine>cd axmol

E:\tutorials\AxmolEngine\axmol>pwsh ./setup.ps1
axmol: Great, the system installed powershell execution policy is 'Bypass'
1kiss: PowerShell 7.2.18 on Microsoft Windows 10.0.22621.0
1kiss: proj_dir=E:\tutorials\AxmolEngine\axmol, external_prefix=E:\tutorials\AxmolEngine\axmol\tools\external
1kiss: Downloading https://github.com/simdsoft/1kiss/releases/download/devtools/glslcc-1.9.4-win64.zip to E:\tutorials\AxmolEngine\axmol\tools\external\glslcc-win64.zip ...
1kiss: Using glslcc: E:\tutorials\AxmolEngine\axmol\tools\external\glslcc\glslcc.exe, version: 1.9.4
1kiss: Downloading https://github.com/Kitware/CMake/releases/download/v3.28.1/cmake-3.28.1-windows-x86_64.zip to E:\tutorials\AxmolEngine\axmol\tools\external\cmake-3.28.1-windows-x86_64.zip ...
1kiss: Using cmake: E:\tutorials\AxmolEngine\axmol\tools\external\cmake\bin\cmake.exe, version: 3.28.1
1kiss: Downloading https://dist.nuget.org/win-x86-commandline/v5.5.1/nuget.exe to E:\tutorials\AxmolEngine\axmol\tools\external\nuget\nuget.exe ...
1kiss: Using nuget: E:\tutorials\AxmolEngine\axmol\tools\external\nuget\nuget.exe, version: 5.5.1
1kiss: setup successfully, please restart the terminal to make added system variables take effect

E:\tutorials\AxmolEngine\axmol>```

After restarting the terminal did:

```cd E:\tutorials\AxmolEngine\projects
axmol new -p org.someid.test -d . -l cpp HelloCpp
cd E:\tutorials\AxmolEngine\projects\HelloCpp
axmol build -p win32```

Result is:

```     Creating library E:/tutorials/AxmolEngine/projects/HelloCpp/build_x64/Release/HelloCpp.lib and object E:/tutorials/AxmolEngine/projects/HelloCpp/build_x64/Release/HelloCpp.exp
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzOpen2_64 referenced in function "public: static class ax::ZipFile * __cdecl ax::ZipFile::createFromFile(class std::basic_string_view<char,struct std::char_traits<char> >,class std::basic_string_view<char,struct std::char_traits<char> >)" (?createFromFile@ZipFile@ax@@SAPEAV12@V?$basic_string_view@DU?$char_traits@D@std@@@std@@0@Z) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzClose referenced in function "public: virtual __cdecl ax::ZipFile::~ZipFile(void)" (??1ZipFile@ax@@UEAA@XZ) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzOpenCurrentFile referenced in function "public: bool __cdecl ax::ZipFile::getFileData(class std::basic_string_view<char,struct std::char_traits<char> >,class ax::ResizableBuffer *)" (?getFileData@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@PEAVResizableBuffer@2@@Z) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzReadCurrentFile referenced in function "public: bool __cdecl ax::ZipFile::getFileData(class std::basic_string_view<char,struct std::char_traits<char> >,class ax::ResizableBuffer *)" (?getFileData@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@PEAVResizableBuffer@2@@Z) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzGetCurrentFileInfo referenced in function "private: int __cdecl ax::ZipFile::getCurrentFileInfo(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,struct unz_file_info_s *)" (?getCurrentFileInfo@ZipFile@ax@@AEAAHPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAUunz_file_info_s@@@Z) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzCloseCurrentFile referenced in function "public: bool __cdecl ax::ZipFile::getFileData(class std::basic_string_view<char,struct std::char_traits<char> >,class ax::ResizableBuffer *)" (?getFileData@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@PEAVResizableBuffer@2@@Z) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzGoToFirstFile referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl ax::ZipFile::getFirstFilename(void)" (?getFirstFilename@ZipFile@ax@@QEAA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzGoToFirstFile2 referenced in function "public: bool __cdecl ax::ZipFile::setFilter(class std::basic_string_view<char,struct std::char_traits<char> >)" (?setFilter@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@@Z) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzGoToNextFile referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl ax::ZipFile::getNextFilename(void)" (?getNextFilename@ZipFile@ax@@QEAA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzGoToNextFile2 referenced in function "public: bool __cdecl ax::ZipFile::setFilter(class std::basic_string_view<char,struct std::char_traits<char> >)" (?setFilter@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@@Z) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzGetFilePos referenced in function "public: bool __cdecl ax::ZipFile::setFilter(class std::basic_string_view<char,struct std::char_traits<char> >)" (?setFilter@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@@Z) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzGoToFilePos referenced in function "public: bool __cdecl ax::ZipFile::getFileData(class std::basic_string_view<char,struct std::char_traits<char> >,class ax::ResizableBuffer *)" (?getFileData@ZipFile@ax@@QEAA_NV?$basic_string_view@DU?$char_traits@D@std@@@std@@PEAVResizableBuffer@2@@Z) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
axmol.lib(ZipUtils.obj) : error LNK2019: unresolved external symbol __imp_unzSeek64 referenced in function "public: int __cdecl ax::ZipFile::vread(struct ax::ZipEntryInfo *,void *,unsigned int)" (?vread@ZipFile@ax@@QEAAHPEAUZipEntryInfo@2@PEAXI@Z) [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\bin\HelloCpp\Release\HelloCpp.exe : fatal error LNK1120: 13 unresolved externals [E:\tutorials\AxmolEngine\projects\HelloCpp\build_x64\HelloCpp.vcxproj]
1kiss: Build done```

So the real problem is that I had vcpkg integrated with Visual Studio . . . once I removed that the DevSetup.md steps worked. Tried it on a machine that never had vcpkg integrated and it worked first time.

Thanks for your help.
rh101 commented 7 months ago

Initially I followed the install instructions in the DevSetup.md. In the section 'How to quick build the engine for host targets' it states 'Go to axmol root directory and run build.ps1 without any parameters. It will build HelloCpp by default.' which is how the build_x64 gets created under axmol. Just did the same on macOS and it creates a build_arm64 under axmol and builds HelloCpp under that directory.

I understand now, and perhaps that info should be removed, since it does not seem to be of any benefit to a developer wanting to create a new project. It's trivial to get started with Axmol by just setting it up using ./setup.ps1, create a new project with axmol new, and then create the build files with axmol build, so having that quick build info may just add confusion to the process.

@halx99 Can we remove the quick build section the DevSetup, or do you feel it helps in some way to keep it? If you prefer to keep it, then perhaps add some more info to it in order to clarify its purpose.

rh101 commented 7 months ago

@urcereal Please close this issue if it is resolved for you.

halx99 commented 7 months ago

Initially I followed the install instructions in the DevSetup.md. In the section 'How to quick build the engine for host targets' it states 'Go to axmol root directory and run build.ps1 without any parameters. It will build HelloCpp by default.' which is how the build_x64 gets created under axmol. Just did the same on macOS and it creates a build_arm64 under axmol and builds HelloCpp under that directory.

I understand now, and perhaps that info should be removed, since it does not seem to be of any benefit to a developer wanting to create a new project. It's trivial to get started with Axmol by just setting it up using ./setup.ps1, create a new project with axmol new, and then create the build files with axmol build, so having that quick build info may just add confusion to the process.

@halx99 Can we remove the quick build section the DevSetup, or do you feel it helps in some way to keep it? If you prefer to keep it, then perhaps add some more info to it in order to clarify its purpose.

maybe build cpp-tests by default is better

rh101 commented 7 months ago

maybe build cpp-tests by default is better

That is a good idea, if the point of it is to just test that the build is working on their system.