attempting to build sanitized binaries against statically linked libc++ (WIP)

This commit is contained in:
Artem Pavlenko 2018-03-09 12:52:06 +01:00
parent c737f4d56f
commit df1cdb1329
12 changed files with 37 additions and 18 deletions

View file

@ -1297,7 +1297,8 @@ if not preconfigured:
env['QUERIED_PROJ_LIB'] = None
env['QUERIED_ICU_DATA'] = None
env['QUERIED_GDAL_DATA'] = None
#'LINKCOM': '$LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
env['LINKCOM'] = '$LINK -o $TARGET $SOURCES $LINKFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
# previously a leading / was expected for LIB_DIR_NAME
# now strip it to ensure expected behavior
if env['LIB_DIR_NAME'].startswith(os.path.sep):
@ -1360,7 +1361,7 @@ if not preconfigured:
env.Append(CFLAGS = env['CUSTOM_CFLAGS'])
env.Append(LINKFLAGS = DEFAULT_CXX14_LINKFLAGS)
env.Append(LINKFLAGS = env['CUSTOM_LDFLAGS'])
print(env.Dump())
### platform specific bits
thread_suffix = 'mt'

View file

@ -36,12 +36,16 @@ demo_env = env.Clone()
demo_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
demo_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES'])
demo_env['LINKFLAGS'] = '-lmapnik -lmapnik-json' + demo_env['LINKFLAGS']
print demo_env['LINKFLAGS']
if env['HAS_CAIRO']:
demo_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS'])
demo_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
libraries = [env['MAPNIK_NAME']]
libraries = []#env['MAPNIK_NAME']]
libraries.extend(copy(env['LIBMAPNIK_LIBS']))
print libraries
rundemo = demo_env.Program('rundemo', source, LIBS=libraries)
Depends(rundemo, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))

View file

@ -41,7 +41,7 @@ BOOST_SPIRIT_DECLARE(escaped_unicode_type);
}
grammar::unicode_string_grammar_type const& unicode_string_grammar();
grammar::escaped_unicode_type const& escaped_unicode_grammar();
__attribute__((visibility("default"))) grammar::escaped_unicode_type const& escaped_unicode_grammar();
}}

View file

