moja-global / FLINT.Example

A FLINT template to help start building a project based on the FLINT framework
Mozilla Public License 2.0
2 stars 29 forks source link

Failure with environment variable in config file #17

Closed floybix closed 4 years ago

floybix commented 4 years ago

I have been trying to run the basic example according to README.md. The run failed. I was only able to get it to run by replacing the environment variable syntax "%LOCAL_LIBS%" with a literal value.

To Reproduce Steps to reproduce the behavior: Follow the instructions in README.md in section Environment: Visual Studio 16 2019 Win64.

Expected behavior Command line outline like Started ... onOutputStep ... Finished

Observed behavior This example shows a command-line run, but the same happens from inside Visual Studio.

C:\Users\Felix\Dev\FLINT.example\Run_Env>set LOCAL_LIBS=C:\Users\Felix\Dev\FLINT.example\Source\build\bin\Debug

C:\Users\Felix\Dev\FLINT.example\Run_Env>echo %LOCAL_LIBS%
C:\Users\Felix\Dev\FLINT.example\Source\build\bin\Debug

C:\Users\Felix\Dev\FLINT.example\Run_Env>C:\Users\Felix\Dev\FLINT\Source\build\bin\Debug\moja.cli.exe --config config/point_example.json --config config/libs.base.win.json  --logging_config logging.debug_on.conf
<2020-07-11 16:43:39.965925> (info) - Config has files: 2
<2020-07-11 16:43:39.968917> (info) - Using Logging Configuration: logging.debug_on.conf
<2020-07-11 16:43:39.969883> (info) - Using configurations:
<2020-07-11 16:43:39.970877> (info) - config/point_example.json
<2020-07-11 16:43:39.971875> (info) - config/libs.base.win.json
<2020-07-11 16:43:39.984880> (debug) - moja::flint::configuration::JSON2ConfigurationProvider::createLibraries(434) - details (moja.flint.example.base): path - %LOCAL_LIBS%, filename -moja.flint.example.based.dll
<2020-07-11 16:43:39.985836> (debug) - moja::flint::configuration::Configuration::addLibrary(105) - details (moja.flint.example.base): path - %LOCAL_LIBS%, filename -moja.flint.example.based.dll
<2020-07-11 16:43:40.001842> (info) - Using operation manager: Simple
<2020-07-11 16:43:40.002830> (debug) - moja::flint::LibraryManager::LibraryManager(46) - LibraryManager: contructor no args
<2020-07-11 16:43:40.003788> (debug) - moja::flint::LibraryManager::LoadInternalLibrary(426) - LibraryMLoadInternalLibraryanager: entered
<2020-07-11 16:43:40.008920> (debug) - moja::flint::LibraryManager::LoadInternalLibrary(430) - LibraryMLoadInternalLibraryanager: calling AddLibrary : internal.flint
<2020-07-11 16:43:40.009808> (debug) - moja::flint::LibraryManager::AddLibrary(78) - AddLibrary: entered : internal.flint
<2020-07-11 16:43:40.011795> (debug) - moja::flint::LibraryManager::LoadInternalLibrary(440) - LibraryMLoadInternalLibraryanager: calling registrations
<2020-07-11 16:43:40.018748> (debug) - moja::flint::getFlintModuleRegistrations(109) - getFlintModuleRegistrations: entered
<2020-07-11 16:43:40.018748> (debug) - moja::flint::getFlintModuleRegistrations(168) - getFlintModuleRegistrations: exit - 20
<2020-07-11 16:43:40.019746> (debug) - moja::flint::getFlintTransformRegistrations(173) - getFlintTransformRegistrations: entered
<2020-07-11 16:43:40.023738> (debug) - moja::flint::getFlintTransformRegistrations(196) - getFlintTransformRegistrations: exit - 9
<2020-07-11 16:43:40.023738> (debug) - moja::flint::getFlintFlintDataRegistrations(201) - getFlintFlintDataRegistrations: entered
<2020-07-11 16:43:40.028725> (debug) - moja::flint::getFlintFlintDataRegistrations(221) - getFlintFlintDataRegistrations: exit - 8
<2020-07-11 16:43:40.028725> (debug) - moja::flint::getFlintFlintDataFactoryRegistrations(226) - getFlintFlintDataFactoryRegistrations: entered
<2020-07-11 16:43:40.029719> (debug) - moja::flint::getFlintFlintDataFactoryRegistrations(232) - getFlintFlintDataFactoryRegistrations: exit - 1
<2020-07-11 16:43:40.029719> (debug) - moja::flint::getProviderRegistrations(237) - getProviderRegistrations: entered
<2020-07-11 16:43:40.030717> (debug) - moja::flint::getProviderRegistrations(252) - getProviderRegistrations: exit - 2
<2020-07-11 16:43:40.030717> (debug) - moja::flint::LibraryManager::RegisterProviders(406) - RegisterProviders: entered : internal.flint : count 2
<2020-07-11 16:43:40.031714> (debug) - moja::flint::LibraryManager::RegisterProviders(410) - RegisterProviders: loop: 0
<2020-07-11 16:43:40.031714> (debug) - moja::flint::LibraryManager::RegisterProviders(415) - RegisterProviders: loop: internal.flint : RasterTiled
<2020-07-11 16:43:40.032711> (debug) - moja::flint::LibraryManager::RegisterProviders(410) - RegisterProviders: loop: 1
<2020-07-11 16:43:40.034706> (debug) - moja::flint::LibraryManager::RegisterProviders(415) - RegisterProviders: loop: internal.flint : SQLite
<2020-07-11 16:43:40.039693> (debug) - moja::flint::getProviderRegistrations(237) - getProviderRegistrations: entered
<2020-07-11 16:43:40.040690> (debug) - moja::flint::getProviderRegistrations(252) - getProviderRegistrations: exit - 2
<2020-07-11 16:43:40.040690> (debug) - moja::flint::LibraryManager::RegisterProviders(406) - RegisterProviders: entered : internal.flint : count 2
<2020-07-11 16:43:40.041687> (debug) - moja::flint::LibraryManager::RegisterProviders(410) - RegisterProviders: loop: 0
<2020-07-11 16:43:40.041687> (debug) - moja::flint::LibraryManager::RegisterProviders(415) - RegisterProviders: loop: internal.flint : RasterTiled
<2020-07-11 16:43:40.042684> (debug) - moja::flint::LibraryManager::RegisterProviders(410) - RegisterProviders: loop: 1
<2020-07-11 16:43:40.043708> (debug) - moja::flint::LibraryManager::RegisterProviders(415) - RegisterProviders: loop: internal.flint : SQLite
<2020-07-11 16:43:40.050668> (debug) - moja::flint::LocalDomainControllerBase::configure(71) - details (moja.flint.example.base): path - %LOCAL_LIBS%, filename -moja.flint.example.based.dll
<2020-07-11 16:43:40.051661> (debug) - moja::flint::LibraryManager::AddLibrary(78) - AddLibrary: entered : moja.flint.example.base
<2020-07-11 16:43:40.052682> (fatal) - main(299) - %LOCAL_LIBS%

