Open mMerlin opened 4 years ago
I think the workaround is the only way to go. It is good to be aware of this, however, and maybe it is possible to add a check and a warning in the .pri file.
Is this the same as this problem?
@mMerlin I have being trying to build on Linux and faced similar issues :tired_face: l can build the static version of libgit2, Fritzing finds the lib, but the build still fails. This happens because static libraries (in our case libgit2) need to be manually linked to external dependencies (e.g., http_parser) when building the Qt project. I will file a pull request for closing this issue. The trick is to pass the external libraries (e.g., http_parser, ssh) during the qmake phase by adding those libraries to the LIBS variables.
@KjellMorgenstern Fixing this issue should also make it easy for people to build on Linux by simply following the wiki instructions and hopefully save some struggling and frustrating moments :wink:
Another approach is to build using dynamic library on Linux, see here.
@Why-not-now this may be a similar issue, are you building on Win or Linux?
@janclod does yout patch handle using the installed parser, when it exists, and falling back to the bundled version when it does not? I think the extra library needs to be conditionally included. Not always.
@mMerlin well spotted! I was a bit too quick :sweat_smile: my patch allows static libgit2 to find the http_parser when libgit2 is built in the presence of http_parser. When libgit2 is built on a machine in the absence of http_parser, the build indeed fails. If it is possible, I will try to add conditional addition of http_parser and update the pull request.
@mMerlin after some more testing I have to admit that I was definitely too naive when thinking this issue would be easy to fix :sweat: I tried to build my code inside the Docker container fritzing/build:bionic... the build breaks :weary: My two cents:
LIBS
variable does not contain -lssh2
(check manipulation of the LIBS
variable in the libgit2detect.pri
file)LIBS
variable contain -lssh2
(check manipulation of the LIBS
variable in the libgit2detect.pri
file)In the meantime I did update the code to allow for building on different distributions (e.g., bionic, focal) and different setups (e.g. w/ or w/o http_parser installed in the system).
I tested this on fritzing/build:bionic and my own focal distro. The build works :partying_face:
Perhaps one more test should be to build inside the fritzing/build:fedora?
The pull request should allow for building fritzing both in the presence and absence of http_parser lib.
The code successfully builds on:
Current Behaviour
While setting up the Qt Creator environment to build/run/debug Fritzing, I was reviewing the build information for libgit2. I noticed that it was using the bundled code for the http parser, even though http-parse was one of the dependencies included for libgit2-devel. So I tried installing http-parser-devel. That got the libgit2 build to show that it was no longer using the bundled code, BUT, when later attempting to build the phoenix project, I got a bunch or error messages just before the build failed.
It appears that the libgit build references the external http-parser library, but that the Fritzing build does not notice that, does not include the library in its build. Some research on the Internet found the same case for another project -- cargo build fails with undefined references to http-parser functions -- from 5+ years ago. Looking at the commits linked to that did not tell me what the real fix was, since that seems to be just updating versions for dependencies. Have to dig further down the chain to see what was needed. I expect it just needs an extra library passed to the linker, but need to also know when that is needed.
Operating System:
Fedora 31 workstation boost_1_72_0 libgit2 v0.28.4 Qt 5.12.7
Steps to reproduce:
Expected Behaviour
The Fritzing build should work whether libgit2 is built with the bundled or external http-parser functions.
Workaround
For now, just DONT have http-parser-devel installed when building libgit2