Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ See docs/process.md for more on how version tagging works.
- Support for explicitly targeting the legacy Interet Explorer or EdgeHTML
(edge version prior to the chromium-based edge) browsers via
`-sMIN_EDGE_VERSION/-sMIN_IE_VERSION` was removed. (#20881)
- Emscripten is now more strict about handling unsupported shared library
inputs. For example, under the old behaviour if a system shared library
such as `/usr/lib/libz.so` was passed to emscripten it would silently re-write
this to `-lz`, which would then search this a libz in its own sysroot. Now
Comment thread
sbc100 marked this conversation as resolved.
this file is passed though the linker like any other input file and you will
see an `unknown file type` error from the linker (just like you would with the
native clang or gcc toolchains). (#20886)
- Support for explicitly targeting the legacy EdgeHTML browser (edge version
prior to the chromium-based edge) via `-sMIN_EDGE_VERSION` was removed.
Using `-sLEGACY_VM_SUPPORT` should still work if anyone still wanted to target
this or any other legacy browser.
Comment thread
sbc100 marked this conversation as resolved.
- Breaking change: Using the `*glGetProcAddress()` family of functions now
requires passing a linker flag -sGL_ENABLE_GET_PROC_ADDRESS. This prevents
ports of native GL renderers from later accidentally attempting to activate
Expand Down
11 changes: 1 addition & 10 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,16 +761,7 @@ def phase_setup(options, state, newargs):
else:
message = arg + ': Unknown format, not a static library!'
exit_with_error(message)
if file_suffix in DYNAMICLIB_ENDINGS and not building.is_bitcode(arg) and not building.is_wasm(arg):
# For shared libraries that are neither bitcode nor wasm, assuming its local native
# library and attempt to find a library by the same name in our own library path.
# TODO(sbc): Do we really need this feature? See test_other.py:test_local_link
libname = removeprefix(get_library_basename(arg), 'lib')
flag = '-l' + libname
diagnostics.warning('map-unrecognized-libraries', f'unrecognized file type: `{arg}`. Mapping to `{flag}` and hoping for the best')
state.add_link_flag(i, flag)
else:
input_files.append((i, arg))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could add an error here that suggests the proper form, to help people update? That is, if /abs/path/libfoo.so does not exist, but libfoo.a exists in the sysroot, we could say Absolute path .. provided, but the contents there are not valid for wasm. Did you mean -lfoo ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not for the following reasons:

  1. I think its unlikely anyone is actually relying on this/
  2. I think the unknown file format is pretty reasonable and actionable
  3. Do a search of all the library paths at this point is tricky.. especially given the we sometime build libraries on demand and they might not exist yet.
  4. Its hard to recommend -lfoo just because somebody passed somepath/libfoo.so. In most cases the solution to "unknown file format somepath/libfoo.so" is to rebuild somepath/libfoo.so with emcc not to replace that with -lfoo

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, lgtm.

input_files.append((i, arg))
elif arg.startswith('-L'):
state.add_link_flag(i, arg)
newargs[i] = ''
Expand Down
27 changes: 0 additions & 27 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -1642,33 +1642,6 @@ def test_abspaths(self):
WARNING = 'encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript)'
self.assertContainedIf(WARNING, proc.stderr, expected)

def test_local_link(self):
# Linking a local library directly, like /usr/lib/libsomething.so, cannot work of course since it
# doesn't contain bitcode. However, when we see that we should look for a bitcode file for that
# library in the -L paths and system/lib
create_file('main.c', '''
extern void printey();
int main() {
printey();
return 0;
}
''')

ensure_dir('subdir')
create_file('subdir/libfile.so.1.2.3', 'this is not llvm bitcode!')

create_file('libfile.c', '''
#include <stdio.h>
void printey() {
printf("hello from lib\\n");
}
''')

self.run_process([EMCC, 'libfile.c', '-shared', '-o', 'libfile.so'], stderr=PIPE)
err = self.run_process([EMCC, 'main.c', Path('subdir/libfile.so.1.2.3'), '-L.'], stderr=PIPE).stderr
self.assertContained('Mapping to `-lfile` and hoping for the best [-Wmap-unrecognized-libraries]', err)
self.assertContained('hello from lib', self.run_js('a.out.js'))

def test_identical_basenames(self):
# Issue 287: files in different dirs but with the same basename get confused as the same,
# causing multiply defined symbol errors
Expand Down