You are not logged in.

#1 2023-11-19 13:51:29

contle
Member
Registered: 2023-11-19
Posts: 5

dependency problems when trying to create AUR package

My first try of creating a package.
SimTK's OpenSim (not the VR OpenSimulator) has a build script for Ubuntu and Debian that I was able to edit until it compiled, I expected it to be harder actually.

This process pulls a bunch of dependencies into a build subfolder and uses them during the process. I thought, I could create a package with the Arch way of
- install dependencies in the system (this I managed) and
- use them when installing something else

My trial failed on a few spots, and I just don't understand how is it possible.
1) the same cmake system accepts or refuses the line of
set_target_properties(tropter PROPERTIES LINK_FLAGS ${IPOPT_LDFLAGS})
when the value seems to be the same "list" format

2) the same c++ compiler can or cannot compile the same source with slightly different configuration

I think problem 1 can be solved by patching the CMakeLists.txt with the set_property function instead, but I'm quite stuck on he other.

Any ideas how to debug and solve?

Offline

#2 2023-11-19 14:39:28

ectospasm
Member
Registered: 2015-08-28
Posts: 292

Re: dependency problems when trying to create AUR package

Please post the full contents of your PKGBUILD in a code block, and also post the output when you run makepkg -s.

Offline

#3 2023-11-19 15:25:12

contle
Member
Registered: 2023-11-19
Posts: 5

Re: dependency problems when trying to create AUR package

pkgname=opensim-core-git
pkgver=4.3.r808.c19474ec8
pkgrel=1
pkgdesc="OpenSim"
arch=('x86_64')
license=('Apache 2.0')
depends=('cmake' 'autoconf' 'pkg-config' 'automake' 'openblas' 'lapack' 'freeglut' 'libxi' 'libxmu' 'doxygen' 'python' 'python-numpy' 'python-setuptools' 'pcre' 'byacc' 'git' 'gcc-fortran' 'libtool' 'openssl' 'libffi' 'ninja' 'patchelf' 'jdk8-openjdk' 'swig' 'adol-c' 'colpack' 'docopt' 'eigen' 'coin-or-ipopt' 'simbody' 'ezc3d' 'spdlog')
optdepends=('casadi')
source=("git+https://github.com/opensim-org/opensim-core.git#commit=c19474ec828fb9c742827cb375dc7ff798b6e1c1")
md5sums=('SKIP')

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

build() {
	DEBUG_TYPE="Release"
	NUM_JOBS=8 # number of jobs
	MOCO="on"
# 	GENERATOR="Ninja"
	GENERATOR="Unix Makefiles"
	cd "$srcdir/.."
	mkdir -p build
	cd build
	cmake "$srcdir/${pkgname%-git}" -G"$GENERATOR" -DBUILD_JAVA_WRAPPING=on -DBUILD_PYTHON_WRAPPING=on -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=off -DCMAKE_INSTALL_PREFIX=$pkgdir -DOPENSIM_INSTALL_UNIX_FHS=off -DSWIG_DIR=/usr/share/swig -DSWIG_EXECUTABLE=/usr/bin/swig -DSIMBODY_HOME=/usr/lib/cmake/simbody -DColPack_DIR=/usr/lib
	cmake . -LAH
	cmake --build . --config $DEBUG_TYPE -j$NUM_JOBS
	cmake --install .
}

package() {
	cd "$srcdir/${pkgname%-git}"
	make DESTDIR="$pkgdir/" install
}

Last edited by contle (2023-11-19 17:44:57)

Offline

#4 2023-11-19 16:55:39

contle
Member
Registered: 2023-11-19
Posts: 5

Re: dependency problems when trying to create AUR package

The one with the patch:

