You are not logged in.

#1 2021-07-14 03:08:57

Zaedus
Member
Registered: 2021-07-14
Posts: 9

Linking error occurs only in PKGBUILD fakeroot

I have a PKGBUILD which just runs make, but I ran into an issue where a library I depended on was in the AUR, so I created a git submodule, built the .so, and then added the proper c flags and linker flags which worked perfectly until I tried to build it with my PKGBUILD. I first tried to init the submodules with `git submodule update --init --recursive` in the PKGBUILD, and then settled on building it in the Makefile both worked in cloning the submodule, but failed on compilation. I've built it successfully outside of the fakeroot in many different shells. Here is the expected output, the PKGBUILD output, and my PKGBUILD.

Expected output:

$ make
git submodule update --init --recursive
Submodule 'deps/curlpp' (https://github.com/jpbarrette/curlpp.git) registered for path 'deps/curlpp'
Submodule path 'deps/curlpp': checked out '02e4a60e7d541bbfd11bf21bbb76bd584863b5df'
cd deps/curlpp; \
cmake .; \
make;
-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.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
-- curlpp version=[0.8.1]
-- curlpp version num=[000801]
-- Looking for CURL
-- Found CURL: /usr/lib/libcurl.so (found version "7.77.0")  
-- Found CURL version: 7.77.0
-- Using CURL include dir(s): /usr/include
-- Using CURL lib(s): /usr/lib/libcurl.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zaedus/Documents/RiceLinux/riceman/deps/curlpp
make[1]: Entering directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'
make[2]: Entering directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'
make[3]: Entering directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'
make[3]: Leaving directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'
make[3]: Entering directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'
[  3%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/Easy.cpp.o
[  7%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/Exception.cpp.o
[ 11%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/Form.cpp.o
[ 15%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/Info.cpp.o
[ 19%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/Multi.cpp.o
[ 23%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/OptionBase.cpp.o
[ 26%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/Options.cpp.o
[ 30%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/cURLpp.cpp.o
[ 34%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/internal/CurlHandle.cpp.o
[ 38%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/internal/OptionList.cpp.o
[ 42%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/internal/OptionSetter.cpp.o
[ 46%] Building CXX object CMakeFiles/curlpp_static.dir/src/curlpp/internal/SList.cpp.o
[ 50%] Linking CXX static library libcurlpp.a
make[3]: Leaving directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'
[ 50%] Built target curlpp_static
make[3]: Entering directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'
make[3]: Leaving directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'
make[3]: Entering directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'
[ 53%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/Easy.cpp.o
[ 57%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/Exception.cpp.o
[ 61%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/Form.cpp.o
[ 65%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/Info.cpp.o
[ 69%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/Multi.cpp.o
[ 73%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/OptionBase.cpp.o
[ 76%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/Options.cpp.o
[ 80%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/cURLpp.cpp.o
[ 84%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/internal/CurlHandle.cpp.o
[ 88%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/internal/OptionList.cpp.o
[ 92%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/internal/OptionSetter.cpp.o
[ 96%] Building CXX object CMakeFiles/curlpp.dir/src/curlpp/internal/SList.cpp.o
[100%] Linking CXX shared library libcurlpp.so
make[3]: Leaving directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'
[100%] Built target curlpp
make[2]: Leaving directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'
make[1]: Leaving directory '/home/zaedus/Documents/RiceLinux/riceman/deps/curlpp'

PKGBUILD output:

git submodule update --init --recursive
Submodule 'deps/curlpp' (https://github.com/jpbarrette/curlpp.git) registered for path 'deps/curlpp'
Cloning into '/home/zaedus/Documents/RiceLinux/ricelinux-pkgs/build/0/src/riceman/deps/curlpp'...
Submodule path 'deps/curlpp': checked out '02e4a60e7d541bbfd11bf21bbb76bd584863b5df'
cd deps/curlpp; \
cmake .; \
make;
-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /usr/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler

    "/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/zaedus/Documents/RiceLinux/ricelinux-pkgs/build/0/src/riceman/deps/curlpp/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/make -f Makefile cmTC_c2509/fast && make[1]: Entering directory '/home/zaedus/Documents/RiceLinux/ricelinux-pkgs/build/0/src/riceman/deps/curlpp/CMakeFiles/CMakeTmp'
    /usr/bin/make  -f CMakeFiles/cmTC_c2509.dir/build.make CMakeFiles/cmTC_c2509.dir/build
    make[2]: Entering directory '/home/zaedus/Documents/RiceLinux/ricelinux-pkgs/build/0/src/riceman/deps/curlpp/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_c2509.dir/testCCompiler.c.o
    /usr/bin/cc   -Ideps/curlpp/include  -o CMakeFiles/cmTC_c2509.dir/testCCompiler.c.o -c /home/zaedus/Documents/RiceLinux/ricelinux-pkgs/build/0/src/riceman/deps/curlpp/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_c2509
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c2509.dir/link.txt --verbose=1
    /usr/bin/cc -Ideps/curlpp/include  -lcryptopp -lcurl  -Ldeps/curlpp -l:libcurlpp.so  -rdynamic CMakeFiles/cmTC_c2509.dir/testCCompiler.c.o -o cmTC_c2509 
    /usr/bin/ld: cannot find -l:libcurlpp.so
    collect2: error: ld returned 1 exit status
    make[2]: *** [CMakeFiles/cmTC_c2509.dir/build.make:99: cmTC_c2509] Error 1
    make[2]: Leaving directory '/home/zaedus/Documents/RiceLinux/ricelinux-pkgs/build/0/src/riceman/deps/curlpp/CMakeFiles/CMakeTmp'
    make[1]: *** [Makefile:127: cmTC_c2509/fast] Error 2
    make[1]: Leaving directory '/home/zaedus/Documents/RiceLinux/ricelinux-pkgs/build/0/src/riceman/deps/curlpp/CMakeFiles/CMakeTmp'
    
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)

-- Configuring incomplete, errors occurred!
See also "/home/zaedus/Documents/RiceLinux/ricelinux-pkgs/build/0/src/riceman/deps/curlpp/CMakeFiles/CMakeOutput.log".
See also "/home/zaedus/Documents/RiceLinux/ricelinux-pkgs/build/0/src/riceman/deps/curlpp/CMakeFiles/CMakeError.log".
make[1]: Entering directory '/home/zaedus/Documents/RiceLinux/ricelinux-pkgs/build/0/src/riceman/deps/curlpp'
make[1]: *** No targets specified and no makefile found.  Stop.
make[1]: Leaving directory '/home/zaedus/Documents/RiceLinux/ricelinux-pkgs/build/0/src/riceman/deps/curlpp'
make: *** [Makefile:28: deps/curlpp] Error 2

My PKGBUILD

# Maintainer: Zaedus <nintendozaedus@gmail.com>
pkgname='riceman'
pkgver=v1.0.0.r66.g38ecf4c
pkgrel=1
pkgdesc="The official rice manager for Rice Linux"
arch=("x86_64")
url="https://github.com/ricelinux/riceman"
license=('GPL')
groups=()
depends=()
makedepends=('gcc' 'git' 'curl' 'crypto++' 'cmake' 'make')
checkdepends=()
optdepends=()
provides=('riceman')
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=('riceman::git+https://github.com/ricelinux/riceman.git')
noextract=()
md5sums=('SKIP')
validpgpkeys=()

pkgver() {
	cd "$pkgname"
  	git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cd "$pkgname"
	make
}

package() {
	cd "$pkgname"
	install -Dm755 ./riceman "$pkgdir/usr/bin/riceman"
}

In one of the CMake error log files it says the following

/usr/bin/cc -Ideps/curlpp/include  -lcryptopp -lcurl  -Ldeps/curlpp -l:libcurlpp.so  -rdynamic CMakeFiles/cmTC_c2509.dir/testCCompiler.c.o -o cmTC_c2509 
/usr/bin/ld: cannot find -l:libcurlpp.so
collect2: error: ld returned 1 exit status

Not sure what is going on since this is my first time really running into a problem with makepkg, but if there is a better way of installing an AUR package as a dependency, or if you know what is going on please do share!
Thanks in advance!

Offline

#2 2021-07-14 11:24:25

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: Linking error occurs only in PKGBUILD fakeroot

The package should probably be called riceman-git , you also can remove all empty fields like backup=() .

Using git submodules in PKGBUILDs requires a custom setup, see https://wiki.archlinux.org/title/VCS_pa … submodules .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2021-07-14 16:06:19

loqs
Member
Registered: 2014-03-06
Posts: 17,307

Re: Linking error occurs only in PKGBUILD fakeroot

Zaedus wrote:

I have a PKGBUILD which just runs make, but I ran into an issue where a library I depended on was in the AUR, so I created a git submodule, built the .so, and then added the proper c flags and linker flags which worked perfectly until I tried to build it with my PKGBUILD.

Not sure what is going on since this is my first time really running into a problem with makepkg, but if there is a better way of installing an AUR package as a dependency, or if you know what is going on please do share!

Why did you not add it depends?  The link fails as the library is not installed yet,  so you would need to pass the location to the linker.

Offline

#4 2021-07-14 17:11:05

Zaedus
Member
Registered: 2021-07-14
Posts: 9

Re: Linking error occurs only in PKGBUILD fakeroot

loqs wrote:
Zaedus wrote:

I have a PKGBUILD which just runs make, but I ran into an issue where a library I depended on was in the AUR, so I created a git submodule, built the .so, and then added the proper c flags and linker flags which worked perfectly until I tried to build it with my PKGBUILD.

Not sure what is going on since this is my first time really running into a problem with makepkg, but if there is a better way of installing an AUR package as a dependency, or if you know what is going on please do share!

Why did you not add it depends?  The link fails as the library is not installed yet,  so you would need to pass the location to the linker.

Since the package I depend on, libcurlpp, is only available in the AUR, I need to build and install it manually along with my package.

Last edited by Zaedus (2021-07-14 17:11:22)

Offline

#5 2021-07-14 17:37:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,517
Website

Re: Linking error occurs only in PKGBUILD fakeroot

Zaedus wrote:

Since the package I depend on, libcurlpp, is only available in the AUR...

This is common - and the proper course of action is not to do any such git submodule or try to build the dependency as part of your PKGBUILD.  You just list it as a dependency.  That's it.

Then when you want to install your package, you build and install the dependency (libcurlpp) first.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2021-07-14 18:04:08

Zaedus
Member
Registered: 2021-07-14
Posts: 9

Re: Linking error occurs only in PKGBUILD fakeroot

Trilby wrote:
Zaedus wrote:

Since the package I depend on, libcurlpp, is only available in the AUR...

This is common - and the proper course of action is not to do any such git submodule or try to build the dependency as part of your PKGBUILD.  You just list it as a dependency.  That's it.

Then when you want to install your package, you build and install the dependency (libcurlpp) first.

Well I think for the sake of consistency, I shouldn't expect that the end user know to install libcurlpp prior to installing my program. I mean there has to be a way to install it as a dependency despite it being from the AUR.

Last edited by Zaedus (2021-07-14 18:04:42)

Offline

#7 2021-07-14 18:38:20

Zaedus
Member
Registered: 2021-07-14
Posts: 9

Re: Linking error occurs only in PKGBUILD fakeroot

Lone_Wolf wrote:

The package should probably be called riceman-git , you also can remove all empty fields like backup=() .

Using git submodules in PKGBUILDs requires a custom setup, see https://wiki.archlinux.org/title/VCS_pa … submodules .

Okay, this helped a lot. I looked at the wiki link you sent and instead built the submodules in the prepare() function instead, and now it builds successfully! Thank you!

Offline

#8 2021-07-14 19:47:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,517
Website

Re: Linking error occurs only in PKGBUILD fakeroot

Zaedus wrote:

Well I think for the sake of consistency, I shouldn't expect that the end user know to install libcurlpp prior to installing my program.

You should expect it if you list it in the depends array - that's what that's for!

Zaedus wrote:

I mean there has to be a way to install it as a dependency despite it being from the AUR.

There is.  `makepkg -si --asdeps`.

Last edited by Trilby (2021-07-14 19:48:04)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#9 2021-07-14 21:01:07

Zaedus
Member
Registered: 2021-07-14
Posts: 9

Re: Linking error occurs only in PKGBUILD fakeroot

Thank you for all of your help Trilby! So here's the route that I decided to go. Instead of compiling curlpp into a dynamic library I just added it's include folder to the include path and then compiled all of the source files along with my source files. This way I don't need to worry about installing the dynamic library and all the potential problems that could arise from that (ex: someone tries to install the curlpp AUR package). Again, thank you!

Offline

#10 2021-07-14 21:26:58

loqs
Member
Registered: 2014-03-06
Posts: 17,307

Re: Linking error occurs only in PKGBUILD fakeroot

The PKGBUILD pinned to the last commit before you added curlpp as a submodule

# Maintainer: Zaedus <nintendozaedus@gmail.com>
pkgname='riceman-git'
pkgver=v1.0.0.r60.g4d502eb
pkgrel=1
pkgdesc="The official rice manager for Rice Linux"
arch=("x86_64")
url="https://github.com/ricelinux/riceman"
license=('GPL')
depends=('fmt' 'crypto++' 'libcurlpp')
makedepends=('git' 'make')
provides=('riceman')
conflicts=('riceman')
source=('git+https://github.com/ricelinux/riceman.git#commit=4d502eb152d71e260f42935f7b244844ac168f7e')
md5sums=('SKIP')

pkgver() {
	cd riceman
  	git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cd riceman
	make
}

package() {
	cd riceman
	install -Dm755 ./riceman "$pkgdir/usr/bin/riceman"
}

Last edited by loqs (2021-07-14 21:27:30)

Offline

Board footer

Powered by FluxBB