| Newsgroups |
gmane.linux.lfs.beyond.devel |
| Message-ID |
<[email protected]> |
On 5/26/25 8:43 AM, Xi Ruoyao ([email protected] via blfs-dev Mailing List)
wrote:
> On Sun, 2025-05-25 at 16:45 +0200, Pierre Labastie wrote:
>> On Sun, 2025-05-25 at 21:54 +0800, Xi Ruoyao wrote:
>>> On Sun, 2025-05-25 at 14:45 +0200, Pierre Labastie wrote:
>>>> On Sat, 2025-05-24 at 12:39 +0800, Xi Ruoyao wrote:
>>>>> On Sat, 2025-05-24 at 12:12 +0800, Xi Ruoyao wrote:
>>>>>> On Fri, 2025-05-23 at 23:20 +0200, Pierre Labastie wrote:
>>>>>>> /usr/lib/cmake/protobuf/protobuf-targets.cmake contains:
>>>>>>> -----
>>>>>>> add_library(protobuf::libupb STATIC IMPORTED)
>>>>>>> -----
>>>>>>> So if we remove libupb.a as done in protobuf instructions
>>>>>>> (since
>>>>>>> protobuf-31), any CMakeLists.txt using this file will fail
>>>>>>> with:
>>>>>>> ----------
>>>>>>> CMake Error at /usr/lib/cmake/protobuf/protobuf-
>>>>>>> targets.cmake:132
>>>>>>> (message):
>>>>>>> The imported target "protobuf::libupb" references the file
>>>>>>>
>>>>>>> "/usr/lib/libupb.a"
>>>>>>>
>>>>>>> but this file does not exist. Possible reasons include:
>>>>>>>
>>>>>>> * The file was deleted, renamed, or moved to another
>>>>>>> location.
>>>>>>>
>>>>>>> * An install or uninstall procedure did not complete
>>>>>>> successfully.
>>>>>>>
>>>>>>> * The installation package was faulty and contained
>>>>>>>
>>>>>>> "/usr/lib/cmake/protobuf/protobuf-targets.cmake"
>>>>>>>
>>>>>>> but not all the files it references.
>>>>>>> -----------
>>>>>>> So I think we should remove the line "rm /usr/lib/libupb.a"
>>>>>>> when
>>>>>>> installing protobuf. libupb.a is about 520KB in size...
>>>>>>
>>>>>> The problem here is not to save space. It's just it shouldn't
>>>>>> be
>>>>>> installed even per upstream documentation
>>>>>> (
>>>>>> https://github.com/protocolbuffers/protobuf/blob/main/upb/README.md
>>>>>> )
>>>>>> :
>>>>>>
>>>>>> While upb offers a C API, the C API & ABI are not stable.
>>>>>> For
>>>>>> this
>>>>>> reason, upb is not generally offered as a C library for
>>>>>> direct
>>>>>> consumption, and there are no releases.
>>>>>>
>>>>>> I'll try to figure out a way to prevent it from being
>>>>>> installed.
>>>>>
>>>>> Tentative patch:
>>>>>
>>>>> diff --color -Naur protobuf-31.0/cmake/install.cmake protobuf-
>>>>> 31.0.patched/cmake/install.cmake
>>>>> --- protobuf-31.0/cmake/install.cmake 2025-05-14
>>>>> 23:37:13.000000000 +0800
>>>>> +++ protobuf-31.0.patched/cmake/install.cmake 2025-05-24
>>>>> 12:39:08.572837445 +0800
>>>>> @@ -37,9 +37,6 @@
>>>>> if (protobuf_BUILD_LIBPROTOC)
>>>>> list(APPEND _protobuf_libraries libprotoc)
>>>>> endif (protobuf_BUILD_LIBPROTOC)
>>>>> -if (protobuf_BUILD_LIBUPB)
>>>>> - list(APPEND _protobuf_libraries libupb)
>>>>> -endif ()
>>>>>
>>>>> foreach(_library ${_protobuf_libraries})
>>>>> if (UNIX AND NOT APPLE)
>>>>> diff --color -Naur protobuf-31.0/cmake/libprotoc.cmake protobuf-
>>>>> 31.0.patched/cmake/libprotoc.cmake
>>>>> --- protobuf-31.0/cmake/libprotoc.cmake 2025-05-14
>>>>> 23:37:13.000000000 +0800
>>>>> +++ protobuf-31.0.patched/cmake/libprotoc.cmake 2025-05-24
>>>>> 12:28:03.095300298 +0800
>>>>> @@ -16,8 +16,8 @@
>>>>> set_target_properties(libprotoc PROPERTIES
>>>>> LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotoc.map)
>>>>> endif()
>>>>> -target_link_libraries(libprotoc PRIVATE libprotobuf)
>>>>> -target_link_libraries(libprotoc PUBLIC libupb
>>>>> ${protobuf_ABSL_USED_TARGETS})
>>>>> +target_link_libraries(libprotoc PRIVATE libprotobuf libupb)
>>>>> +target_link_libraries(libprotoc PUBLIC
>>>>> ${protobuf_ABSL_USED_TARGETS})
>>>>> protobuf_configure_target(libprotoc)
>>>>> if(protobuf_BUILD_SHARED_LIBS)
>>>>> target_compile_definitions(libprotoc
>>>>>
>>>> This fails with:
>>>> FAILED:
>>>> CMakeFiles/protoc.dir/src/google/protobuf/compiler/main.cc.o
>>>> /usr/bin/c++ -DPROTOBUF_USE_DLLS -I/sources/protobuf/protobuf-
>>>> 31.0/build -I/sources/protobuf/protobuf-31.0 -
>>>> I/sources/protobuf/protobuf-31.0/build/src -
>>>> I/sources/protobuf/protobuf-31.0/src -I/sources/protobuf/protobuf-
>>>> 31.0/third_party/utf8_range -O3 -DNDEBUG -fPIE -MD -MT
>>>> CMakeFiles/protoc.dir/src/google/protobuf/compiler/main.cc.o -MF
>>>> CMakeFiles/protoc.dir/src/google/protobuf/compiler/main.cc.o.d -o
>>>> CMakeFiles/protoc.dir/src/google/protobuf/compiler/main.cc.o -c
>>>> /sources/protobuf/protobuf-
>>>> 31.0/src/google/protobuf/compiler/main.cc
>>>>
>>>> In file included from /sources/protobuf/protobuf-
>>>> 31.0/upb/reflection/common.h:15,
>>>> from /sources/protobuf/protobuf-
>>>> 31.0/upb/reflection/def_pool.h:15,
>>>> from /sources/protobuf/protobuf-
>>>> 31.0/upb/reflection/def.h:12,
>>>> from /sources/protobuf/protobuf-
>>>> 31.0/upb/reflection/def.hpp:26,
>>>> from /sources/protobuf/protobuf-
>>>> 31.0/upb_generator/minitable/generator.h:9,
>>>> from /sources/protobuf/protobuf-
>>>> 31.0/src/google/protobuf/compiler/main.cc:20:
>>>> /sources/protobuf/protobuf-
>>>> 31.0/upb/reflection/descriptor_bootstrap.h:14:10: fatal error:
>>>> google/protobuf/descriptor.upb.h: No such file or directory
>>>> 14 | #include "google/protobuf/descriptor.upb.h"
>>>
>>> This was the original error building with -D
>>> protobuf_BUILD_LIBUPB=OFF
>>> IIRC. My patch still doesn't fix it. It just removes libupb from
>>> the
>>> installation (and also the protobuf-targets.cmake file).
>>
>> You are right. This is the same error. But if protobuf is already
>> installed, this file is in /usr/include/protobuf, and then there is
>> another error: -llibpub is not found during the final linking of
>> libprotoc.
>
> This seems unclear to me. What is "-llibpub"?
Sorry -llibupb :(
>
> protobuf-31.0 just builds fine with the patch and the book instructions.
> libupb.a is still built but not installed. So when does the error show
> up?
>
Nope it does not build with the patch you proposed above if it is not already
installed (so that /usr/include/google/protobuf/descriptor.upb.h is installed
and is found). If you apply the patch and protobuf is not already installed,
then the error `#include "google/protobuf/descriptor.upb.h" no such file or
directory' occurs. Sorry for not being clear.
>> It seems upstream will completely remove the dependency of libprotoc on
>> libupb for protobuf-32, due in July [1]. Until then, I suggest just
>> removing the line "rm /usr/lib/libupb.a" in our install instructions,
>> so that Qt be buildable when protobuf is installed, and revisit this in
>> July...
>>
>> We could also downgrade to protobuf-30...
>
> Or disable protobuf when building Qt. I'd say Google has completely
> made the protobuf/grpc things a mess.
>
>
--
http://lists.linuxfromscratch.org/sympa/info/blfs-dev
Unsubscribe: See the above information page