SanderMertens / bake

Bake, A build system for building, testing and running C & C++ projects
GNU General Public License v3.0
684 stars 53 forks source link

Bake doesn't install 'flecs' template by default? #57

Closed craigb closed 5 years ago

craigb commented 5 years ago

I used the Getting Started for the bake project to install the tool for windows. (I used an admin prompt, but apparently it still didn't think it had permissions to install the tool globally -- could be related?)

image

Then, following the Getting Started for the flecs project, I'm trying to bake new my_app -t flecs. But the flecs template isn't installed.

C:\src\personal\flecs-playground> bake new test_app -t flecs                                                            INFO: Could not find files for the given pattern(s).                                                                    **********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.4
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
error template 'flecs' not found
C:\src\personal\flecs-playground>
SanderMertens commented 5 years ago

Hi @craigb, did you try to clone flecs with this command?

bake clone SanderMertens/flecs

If you think it should be installed, try the bake list command. It should look something like this after a clean bake install & flecs clone:

Listing projects for platform:
 * x64-Darwin

Packages & Applications:
C  bake.lang.c => all
C  bake.lang.cpp => all
C  bake.sdl2 => all
C  bake.sfml2 => all
P  bake.test => all
P  bake.util => all
P  flecs => [debug]

Templates:
T  flecs.graphics => [c]
T  flecs => [c]
T  flecs.module => [c]

Summary:
applications: 0, packages: 8, templates: 3

Under "templates" you should see the three flecs templates.

craigb commented 5 years ago

Hi @SanderMertens, I hadn't done that -- I guess I magically expected the template to be installed :-P Thanks for pointing out my mistake! It failed to build, but let me mess around with it some more before I come crying for help.

craigb commented 5 years ago

So the symptom I was seeing was that running bake clone SanderMertens/flecs failed with 21 unresolved externals and a warning about conflicting library machine type and target machine type.

> bake clone SanderMertens/flecs                                                        INFO: Could not find files for the given pattern(s).                                                                    **********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.3.1
** Copyright (c) 2019 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
[  clone] 'https://github.com/SanderMertens/flecs' into '.\flecs'
[  build] package flecs => 'flecs'
[     6%] chunked.c
chunked.c
[    12%] column_system.c
column_system.c
[    18%] entity.c
entity.c
flecs\src\entity.c(303): warning C4090: 'function': different 'const' qualifiers
flecs\src\entity.c(834): warning C4090: 'function': different 'const' qualifiers
flecs\src\entity.c(912): warning C4090: 'function': different 'const' qualifiers
flecs\src\entity.c(2231): warning C4090: 'function': different 'const' qualifiers
flecs\src\entity.c(2277): warning C4090: 'function': different 'const' qualifiers
[    25%] err.c
err.c
[    31%] map.c
map.c
[    37%] misc.c
misc.c
[    43%] os_api.c
os_api.c
[    50%] parser.c
parser.c
[    56%] stage.c
stage.c
[    62%] stats.c
stats.c
[    68%] system.c
system.c
[    75%] table.c
table.c
[    81%] type.c
type.c
flecs\src\type.c(892): warning C4090: 'function': different 'const' qualifiers
flecs\src\type.c(923): warning C4090: 'function': different 'const' qualifiers
flecs\src\type.c(945): warning C4090: 'function': different 'const' qualifiers
[    87%] vector.c
vector.c
[    93%] worker.c
worker.c
[   100%] world.c
world.c
   Creating library flecs\bin\x86-Windows-debug\flecs.lib and object flecs\bin\x86-Windows-debug\flecs.exp
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_strdup referenced in function bake_module_to_dl
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_dl_open referenced in function bake_dlopen
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_dl_close referenced in function bake_dlclose
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_dl_proc referenced in function bake_dlproc
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_thread_new referenced in function bake_thread_new
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_thread_join referenced in function bake_thread_join
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_mutex_new referenced in function bake_mutex_new
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_mutex_lock referenced in function bake_mutex_lock
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_mutex_unlock referenced in function bake_mutex_unlock   os_api.obj : error LNK2019: unresolved external symbol __imp_ut_mutex_free referenced in function bake_mutex_free       os_api.obj : error LNK2019: unresolved external symbol __imp_ut_cond_new referenced in function bake_cond_new
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_cond_signal referenced in function bake_cond_signal     os_api.obj : error LNK2019: unresolved external symbol __imp_ut_cond_broadcast referenced in function bake_cond_broadcast
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_cond_wait referenced in function bake_cond_wait
os_api.obj : error LNK2019: unresolved external symbol __imp_ut_log_handlerRegister referenced in function ecs_os_set_api_defaults                                                                                                              os_api.obj : error LNK2019: unresolved external symbol __imp_ut_raise referenced in function bake_dlproc                world.obj : error LNK2019: unresolved external symbol __imp_ut_init referenced in function ecs_init                     world.obj : error LNK2019: unresolved external symbol __imp_ut_deinit referenced in function ecs_fini                   world.obj : error LNK2019: unresolved external symbol __imp_ut_load_init referenced in function ecs_init                C:\Users\craig\bake\lib\bake_util.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'                                                                                                                    flecs\bin\x86-Windows-debug\flecs.dll : fatal error LNK1120: 21 unresolved externals                                    error command returned 96                                                                                                  link /NOLOGO /DYNAMICBASE:NO /NXCOMPAT:NO /DLL /PDB:"flecs\bin\x86-Windows-debug\flecs.pdb" flecs\.bake_cache\x86-Windows-debug\obj\chunked.obj flecs\.bake_cache\x86-Windows-debug\obj\column_system.obj flecs\.bake_cache\x86-Windows-debug\obj\entity.obj flecs\.bake_cache\x86-Windows-debug\obj\err.obj flecs\.bake_cache\x86-Windows-debug\obj\map.obj flecs\.bake_cache\x86-Windows-debug\obj\misc.obj flecs\.bake_cache\x86-Windows-debug\obj\os_api.obj flecs\.bake_cache\x86-Windows-debug\obj\parser.obj flecs\.bake_cache\x86-Windows-debug\obj\stage.obj flecs\.bake_cache\x86-Windows-debug\obj\stats.obj flecs\.bake_cache\x86-Windows-debug\obj\system.obj flecs\.bake_cache\x86-Windows-debug\obj\table.obj flecs\.bake_cache\x86-Windows-debug\obj\type.obj flecs\.bake_cache\x86-Windows-debug\obj\vector.obj flecs\.bake_cache\x86-Windows-debug\obj\worker.obj flecs\.bake_cache\x86-Windows-debug\obj\world.obj /LIBPATH:C:\Users\craig\bake\lib bake_util.lib /OUT:flecs\bin\x86-Windows-debug\flecs.dll                                                                                       from command for task 'flecs\bin\x86-Windows-debug\flecs.dll' failed                                                    from failed to build rule 'ARTEFACT'                                                                                   [  error] build interrupted for flecs in flecs                                                                          error project 'flecs' built with errors, skipping                                                                       error project dependency graph contains cycles (1 built vs 4 total)

So for some reason (I would expect an x64 dev console if it's not specified) before building bake, I need to run vcvars64 in the developer console:

**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.3.1
** Copyright (c) 2019 Microsoft Corporation
**********************************************************************

C:\Windows\System32>"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"

then everything looks like it's smooth sailing :)

SanderMertens commented 5 years ago

Hi @craigb, when bake is installed, it creates a bake.bat script in your user home directory which attempts to run the script that sets the visual studio environment. I'm guessing that for some reason when you call bake it hits the bake executable directly and not the bake script. I should check if I can reproduce.