libgit2 / libgit2/rugged

rugged will not be linked correctly when built in a path containing a whitespace, problem with pkg-config?

Open
#772 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
2.3k
Forks
293
PR merge metrics
No merged PRs in 30d

Description

Rugged will not be linked correctly when you build it in a path containing a whitespace, you will get undefined symbol errors.

git submodule update --init
Submodule 'vendor/libgit2' (https://github.com/libgit2/libgit2.git) registered for path 'vendor/libgit2'
Cloning into '/home/wiebelt/Projects/spa tie/rugged/vendor/libgit2'...
Submodule path 'vendor/libgit2': checked out '838a2f2918b6d9fad8768d2498575ff5d75c35f0'
mkdir -p tmp/x86_64-linux/rugged/2.5.3
cd tmp/x86_64-linux/rugged/2.5.3
/usr/bin/ruby -I. ../../../../ext/rugged/extconf.rb
checking for gmake... yes
checking for cmake... yes
checking for pkg-config... yes
-- cmake .. -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo
-- /usr/bin/gmake
Package /home/wiebelt/Projects/spa was not found in the pkg-config search path.
Perhaps you should add the directory containing `/home/wiebelt/Projects/spa.pc'
to the PKG_CONFIG_PATH environment variable
Package '/home/wiebelt/Projects/spa', required by 'virtual:world', not found
Package 'tie/rugged/ext/rugged/../../vendor/libgit2/build/libgit2.pc', required by 'virtual:world', not found
checking for -lgit2... yes
checking for git2.h... yes
creating Makefile
cd -
cd tmp/x86_64-linux/rugged/2.5.3
/usr/bin/gmake
gcc -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I../../../../ext/rugged -DHAVE_GIT2_H "-I/home/wiebelt/Projects/spa tie/rugged/ext/rugged/../../vendor/libgit2/include" -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -g -Wall -Wno-comment -m64 -o rugged.o -c ../../../../ext/rugged/rugged.c
... and it will compile just fine ...

When i run pkg-config by hand it seems like it does not handle quotes (single or double), using a backslash to escape the whitespace doesn't work either.

pkg-config --libs --static "/var/lib/jenkins/bui ld/rugged/ext/rugged/../../vendor/libgit2/build/libgit2.pc"
Package /var/lib/jenkins/bui was not found in the pkg-config search path.
Perhaps you should add the directory containing `/var/lib/jenkins/bui.pc'
to the PKG_CONFIG_PATH environment variable
No package '/var/lib/jenkins/bui' found
Failed to open 'ld/rugged/ext/rugged/../../vendor/libgit2/build/libgit2.pc': No such file or directory
No package 'ld/rugged/ext/rugged/../../vendor/libgit2/build/libgit2.pc' found

So it seems like it's a bug in pkg-config but i dont know enough of that tool to know for sure, is it being used correctly? Could someone help file a bug report there?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The reproduction runs ext/rugged/extconf.rb and builds the vendored libgit2 under vendor/libgit2; start by tracing how that entry point passes paths to pkg-config and CMake. Reproduce the build from a directory containing whitespace and compare it with the manual pkg-config commands. Done means the build links successfully from such a path, or the dependency behavior is documented with an actionable project change identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cmake, ruby
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.