0

I need to create C++ app using thrift and build it using SCons. In order to do so I've downloaded and installed all of the needed libs (and ensured that all of them are for x64 Windows) - boost, openssl, libevent.

I've built boost with command:

b2 -j4 toolset=msvc-14.1 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=complete stage --stagedir=stage/x64

Next, I've built Thrift libs in VS2017 (x64/Release).

But, when I try to build project with SCons, I encounter erros. When I try with SConstruct file like this (run from Developer Command Prompt for VS2017):

import os
from os import path, listdir

gen_cpp = [path.join('gen-cpp', f) for f in listdir('gen-cpp') if 
f.endswith('.cpp')]
client_source = [path.join('logic', folder, f) for folder in ['', 'parser', 
'mars', 'view']
             for f in listdir(path.join('logic', folder)) if 
f.endswith('.cpp')]
server_source = [path.join('server', 'server.cpp')]
tests_source = [path.join('test_cases', f) for f in listdir('test_cases') if 
f.endswith('.cpp')]

cpppath = ['.','c:\\Users\\Antek\\libs\\thrift-0.10.0\\thrift-
0.10.0\\lib\\cpp\\src\\','c:\\Users\\Antek\\libs\\boost_1_64_0\\boost\\']

libpath = ['C:\\Users\\Antek\\libs\\thrift-0.10.0\\thrift-
0.10.0\\lib\\cpp\\x64\\Release\\', 
'c:\\Users\\Antek\\libs\\boost_1_64_0\\boost\\stage_x64\\lib\\',
         'C:\\OpenSSL-Win64\\lib']

libs = ['libthrift']

env = Environment(
               CPPPATH = cpppath,
               LIBS = libs,
               LIBPATH = libpath,
               CPPFLAGS='/EHsc',
              )


gen_cpp_o = env.Object(gen_cpp)
client_o = env.Object(client_source)
tests_o = env.Object(tests_source)
tests_files = gen_cpp_o + [f for f in client_o if str(f) != 
path.join('logic', 'main.obj')] + tests_o

env.Program('CoreWars', gen_cpp_o + client_o)
env.Program('Server', gen_cpp_o + server_source)
env.Program('tests', tests_files)

I get:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /Fogen-cpp\MARS.obj /c gen-cpp\MARS.cpp /TP /nologo /EHsc /I. 
/IC:\Users\Antek\libs\thrift-0.10.0\thrift-0.10.0\lib\cpp\src 
/IC:\Users\Antek\libs\boost_1_64_0\boost
'cl' is not recognized as an internal or external command,
operable program or batch file.
scons: *** [gen-cpp\MARS.obj] Error 1
scons: building terminated because of errors.

When I add the following line to my SConstruct: ENV = os.environ

I get an error :

Libthrift.lib (TOutput.obj): MSIL .netmodule module found or module compiled 
with / GL; Consolidation will start again with the / LTCG option; Add the / 
LTCG option to the consolidation command line to improve the performance of 
the consolidator
Fatal error C1905: Frontend and backend are not compatible (must refer to 
the same processor)
LINK: fatal error LNK1257: code generation failed
Scons: *** [CoreWars.exe] Error 1257
Scons: building terminated because of errors

I've spent too much time on this already, all ideas will be highly appreciated. Thank You.

3voC
  • 647
  • 7
  • 19
  • 1
    VS2017 is not yet supported by SCons. It's likely it will be in the 3.0 release cominging (at least beta) in the next few weeks. – bdbaddog May 24 '17 at 23:35
  • If you're willing to give it a try there's a pull request which works. https://bitbucket.org/scons/scons/pull-requests/428/support-for-visual-studio-2017/diff Likely we'll end up switching to use the vswhere tool instead as it should be simpler to implement. – bdbaddog May 24 '17 at 23:52

0 Answers0