Building failure of libtensorflowlite_gpu_delegate.so
I really need your help to solve this problem!
 It is the final linkage step that raise an error stating can't find -lnativewindow Hi @wqy123456 ,

Could you please try adding `--copt=-DMESA_EGL_NO_X11_HEADERS=1` to the command and let us know if it helps. For more details please refer similar issue #52155 .

Thanks! Hi,@SuryanarayanaY,I have solved this question by modifying build_defs.bzl.

Below are my modifications：

#def nativewindow_linkopts():
    # copybara:uncomment_begin(google-only)
    # return min_supported_ndk_api("26", ["-lnativewindow"])
    # copybara:uncomment_end
    # copybara:comment_begin(oss-only)
    # return ["-lnativewindow"]
    # copybara:comment_end

def gpu_delegate_linkopts():
    """Additional link options needed when linking in the GPU Delegate."""
    return select({
        "//tensorflow:android": [
            "-lEGL",
            # We don't need to link libGLESv3, because if it exists,
            # it is a symlink to libGLESv2.
            # See Compatibility Definition Document:
            # https://source.android.com/compatibility/10/android-10-cdd#7_1_4_1_opengl_es
            "-lGLESv2",
        ],
        "//conditions:default": [],
    }) 
    #+ nativewindow_linkopts() Hi @wqy123456 ,

I can see the file [here](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/delegates/gpu/build_defs.bzl) at master branch. It seems you have commented `nativewindow_linkopts` to make it workable for you right?

I think this modification might be applicable for your own optimization and compiler options you have chosen. 

Could we mark it as resolved now? 

Thank you!


 Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62151">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62151">No</a>

System information

OS Platform and Distribution: Ubuntu 20.04
TensorFlow installed from (source or binary): source
TensorFlow version: 2.12.0
Bazel version (if compiling from source): 5.3.0
GCC/Compiler version (if compiling from source): 9.4.0


Describe the problem
Building libtensorflowlite_gpu_delegate.so fails
------------------------

Provide the exact sequence of commands / steps that you executed before running into the problem

bazel build -c opt tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.so --copt -DEGL_NO_X11=1

Any other info / logs

ERROR: /home/sstc/tensorflow/tensorflow/lite/delegates/gpu/BUILD:134:10: Linking tensorflow/lite/delegates/gpu/libtensorflowlite_gpu_delegate.so failed: (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc @bazel-out/k8-opt/bin/tensorflow/lite/delegates/gpu/libtensorflowlite_gpu_delegate.so-2.params
/usr/bin/ld: cannot find -lnativewindow
/usr/bin/ld: cannot find -lnativewindow
collect2: error: ld returned 1 exit status
Target //tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.so failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 123.625s, Critical Path: 46.21s
INFO: 804 processes: 190 internal, 614 local.
FAILED: Build did NOT complete successfully