@ -36,7 +36,7 @@ else:
PLUGIN_NAME = 'csv'
plugin_env = plugin_base.Clone()
#plugin_env[LINKFLAGS] = '-lmapnik' + plugin_env[LINKFLAGS]
plugin_sources = Split(
"""
%(PLUGIN_NAME)s_utils.cpp
@ -54,7 +54,7 @@ else:
if env['PLUGIN_LINKING'] == 'shared':
libraries.append('boost_system%s' % env['BOOST_APPEND'])
libraries.insert(0,env['MAPNIK_NAME'])
#libraries.insert(0,env['MAPNIK_NAME'])
libraries.append(env['ICU_LIB_NAME'])
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,

View file

@ -60,7 +60,7 @@ using mapnik::filter_in_box;
using mapnik::filter_at_point;
static std::once_flag once_flag;
#if 0
extern "C" MAPNIK_EXP void on_plugin_load()
{
// initialize ogr formats
@ -69,6 +69,7 @@ extern "C" MAPNIK_EXP void on_plugin_load()
OGRRegisterAll();
});
}
#endif
ogr_datasource::ogr_datasource(parameters const& params)
: datasource(params),

View file

@ -37,13 +37,14 @@ plugin_sources = Split(
libraries = [ 'sqlite3' ]
linkflags = []
plugin_env.Append(LINKFLAGS='-lmapnik')
if env['SQLITE_LINKFLAGS']:
linkflags.append(env['SQLITE_LINKFLAGS'])
plugin_env.Append(LINKFLAGS=linkflags)
if env['PLUGIN_LINKING'] == 'shared':
libraries.append('boost_system%s' % env['BOOST_APPEND'])
libraries.insert(0,env['MAPNIK_NAME'])
#libraries.insert(0,env['MAPNIK_NAME'])
libraries.append(env['ICU_LIB_NAME'])
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,

View file

@ -25,13 +25,13 @@
#include <mapnik/json/unicode_string_grammar_x3_def.hpp>
namespace mapnik { namespace json { namespace grammar {
BOOST_SPIRIT_INSTANTIATE(unicode_string_grammar_type, mapnik::grammar::iterator_type, mapnik::grammar::context_type);
BOOST_SPIRIT_INSTANTIATE(escaped_unicode_type, mapnik::grammar::iterator_type, mapnik::grammar::context_type);
}
grammar::escaped_unicode_type const& escaped_unicode_grammar()
{
return grammar::escaped_unicode;
}
//grammar::escaped_unicode_type const& escaped_unicode_grammar()
//{
// return grammar::escaped_unicode;
//}
}}

View file

@ -42,6 +42,7 @@ BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extr
BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type);
BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_context_type_f);
BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type_f);
}
grammar::unicode_string_grammar_type const& unicode_string_grammar()
@ -49,4 +50,9 @@ grammar::unicode_string_grammar_type const& unicode_string_grammar()
return grammar::unicode_string;
}
grammar::escaped_unicode_type const& escaped_unicode_grammar()
{
return grammar::escaped_unicode;
}
}}

View file

@ -5,6 +5,10 @@ from copy import copy
Import ('env')
test_env = env.Clone()
test_env.Prepend(LINKFLAGS='-lmapnik')# + test_env['LINKFLAGS']
test_env.Append(LIBS='/home/artem/projects/mason/mason_packages/linux-x86_64/llvm/7.0.0/lib/libc++.a')
#test_env.Append(LIBS='/home/artem/projects/mason/mason_packages/linux-x86_64/llvm/7.0.0/lib/libc++abi.a')
#test_env.Append(LIBS='/home/artem/projects/mason/mason_packages/linux-x86_64/llvm/7.0.0/lib/libunwind.a')
if not env['CPP_TESTS']:
for cpp_test_bin in glob.glob('./*/*-bin'):
@ -30,10 +34,10 @@ else:
test_env.AppendUnique(LIBS='boost_program_options%s' % env['BOOST_APPEND'])
test_env_local = test_env.Clone()
# unit tests
sources = glob.glob('./unit/*/*.cpp')
sources.extend(glob.glob('./unit/*.cpp'))
sources.append('/home/artem/projects/mason/mason_packages/linux-x86_64/llvm/7.0.0/lib/libc++.a')
test_program = test_env_local.Program("./unit/run", source=sources)
Depends(test_program, env.subst('../src/%s' % env['MAPNIK_LIB_NAME']))
Depends(test_program, env.subst('../src/json/libmapnik-json${LIBSUFFIX}'))
@ -57,6 +61,7 @@ else:
visual/parse_map_sizes.cpp
"""
)
source.append('/home/artem/projects/mason/mason_packages/linux-x86_64/llvm/7.0.0/lib/libc++.a')
test_program3 = test_env_local.Program('visual/run', source=source)
Depends(test_program, env.subst('../src/%s' % env['MAPNIK_LIB_NAME']))

View file

@ -27,13 +27,12 @@ Import ('env')
Import ('plugin_base')
program_env = plugin_base.Clone()
program_env['LINKFLAGS'] = '-lmapnik plugins/input/csv/csv_utils.os' + program_env['LINKFLAGS']
source = Split(
"""
mapnik-index.cpp
process_csv_file.cpp
process_geojson_file_x3.cpp
../../plugins/input/csv/csv_utils.os
"""
)
@ -41,7 +40,7 @@ headers = env['CPPPATH']
boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND']
boost_system = 'boost_system%s' % env['BOOST_APPEND']
libraries = [env['MAPNIK_NAME'], boost_program_options, boost_system]
libraries = [boost_program_options, boost_system]
# need on linux: https://github.com/mapnik/mapnik/issues/3145
libraries.append('mapnik-json')
libraries.append('mapnik-wkt')

View file

@ -12,6 +12,7 @@ source = Split(
)
program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
program_env['LINKFLAGS'] = '-lmapnik -lmapnik-json ' + program_env['LINKFLAGS']
program_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES'])
if env['HAS_CAIRO']:
@ -19,7 +20,7 @@ if env['HAS_CAIRO']:
program_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND']
libraries = [env['MAPNIK_NAME'],boost_program_options]
libraries = [boost_program_options]
libraries.extend(copy(env['LIBMAPNIK_LIBS']))
if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux':
libraries.append('dl')

View file

@ -28,6 +28,7 @@ Import ('env')
Import ('plugin_base')
program_env = plugin_base.Clone()
program_env['LINKFLAGS'] = '-lmapnik -lmapnik-json' + program_env['LINKFLAGS']
source = Split(
"""