When I change the file libs.base.win.json to set the PATH explicitly, it works.

Operating Environment:

Additional context

There was one other error I ran into along the way. The required cmake package fmt was not installed.

C:\Users\Felix\Dev\FLINT.example\Source\build>cmake -G "Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=C:\Users\Felix\moja -DVCPKG_TARGET_TRIPLET=x64-windows -DOPENSSL_ROOT_DIR=C:\Users\Felix\Dev\vcpkg\installed\x64-windows -DENABLE_TESTS=OFF -DCMAKE_TOOLCHAIN_FILE=C:\Users\Felix\Dev\vcpkg\scripts\buildsystems\vcpkg.cmake ..
-- Building dynamic libraries
-- Building without tests
-- The compiler in use is C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe.
-- The compiler flags in use is /DWIN32 /D_WINDOWS /W3 /GR /EHsc.
-- The compiler C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe has C++17 support.
-- Boost version: 107200
CMake Error at C:/Users/Felix/Dev/vcpkg/scripts/buildsystems/vcpkg.cmake:288 (_find_package):
  Could not find a package configuration file provided by "fmt" with any of
  the following names:

    fmtConfig.cmake
    fmt-config.cmake

  Add the installation prefix of "fmt" to CMAKE_PREFIX_PATH or set "fmt_DIR"
  to a directory containing one of the above files.  If "fmt" provides a
  separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
  moja.modules.chapman_richards/CMakeLists.txt:9 (find_package)

-- Configuring incomplete, errors occurred!

To fix it I did:

vcpkg.exe install fmt:x64-windows

and set cmake's fmt_DIR.

leitchy commented 4 years ago

Thanks Felix, I'm looking into the environment variable issue now. Regarding the vcpkg and fmt, the current FLINT develop branch has had that added to the README See README.md the vcpkg command is: vcpkg.exe install boost-test:x64-windows boost-program-options:x64-windows boost-log:x64-windows turtle:x64-windows zipper:x64-windows poco:x64-windows libpq:x64-windows gdal:x64-windows sqlite3:x64-windows boost-ublas:x64-windows fmt:x64-windows

leitchy commented 4 years ago

I'm just setting up in Windows to test the above issues now. I have checked that the required FLINT update is in the code base. This commit added the code to expand the environemnt variables in the lib paths Merge pull request #38 from moja-global/lib_path_improvement

leitchy commented 4 years ago

It appears you are running from a FLINT version that doen't have that enhancement moja-global/FLINT@c2cb1e3

The src file Source/moja.flint/src/librarymanager.cpp doesn't have the change.

floybix commented 4 years ago

OK, I wasn't aware of the develop branch.