Unable to build jsoncpp library in redhat with scons - linux

I'm trying to build jsoncpp library in redhat with scons.
I follow the instructions but get no result.
I first install scons, then download the library source, decompress it and enter the directory.
Once in the library folder I've tried several options:
1)
jsoncpp-src-0.5.0 > scons SConstruct platform=linux-gcc
scons: Reading SConscript files ...
Using platform 'linux-gcc-4.8.1'
LD_LIBRARY_PATH = /work/gcsadm/ext/ACE+TAO/lib/linux:/work/dguerra/tests/lib/linux:/work/dguerra/examples/lib/linux:/work/dguerra/lib/linux:/work/gcsadm/lib/linux:/usr/local/lib64:/usr/lib64:/work/gcsadm/ext/CorbaScript/lib:/usr/local/ostoreBase/ostore/lib:/work/gcsadm/ext/gsl/lib/linux:/work/gcsadm/ext/fitsio/lib/linux:/work/gcsadm/ext/sla/lib/linux:/work/gcsadm/ext/wcs/lib/linux:/work/gcsadm/ext/xpa/lib/linux:/work/gcsadm/ext/tcsPK/lib/linux:/work/gcsadm/ext/jsoncpp/lib/linux:/work/gcsadm/ext/mysql-connector/lib/linux:/usr/local/bin:libs/linux-gcc-4.8.1
Building using PLATFORM = linux-gcc-4.8.1
scons: done reading SConscript files.
scons: Building targets ...
scons: Nothing to be done for `SConstruct'.
scons: done building targets.
2)
jsoncpp-src-0.5.0 > scons platform=linux-gcc
scons: Reading SConscript files ...
Using platform 'linux-gcc-4.8.1'
LD_LIBRARY_PATH = /work/gcsadm/ext/ACE+TAO/lib/linux:/work/dguerra/tests/lib/linux:/work/dguerra/examples/lib/linux:/work/dguerra/lib/linux:/work/gcsadm/lib/linux:/usr/local/lib64:/usr/lib64:/work/gcsadm/ext/CorbaScript/lib:/usr/local/ostoreBase/ostore/lib:/work/gcsadm/ext/gsl/lib/linux:/work/gcsadm/ext/fitsio/lib/linux:/work/gcsadm/ext/sla/lib/linux:/work/gcsadm/ext/wcs/lib/linux:/work/gcsadm/ext/xpa/lib/linux:/work/gcsadm/ext/tcsPK/lib/linux:/work/gcsadm/ext/jsoncpp/lib/linux:/work/gcsadm/ext/mysql-connector/lib/linux:/usr/local/bin:libs/linux-gcc-4.8.1
Building using PLATFORM = linux-gcc-4.8.1
scons: done reading SConscript files.
scons: Building targets ...
g++ -o buildscons/linux-gcc-4.8.1/src/jsontestrunner/main.o -c - W a l l -Iinclude -I. src/jsontestrunner/main.cpp
g++: error: W: No such file or directory
g++: error: a: No such file or directory
g++: error: l: No such file or directory
g++: error: l: No such file or directory
scons: *** [buildscons/linux-gcc-4.8.1/src/jsontestrunner/main.o] Error 1
scons: building terminated because of errors.
Any help would be greatly appreciated.

The '- W a l l' indicates that some string with content '-Wall' should have been passed as a array [ '-Wall' ]

Related

SCONS build failed ( I am using RT Thread)

Failling to build SCONC while using RT Thread library:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/applications/lcd_init.o
In file included from /home/blue/rt-thread/include/rtthread.h:24:0,
from applications/lcd_init.c:1:
/home/blue/rt-thread/include/rtdef.h:87:9: error: unknown type name 'rt_uint32_t'
typedef rt_uint32_t rt_time_t; /**< Type for time stamp
scons: *** [build/applications/lcd_init.o] Error 1
scons: building terminated because of errors.

makefile g++: fatal error: no input files

I am taking a C++ class right now and in an effort to embrace CS, I installed Linux Mint 15 (Olivia) and have been going through my homework and lectures on the command line and through vim. We recently went over makefile(s) and I am having an issue with g++. My makefile looks like this:
CXX = g++
CXXFLAGS += -pedantic-errors
CXXFLAGS += -g
OBJS =
SRCS = constructors.cpp
HEADERS =
#target: dependencies
# rule to build
#
constructors: ${OBJS} ${HEADERS}
${CXX} ${LDFLAGS} ${OBJS} -o constructors
${OBJS}: ${SRCS}
${CXX} ${CXXFLAGS} -c $(#:.o=.cpp)
When I run:
make constructors
I get the following message:
g++ -o constructors
g++: fatal error: no input files
compilation terminated.
make: *** [constructors] Error 4
I have constructors.cpp in the same folder and if I manually compile it, it works perfect. Any suggestions are greatly appreciated.
OBJS =
You... seem to be missing something here. Like some objects to build.

scons build both static and shared library

I am trying to build both a static and a shared library using the same sources with SCons.
Everything works fine if I just build one or the other, but as soon as I try to build both, only the static library is built.
My SConscript looks like:
cppflags = SP3_env['CPPFLAGS']
cppflags += ' -fPIC '
SP3_env['CPPFLAGS'] = cppflags
soLibFile = SP3_env.SharedLibrary(
target = "sp3",
source = sources)
installedSoFile = SP3_env.Install(SP3_env['SP3_lib_dir'], soLibFile)
libFile = SP3_env.Library(
target = "sp3",
source = sources)
installedLibFile = SP3_env.Install(SP3_env['SP3_lib_dir'], libFile)
I also tried SharedObject(sources) before the SharedLibrary (passing in the return from SharedObject, rather than sources), but it is no different. Same if I build the .a before the .so.
How do I work around this?
When the installation directory is not in or below the current directory, SCons does not behave as expected, as commented in the SCons Install method docs:
Note, however, that installing a file is still considered a type of
file "build." This is important when you remember that the default
behavior of SCons is to build files in or below the current directory.
If, as in the example above, you are installing files in a directory
outside of the top-level SConstruct file's directory tree, you must
specify that directory (or a higher directory, such as /) for it to
install anything there:
That is, you must invoke SCons with the install directory as a target (SP3_env['SP3_lib_dir'] in your case) in order for the installation to be executed. To simplify this, use env.Alias() as I do below.
When you invoke SCons, you should at least see that both the static and shared libraries are built in the local project dir. I would imagine, however, that SCons does not install them. Here is an example I made on Ubuntu that works:
env = Environment()
sourceFiles = 'ExampleClass.cc'
sharedLib = env.SharedLibrary(target='example', source=sourceFiles)
staticLib = env.StaticLibrary(target='example', source=sourceFiles)
# Notice that installDir is outside of the local project dir
installDir = '/home/notroot/projects/sandbox'
sharedInstall = env.Install(installDir, sharedLib)
staticInstall = env.Install(installDir, staticLib)
env.Alias('install', installDir)
If I execute scons with no targets, I get the following:
# scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o ExampleClass.o -c ExampleClass.cc
g++ -o ExampleClass.os -c -fPIC ExampleClass.cc
ar rc libexample.a ExampleClass.o
ranlib libexample.a
g++ -o libexample.so -shared ExampleClass.os
scons: done building targets.
Then I can install, executing scons with the install target, as follows:
# scons install
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
Install file: "libexample.a" as "/home/notroot/projects/sandbox/libexample.a"
Install file: "libexample.so" as "/home/notroot/projects/sandbox/libexample.so"
scons: done building targets.
Or, you could just do it all with one command, first clean everything
# scons -c install
Then, do it all with just one command:
# scons install
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o ExampleClass.o -c ExampleClass.cc
g++ -o ExampleClass.os -c -fPIC ExampleClass.cc
ar rc libexample.a ExampleClass.o
ranlib libexample.a
g++ -o libexample.so -shared ExampleClass.os
Install file: "libexample.a" as "/home/notroot/projects/sandbox/libexample.a"
Install file: "libexample.so" as "/home/notroot/projects/sandbox/libexample.so"
scons: done building targets.

Mongodb C++ driver install on Linux

I have installed this driver for long time, but failed. There is the same mistake as following:
scons: Reading SConscript files ...
Checking for C++ library boost_thread-mt... (cached) no
Checking for C++ library boost_thread... (cached) yes
Checking for C++ library boost_filesystem-mt... (cached) no
Checking for C++ library boost_filesystem... (cached) yes
Checking for C++ library boost_system-mt... (cached) no
Checking for C++ library boost_system... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/mongo/client/dbclient_rs.o -c -O3 -pthread -D_SCONS -DMONGO_EXPOSE_MACROS -Ibuild -Isrc -Ibuild/mongo -Isrc/mongo src/mongo/client/dbclient_rs.cpp
In file included from /usr/local/include/boost/filesystem/path.hpp:24,
from src/mongo/util/paths.h:26,
from src/mongo/db/client.h:38,
from src/mongo/db/curop.h:23,
from src/mongo/db/curop-inl.h:1,
from src/mongo/db/instance.h:23,
from src/mongo/db/dbmessage.h:25,
from src/mongo/client/dbclient_rs.cpp:27:
/usr/local/include/boost/filesystem/config.hpp:16:5: error: #error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3
scons: *** [build/mongo/client/dbclient_rs.o] Error 1
scons: building terminated because of erro`enter code here`rs.`enter code here`
before install, I have installed the boost 1.5, pcre8.3, and I want install mongodb driver 2.2
Any ideas ? Thanks!
I encountered the same problem with you.
In mongodb C++ driver source src/mongo/pch.h
#define BOOST_FILESYSTEM_VERSION 2
but in /usr/local/include/boost/filesystem/config.hpp:
# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3
# error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3
# endif
this is the problem.
And I change src/mongo/pch.h to
#define BOOST_FILESYSTEM_VERSION 3
then scons again, the compiles correctly.
Some solution from Internet :
RESOLVED: I have v2 of the 1.44 boost libraries, but had "#define BOOST_FILESYSTEM_VERSION 3" in my header (a co-worker using another version had added it). If I comment this directive, my code compiles correctly. Looks like we need to synchronize our libraries.

How to make scons work properly

I'm trying to compile the SndObj library from the source.
Supposedly it's as easy as just running 'scons' from the top of the SndObj directory.
I get this:
nhnifong#ubuntu-nate:~/SndObj-2.6.6$ scons
scons: Reading SConscript files ...
scons: warning: The Options class is deprecated; use the Variables class instead.
File "/home/nhnifong/SndObj-2.6.6/SConstruct", line 58, in <module>
scons: warning: The BoolOption() function is deprecated; use the BoolVariable() function instead.
File "/home/nhnifong/SndObj-2.6.6/SConstruct", line 60, in <module>
SndObj Library version is 2.6.5
Building the Sound Object Library
scons tools in this system: ['default', 'gnulink', 'gcc', 'g++', 'gfortran', 'gas', 'ar', 'filesystem', 'dvipdf', 'gs', 'jar', 'javac', 'javah', 'm4', 'rmic', 'rpcgen', 'swig', 'tar', 'zip']
Checking for Realtime IO support...
OS is Linux...
Checking for C header file alsa/asoundlib.h... (cached) no
Checking for C header file soundcard.h... (cached) no
Checking for C header file jack/jack.h... (cached) no
No alsa or OSS RT support
Host is little endian
swig exists...
Checking for C header file Python.h... (cached) no
Checking for C header file /usr/include/python2.6/Python.h... (cached) yes
Python version is 2.6
Checking for C header file m_pd.h... (cached) no
Checking for C header file ladspa.h... (cached) no
installing python module in /usr/lib/python2.6/dist-packages
scons: done reading SConscript files.
scons: Building targets ...
chmod a-x include/SndObj/*.h
scons: done building targets.
The first problem is that the C header files it claims are missing are all there in /usr/include/
The second problem is that the Python module is not actually installed in /usr/lib/python2.6/dist-packages
It looks like you have one or more config.cache files left over. Those should all be deleted and the installation restarted.

Resources