[Bug 2063950] Re: duplicate JsonCpp::JsonCpp leads to build failures
Timo Aaltonen
2063950 at bugs.launchpad.net
Fri May 3 10:19:02 UTC 2024
Hello dann, or anyone else affected,
Accepted libjsoncpp into jammy-proposed. The package will build now and
be available at
https://launchpad.net/ubuntu/+source/libjsoncpp/1.9.5-3ubuntu0.1 in a
few hours, and then in the -proposed repository.
Please help us by testing this new package. See
https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how
to enable and use -proposed. Your feedback will aid us getting this
update out to other Ubuntu users.
If this package fixes the bug for you, please add a comment to this bug,
mentioning the version of the package you tested, what testing has been
performed on the package and change the tag from verification-needed-
jammy to verification-done-jammy. If it does not fix the bug for you,
please add a comment stating that, and change the tag to verification-
failed-jammy. In either case, without details of your testing we will
not be able to proceed.
Further information regarding the verification process can be found at
https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in
advance for helping!
N.B. The updated package will be released to -updates after the bug(s)
fixed by this package have been verified and the package has been in
-proposed for a minimum of 7 days.
** Changed in: libjsoncpp (Ubuntu Jammy)
Status: In Progress => Fix Committed
** Tags added: verification-needed verification-needed-jammy
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to libjsoncpp in Ubuntu.
https://bugs.launchpad.net/bugs/2063950
Title:
duplicate JsonCpp::JsonCpp leads to build failures
Status in libjsoncpp package in Ubuntu:
Fix Released
Status in libjsoncpp source package in Jammy:
Fix Committed
Status in libjsoncpp source package in Mantic:
Fix Released
Status in libjsoncpp source package in Noble:
Fix Released
Bug description:
[Impact]
Users trying to build software that links w/ jammy's libjsoncpp library will hit a build failure if that software uses cmake and another library that also requires libjsoncpp because libjsoncpp's cmake config does not protect against duplicate imports. This can be reproduced by building a a newer version of cmake itself using system libjsoncpp (I was trying to build 3.27.4, but I also checked that it impacts cmake master).
[Test Case]
This can be demonstrated by calling find_package twice in a row:
$ mkdir test && cd test
$ cat > CMakeLists.txt << EOF
project(test)
find_package(jsoncpp 1.9.5)
find_package(jsoncpp 1.9.5)
EOF
$ cmake .
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/jsoncpp/jsoncpp-namespaced-targets.cmake:5 (add_library):
add_library cannot create imported target "JsonCpp::JsonCpp" because
another target with the same name already exists.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/jsoncpp/jsoncppConfig.cmake:41 (include)
CMakeLists.txt:3 (find_package)
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.22)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/test/CMakeFiles/CMakeOutput.log".
[Fix]
Backport a fix from mantic that adds a guard in the .cmake file.
[ What Could Go Wrong ]
We could cause reverse dependencies to fail to build from source due to an inadvertent error. We can mitigate this by doing a test rebuild of the reverse dependencies, which I've done in a PPA:
https://launchpad.net/~dannf/+archive/ubuntu/libjsoncpp-sru-test/+packages
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libjsoncpp/+bug/2063950/+subscriptions
More information about the foundations-bugs
mailing list