pkgname=opensim-core-git
pkgver=4.3.r808.c19474ec8
pkgrel=1
pkgdesc="openSim"
arch=('x86_64')
license=('Apache 2.0')
depends=('openblas' 'lapack' 'freeglut' 'libxi' 'libxmu' 'doxygen' 'python' 'python-numpy' 'pcre' 'byacc' 'openssl' 'libffi' 'patchelf' 'jdk8-openjdk' 'swig' 'adol-c' 'colpack' 'eigen' 'coin-or-ipopt' 'simbody' 'ezc3d' 'spdlog')
optdepends=('casadi')
makedepends=('cmake' 'autoconf' 'pkg-config' 'automake' 'git' 'python-setuptools' 'gcc-fortran' 'libtool' 'ninja' 'docopt')
source=("git+https://github.com/opensim-org/opensim-core.git#commit=c19474ec828fb9c742827cb375dc7ff798b6e1c1")
md5sums=('SKIP')

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

prepare() {
	cd "$srcdir/${pkgname%-git}"
	sed -i 's+{ezc3d_DIR}/../../..+{ezc3d_DIR}/..+g' CMakeLists.txt
	sed -i 's+ezc3d_LIBRARY_DIR "${ezc3d_ROOT_DIR}/lib"+ezc3d_LIBRARY_DIR ${ezc3d_ROOT_DIR}+g' CMakeLists.txt
	sed -i 's+ezc3d_INCLUDE_DIR "${ezc3d_ROOT_DIR}/include"+ezc3d_INCLUDE_DIR "${ezc3d_ROOT_DIR}/cmake"+g' CMakeLists.txt
	sed -i 's+set_target_properties(tropter PROPERTIES LINK_FLAGS ${IPOPT_LDFLAGS})+set_property(TARGET tropter PROPERTY LINK_FLAGS ${IPOPT_LDFLAGS})+g' Vendors/tropter/tropter/CMakeLists.txt
}

build() {
	DEBUG_TYPE="Release"
	NUM_JOBS=8 # number of jobs
	MOCO="on"
# 	GENERATOR="Ninja"
	GENERATOR="Unix Makefiles"
	cd "$srcdir/.."
	mkdir -p build
	cd build
	cmake "$srcdir/${pkgname%-git}" -G"$GENERATOR" -DBUILD_JAVA_WRAPPING=on -DBUILD_PYTHON_WRAPPING=on -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=off -DCMAKE_INSTALL_PREFIX=$pkgdir -DOPENSIM_INSTALL_UNIX_FHS=off -DSWIG_DIR=/usr/share/swig -DSWIG_EXECUTABLE=/usr/bin/swig -DSIMBODY_HOME=/usr/lib/cmake/simbody -DColPack_DIR=/usr/lib
	cmake . -LAH
	cmake --build . --config $DEBUG_TYPE -j$NUM_JOBS
	cmake --install .
}

package() {
	cd "$srcdir/${pkgname%-git}"
	make DESTDIR="$pkgdir/" install
}

Output #1 when it stucks in config
https://gist.github.com/contle/517ec5a8 … eaf256a29d

Output #2 when I patch* the makefiles and it starts compiling
https://gist.github.com/contle/c10f76a4 … f053b85d0e

*The patches are
- fixing the ezc3d path, because the aur package has slightly different structure
- changing set_target_properties to set_property
the latter might not fix that dependency, but the compilation error doesn't seem to be connected

Last edited by contle (2023-11-19 17:53:47)

Offline

#5 2023-11-19 17:12:49

ectospasm
Member
Registered: 2015-08-28
Posts: 292

Re: dependency problems when trying to create AUR package

So, things like cmake and autoconf are likely makedepends, not depends.  You should only place runtime dependencies in depends=(), and leave everything that opensim-core-git needs to build in makedepends=().  And don't use pastebin.com for pastes, use GitHub gists, or paste.rs, ix.io, or any of the other pastebins recommended on the IRC channels.  pastebin.com has been known to push malware, and is generally not considered safe to use.  So I'm not looking at your output until you put it somewhere else.

Instead of using sed to modify CMakeLists.txt, why not modify the file the way you want, and generate a patch with diff -u, and supply the patch along with your PKGBUILD, and use the patch command to apply the patch?

Offline

#6 2023-11-19 17:56:55

contle
Member
Registered: 2023-11-19
Posts: 5

Re: dependency problems when trying to create AUR package

I updated the posts above.

I used sed, because the wiki suggested it for small changes.

Offline

#7 2023-11-19 18:48:45

ectospasm
Member
Registered: 2015-08-28
Posts: 292

Re: dependency problems when trying to create AUR package

So, here's what I see in the two runs:

  1. The first one likely fails because of the errors on line 921 and 91 of CMakeLists.txt, you have to scroll up to see them.  I see the one on line 91 is the set_target_properties  error, you likely need to fix it for set_target_properties as set_property (singular) is likely causing problems during the compilation.  For the error on line 921, I would avoid relative paths if possible, so a /path/like/this/deep/subdirectory/../../other/path would essentially expand to /path/like/this/other/path.  Using the relative parent directory .. like that is prone to error, and rather brittle should the directory structure change at all.

  2. The second one gives you a hint, you need to add -fPIC to the linker flags.  You should probably explicitly state your CXXFLAGS and LDFLAGS (including -fPIC).  The docuementation for OpenSIM recommends building everything (including depends=() and makedepends=()) with the same CMAKE_BUILD_TYPE (which is not guaranteed if you're installing packages from core or extra).

Have you installed OpenSIM using your GitHub link manually?  You'll likely run into the same or similar issues if you do it outside of the PKGBUILD/makepkg process.  I wouldn't try drafting the PKGBUILD until you can get it compiled and working manually.  Basically, keep track of all the packages you have to install just to build it manually, and determine which ones are necessary only for building it (many of them are already part of the base-devel package).  Also keep track of which files you need to modify (like CMakeLists.txt), and build patches for them once you get everything working. Follow Creating packages once you're ready to make the PKGBUILD.

If you can't get it built outside of makepkg/PKGBUILD, work with upstream support until you get it compiled and running.  Once you get it compiled and running, you can run ldd against the main OpenSIM executable to determine which runtime libraries it uses, and ensure you populate the depends=() with the packages that provide those libraries.

Last edited by ectospasm (2023-11-19 18:50:28)

Offline

#8 2023-11-19 19:28:11

loqs
Member
Registered: 2014-03-06
Posts: 18,131

Re: dependency problems when trying to create AUR package

license=('Apache 2.0')

The SPDX identifier uses a dash https://spdx.org/licenses/Apache-2.0.html

source=("git+https://github.com/opensim-org/opensim-core.git#commit=c19474ec828fb9c742827cb375dc7ff798b6e1c1")

I assume this is just for testing and you will unpin the commit at a later point?

autoconf,  pkg-config, automake,  libtool are all covered by base-devel as noted by ectospasm.  I would expect swig and patchelf to be makedepends.

optdepends=('casadi')

Also needs to be in makedepends or cmake fails.  Adding it to makedepends the build then fails for me with:

CMake Error at Vendors/tropter/CMakeLists.txt:67 (find_package):
  Could not find a package configuration file provided by "ColPack"
  (requested version 1.0.10) with any of the following names:

    ColPackConfig.cmake
    colpack-config.cmake

  Add the installation prefix of "ColPack" to CMAKE_PREFIX_PATH or set
  "ColPack_DIR" to a directory containing one of the above files.  If
  "ColPack" provides a separate development package or SDK, be sure it has
  been installed.


-- Configuring incomplete, errors occurred!

Offline

#9 2023-11-19 22:56:41

yochananmarqos
Member
Registered: 2020-02-05
Posts: 212

Re: dependency problems when trying to create AUR package

Upstream is using their own fork for colpack, see dependencies/CMakeLists.txt. One would have to create a custom package for it and call it something like colpack-opensim-git.

Offline

#10 2023-11-25 06:54:52

contle
Member
Registered: 2023-11-19
Posts: 5

Re: dependency problems when trying to create AUR package

Finally I chose the recommendation with the original build process that pulls and compiles its dependencies.

Now I'm on the -gui package that is giving me new problems to solve, I'll ask if I don't manage.

Thank you for the help.

Offline

Board footer

Powered by FluxBB