Implement a warning message when building an dynamic library .so, .dll or a .dylib, which are currently not supported. Closes #2562.

This commit is contained in:
Jukka Jylänki 2014-08-26 13:23:31 +03:00
Родитель 87fcddc5f7
Коммит b233147216
2 изменённых файлов: 16 добавлений и 0 удалений

4
emcc
Просмотреть файл

@ -1122,6 +1122,10 @@ try:
# Sort arg tuples and pass the extracted values to link.
shared.Building.link(linker_inputs, specified_target)
logging.debug('stopping at bitcode')
if final_suffix.lower() in ['so', 'dylib', 'dll']:
logging.warning('Dynamic libraries (.so, .dylib, .dll) are currently not supported by Emscripten. For build system emulation purposes, Emscripten'
+ ' will now generate a static library file (.bc) with the suffix \'.' + final_suffix + '\'. For best practices,'
+ ' please adapt your build system to directly generate a static LLVM bitcode library by setting the output suffix to \'.bc.\')')
exit(0)
log_time('process inputs')

Просмотреть файл

@ -2724,6 +2724,18 @@ int main()
out, err = process.communicate()
assert(warning not in err)
def test_warn_dylibs(self):
shared_suffixes = ['.so', '.dylib', '.dll']
for suffix in ['.o', '.a', '.bc', '.so', '.lib', '.dylib', '.js', '.html']:
process = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world.c'), '-o', 'out' + suffix], stdout=PIPE, stderr=PIPE)
out, err = process.communicate()
warning = 'Dynamic libraries (.so, .dylib, .dll) are currently not supported by Emscripten'
if suffix in shared_suffixes:
assert(warning in err)
else:
assert(warning not in err)
def test_simplify_ifs(self):
def test(src, nums):
open('src.c', 'w').write(src)