Skip to content

singlefilehost doesn't link to system libunwind #42661

@omajid

Description

@omajid

Trying to build runtime (commit 20710bb) with -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND is currently broken:

$ ./build.sh -cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE 
...
  /usr/bin/ld: /home/omajid/devel/dotnet/runtime/artifacts/bin/coreclr/Linux.x64.Debug//lib/libcoreclrpal.a(seh.cpp.o): in function `UnwindContextToWinContext(unw_cursor*, _CONTEXT*)':                                                      
  /home/omajid/devel/dotnet/runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:176: undefined reference to `_ULx86_64_get_reg'                                                                                                          
  /usr/bin/ld: /home/omajid/devel/dotnet/runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:177: undefined reference to `_ULx86_64_get_reg'                                                                                             
  /usr/bin/ld: /home/omajid/devel/dotnet/runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:178: undefined reference to `_ULx86_64_get_reg'                                                                                             
  /usr/bin/ld: /home/omajid/devel/dotnet/runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:179: undefined reference to `_ULx86_64_get_reg'                                                                                             
  /usr/bin/ld: /home/omajid/devel/dotnet/runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:180: undefined reference to `_ULx86_64_get_reg'                                                                                             
  /usr/bin/ld: /home/omajid/devel/dotnet/runtime/artifacts/bin/coreclr/Linux.x64.Debug//lib/libcoreclrpal.a(seh.cpp.o):/home/omajid/devel/dotnet/runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:181: more undefined references to `_ULx86_64_get_reg' follow                                                                                                                                                                                                                      
  /usr/bin/ld: /home/omajid/devel/dotnet/runtime/artifacts/bin/coreclr/Linux.x64.Debug//lib/libcoreclrpal.a(seh.cpp.o): in function `GetContextPointer(unw_cursor*, ucontext_t*, int, unsigned long**)':                                      
  /home/omajid/devel/dotnet/runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:227: undefined reference to `_ULx86_64_get_save_loc'                                                                                                     
  /usr/bin/ld: /home/omajid/devel/dotnet/runtime/artifacts/bin/coreclr/Linux.x64.Debug//lib/libcoreclrpal.a(seh.cpp.o): in function `PAL_VirtualUnwind':                                                                                      
  /home/omajid/devel/dotnet/runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:340: undefined reference to `_ULx86_64_init_local'                                                                                                       
  /usr/bin/ld: /home/omajid/devel/dotnet/runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:351: undefined reference to `_ULx86_64_step'                                                                                                
  /usr/bin/ld: /home/omajid/devel/dotnet/runtime/src/coreclr/src/pal/src/exception/seh-unwind.cpp:360: undefined reference to `_ULx86_64_is_signal_frame'                                                                                     
  clang-10: error: linker command failed with exit code 1 (use -v to see invocation)                                                                                                                                                          
  gmake[2]: *** [cli/apphost/static/CMakeFiles/singlefilehost.dir/build.make:282: cli/apphost/static/singlefilehost] Error 1                                                                                                                  
  gmake[1]: *** [CMakeFiles/Makefile2:510: cli/apphost/static/CMakeFiles/singlefilehost.dir/all] Error 2                                 

Configuration

  • Which version of .NET is the code running on?

dotnet/runtime commit 20710bbcae006e32f8a133c372c8d78722890982 as well as release/5.0-preview8 tag.

  • What OS and version, and what distro if applicable?

Fedora 32.

  • What is the architecture (x64, x86, ARM, ARM64)?

x64, but probably affects everything.

  • Do you know whether it is specific to that configuration?

Yes: building without -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND works

Regression?

Yes. This build configuration was supported in .NET Core 3.1 and we were using it in source-build to build on Fedora/RHEL. See dotnet/coreclr#17164 and dotnet/source-build#391

Other information

The fix is probably the along the lines of #42094: the singlefilehost needs to link to the system libunwind library.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions