Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with -DCLR_CMAKE_USE_SYSTEM_BROTLI=true #110751

Closed
omajid opened this issue Dec 16, 2024 · 6 comments · Fixed by #110816
Closed

Build fails with -DCLR_CMAKE_USE_SYSTEM_BROTLI=true #110751

omajid opened this issue Dec 16, 2024 · 6 comments · Fixed by #110816
Assignees
Labels
area-System.IO.Compression in-pr There is an active PR which will close this issue when it is merged

Comments

@omajid
Copy link
Member

omajid commented Dec 16, 2024

Description

Building the runtime with system brotli fails in the main branch

Reproduction Steps

$ git rev-parse HEAD
efb8a8fe6263cb66c154576c859523e885dc5a24
$ git branch -lv
* main efb8a8fe626 [browser] Speed up `WasmBuildTests` by using the compression switch (#110645)
$ ./build.sh  --cmakeargs  -DCLR_CMAKE_USE_SYSTEM_BROTLI=true /p:FullAssemblySigningSupported=false
...
  [100%] Linking CXX executable singlefilehost                                                                                                                                                                                                                                                                               
  ld.lld: error: undefined symbol: BrotliDecoderCreateInstance                                                                                                                                                                                                                                                               
  >>> referenced by entrypoints.c                                                                                                                                                                                                                                                                                            
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                             
  ld.lld: error: undefined symbol: BrotliDecoderDecompress                                                                                                    
  >>> referenced by entrypoints.c                                                                                                                             
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a       
                                                                                                                                                                                                                                                                                                                             
  ld.lld: error: undefined symbol: BrotliDecoderDecompressStream                                                                                              
  >>> referenced by entrypoints.c                                                                                                                             
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a          
                                                                                                                                                                                                                                                                                                                             
  ld.lld: error: undefined symbol: BrotliDecoderDestroyInstance                                                                                                                                                                                                                                                              
  >>> referenced by entrypoints.c                                                                                                                                                                                                                                                                                            
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                             
  ld.lld: error: undefined symbol: BrotliDecoderIsFinished                                                                                                                                                                                                                                                                   
  >>> referenced by entrypoints.c                                                                                                                                                                                                                                                                                            
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                             
  ld.lld: error: undefined symbol: BrotliEncoderCompress                                                                                                      
  >>> referenced by entrypoints.c                                                                                                                             
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a                                                                                                                                                                           
                                                                                                                                                              
  ld.lld: error: undefined symbol: BrotliEncoderCompressStream                                                                                                
  >>> referenced by entrypoints.c                                                                                                                             
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                             
  ld.lld: error: undefined symbol: BrotliEncoderCreateInstance                                                                                                
  >>> referenced by entrypoints.c                                                                                                                             
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a                                                                                                                                                                           
                                                                                                                                                              
  ld.lld: error: undefined symbol: BrotliEncoderDestroyInstance                                                                                               
  >>> referenced by entrypoints.c                                                                                                                             
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a        
                                              
  ld.lld: error: undefined symbol: BrotliEncoderHasMoreOutput 
  >>> referenced by entrypoints.c
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a
   
  ld.lld: error: undefined symbol: BrotliEncoderMaxCompressedSize
  >>> referenced by entrypoints.c
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a
   
  ld.lld: error: undefined symbol: BrotliEncoderSetParameter    
  >>> referenced by entrypoints.c
  >>>               entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a
  clang++-19: error: linker command failed with exit code 1 (use -v to see invocation)                                                                        
  make[2]: *** [Corehost.Static/CMakeFiles/singlefilehost.dir/build.make:1303: Corehost.Static/singlefilehost] Error 1                                        
  make[1]: *** [CMakeFiles/Makefile2:2191: Corehost.Static/CMakeFiles/singlefilehost.dir/all] Error 2      

Expected behavior

Build works

Actual behavior

Linker fails to assemble an executable

Regression?

Yes. This was working some time ago.

Known Workarounds

No response

Configuration

  • This is main branch of dotnet/runtime
  • Fedora 41 on x64 (aka x86_64)

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 16, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 16, 2024
@omajid
Copy link
Member Author

omajid commented Dec 16, 2024

cc @tmds

@tmds
Copy link
Member

tmds commented Dec 16, 2024

#109105 got closed when #109707 was merged. That makes #109707 a likely suspect for this regression.

@jkotas jkotas added area-System.IO.Compression and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Dec 16, 2024
@jkotas
Copy link
Member

jkotas commented Dec 16, 2024

cc @jkoritzinsky

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-io-compression
See info in area-owners.md if you want to be subscribed.

@jkoritzinsky jkoritzinsky self-assigned this Dec 17, 2024
@omajid
Copy link
Member Author

omajid commented Dec 18, 2024

#109105 got closed when #109707 was merged. That makes #109707 a likely suspect for this regression.

A git bisect with git bisect run bash -c 'git clean -xdf && ./build.sh --cmakeargs -DCLR_CMAKE_USE_SYSTEM_BROTLI=true /p:FullAssemblySigningSupported=false' seems to confirm this:

5fe72c12cd557197824c2485748c9e9a4af36b46 is the first bad commit                                                                                                 
commit 5fe72c12cd557197824c2485748c9e9a4af36b46                                                                                                                  
Author: Jeremy Koritzinsky <jekoritz@microsoft.com>                                                                                                              
Date:   Thu Dec 5 16:31:13 2024 -0800                                                                                                                            
                                                                                
    Put brotli on the FetchContent plan (Try 2) (#109707)                                                                                                        
                                                                                
    * Reapply "Put brotli on the FetchContent plan (#107166)" (#109108)         
                                                                                
    This reverts commit b780069abf78978112cb860f9c636f767d0b4437.                                                                                                
                                                                                
    * Don't double-install the brotli libs                                      
                                                                                                                                                                 
    * Don't try looking up locations for system brotli. Rely on the distro maintainer to set the paths correctly.                                                
                                                                                
    Fixes https://github.com/dotnet/runtime/issues/109105                       
                                                                                                                                                                 
    * Install brotli where we install the compression native lib so they're always side-by-side (and we don't need to add it to the Mono build)                  
                                                                                
    * Brotli should get pulled from the same place as Compression.Native        
                                                                                
    * Fix looking for libbrotlicommon.a on disk to determine if we should use system brotli                                                                      
                                                                                

@jkoritzinsky
Copy link
Member

I think we need to fix the CMake logic to link against the system brotli libs. Its possible that those steps got lost at some point.

omajid added a commit to omajid/dotnet-runtime that referenced this issue Dec 18, 2024
Currently, this fails on Fedora 41:

    $ ./build.sh  --cmakeargs  -DCLR_CMAKE_USE_SYSTEM_BROTLI=true /p:FullAssemblySigningSupported=false
    ...
    [100%] Linking CXX executable singlefilehost
    ld.lld: error: undefined symbol: BrotliDecoderCreateInstance
    >>> referenced by entrypoints.c
    >>> entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a

This seems to be a regression introduced when this bit was accidentally
dropped:
https://github.com/dotnet/runtime/pull/109707/files#diff-7a160e52815fdd808d9415ada41dd5b1748826b27c78277e14f4adcf1ce61511

Fix the build by re-introducing it.

Fixes: dotnet#110751
@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Dec 18, 2024
omajid added a commit to omajid/dotnet-runtime that referenced this issue Dec 18, 2024
Currently, this fails on Fedora 41:

    $ ./build.sh  --cmakeargs  -DCLR_CMAKE_USE_SYSTEM_BROTLI=true /p:FullAssemblySigningSupported=false
    ...
    [100%] Linking CXX executable singlefilehost
    ld.lld: error: undefined symbol: BrotliDecoderCreateInstance
    >>> referenced by entrypoints.c
    >>> entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a

This seems to be a regression introduced when this bit was accidentally
dropped:
https://github.com/dotnet/runtime/pull/109707/files#diff-7a160e52815fdd808d9415ada41dd5b1748826b27c78277e14f4adcf1ce61511

Fix the build by re-introducing it.

Fixes: dotnet#110751
omajid added a commit to omajid/dotnet-runtime that referenced this issue Dec 18, 2024
Currently, this fails on Fedora 41:

    $ ./build.sh  --cmakeargs  -DCLR_CMAKE_USE_SYSTEM_BROTLI=true /p:FullAssemblySigningSupported=false
    ...
    [100%] Linking CXX executable singlefilehost
    ld.lld: error: undefined symbol: BrotliDecoderCreateInstance
    >>> referenced by entrypoints.c
    >>> entrypoints.c.o:(s_compressionNative) in archive ../libs-native/System.IO.Compression.Native/libSystem.IO.Compression.Native.a

This seems to be a regression introduced when this bit was accidentally
dropped:
https://github.com/dotnet/runtime/pull/109707/files#diff-7a160e52815fdd808d9415ada41dd5b1748826b27c78277e14f4adcf1ce61511

Fix the build by re-introducing it.

Fixes: dotnet#110751
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Dec 20, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.IO.Compression in-pr There is an active PR which will close this issue when it is merged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants