You are not logged in.

#1 2019-02-16 15:39:56

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Seeking support for building a program from source

Hey there,

I´d like to ask for help when trying to build a program from source. I got the source from this repository https://bitbucket.org/mmasciola/map-plu … downloads/. I have found a makefile included. However, when running make I receive an error:

$ make
fatal: not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
gcc -m64 -g -shared -llapacke -o libmap-1.30.00.so  lmder.o dpmpar.o lmpar.o qrsolv.o enorm.o enorm_u.o qrfac.o simclist.o bstrlib.o bstraux.o freedata.o mapinit.o maperror.o lineroutines.o numeric.o outputstream.o mapapi.o lmroutines.o jacobian.o residual.o  -lm -llapacke 
/usr/bin/ld: cannot find -llapacke
collect2: error: ld returned 1 exit status
make: *** [makefile:80: all] Error 1

Does this mean that I have to rewrite the makefile? Or do I have to initialize a git repository first? I am felling completely stuck and up-side down.
The makefile looks like this:

#   Copyright (C) 2014 mdm                                     
#   map[dot]plus[dot]plus[dot]help[at]gmail                                
#                                                              
# Licensed to the Apache Software Foundation (ASF) under one   
# or more contributor license agreements.  See the NOTICE file 
# distributed with this work for additional information        
# regarding copyright ownership.  The ASF licenses this file   
# to you under the Apache License, Version 2.0 (the            
# "License"); you may not use this file except in compliance   
# with the License.  You may obtain a copy of the License at   
#                                                              
#   http://www.apache.org/licenses/LICENSE-2.0                 
#                                                              
# Unless required by applicable law or agreed to in writing,   
# software distributed under the License is distributed on an  
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       
# KIND, either express or implied.  See the License for the    
# specific language governing permissions and limitations            
# under the License.                                             

MAP_VER:=1.30.00

BITS = -m64
PLATFORM = $(shell uname -s)
VPATH = cminpack:simclist:bstring:lapack


ifeq ($(OS),Windows_NT)
  DEL_CMD   = del
  LIB_EXT   = dll
  CFLAGS    = $(BITS) -g -std=c99 -DMAP_DLL_EXPORTS -DCMINPACK_NO_DLL  -DNDEBUG -D_WINDOWS -D_USRDLL -D_MINGW
  LDFLAGS   = $(BITS) -g -shared -Wl,--export-all-symbols
  LIB_FLAGS :=
else
  PLATFORM = $(shell uname -s)
  DEL_CMD   = rm -rf
  GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always)

  ifeq ($(PLATFORM),Darwin)
    LIB_EXT   = dylib
    CC_TOOLS  = clang
    CFLAGS    = -g -O1 -fno-omit-frame-pointer -fPIC -D DEBUG -Icminpack -Isimclist
    LDFLAGS   = -g -dynamiclib
    LIB_FLAGS := -lm
  else ifeq ($(PLATFORM),Linux)
    LIB_EXT   = so
    CC_TOOLS  = gcc
    #CFLAGS    = -g -O1 -fsanitize=address -fno-omit-frame-pointer -fPIC -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\" -Icminpack -Isimclist
    #CFLAGS    = -g -fPIC -std=c99 -Wuninitialized -Wall -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\"
    CFLAGS    = $(BITS) -g -fPIC -std=c99 -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\" -D WITH_LAPACK
    LDFLAGS   = $(BITS) -g -shared -llapacke
    LIB_FLAGS := -lm -llapacke
  endif
endif

DEBUG     = 
OBJ       = lmder.o \
	dpmpar.o \
	lmpar.o \
	qrsolv.o \
	enorm.o \
	enorm_u.o \
	qrfac.o \
	simclist.o \
	bstrlib.o \
	bstraux.o \
	freedata.o \
	mapinit.o \
	maperror.o \
	lineroutines.o \
	numeric.o \
	outputstream.o \
	mapapi.o \
	lmroutines.o \
	jacobian.o \
	residual.o \


all : $(OBJ)
	$(CC_TOOLS) $(LDFLAGS) -o libmap-$(MAP_VER).$(LIB_EXT) $(DEBUG) $(OBJ) $(LIB_FLAGS) 

.c.o :
	$(CC_TOOLS) -c $(CFLAGS) $<

clean:
	$(DEL_CMD) *.$(LIB_EXT) *.o *~

memcheck:	
	valgrind --tool=memcheck --leak-check=yes python -E -tt ./main.py	

I guess this is a quite silly question, however I am a beginner in building programs from source. So I´d appreciate any supporrt.

Offline

#2 2019-02-16 15:45:09

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: Seeking support for building a program from source

1) It's expecting that you're building from a git clone, not from a tarball.
2) Your actual error is '/usr/bin/ld: cannot find -llapacke', meaning that you don't have the necessary deps installed, specifically liblapacke.so

Last edited by Scimmia (2019-02-16 15:46:44)

Offline

#3 2019-02-16 15:56:49

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: Seeking support for building a program from source

Thank you,

Scimmia wrote:

1) It's expecting that you're building from a git clone, not from a tarball.

Is there a way to solve this?
Would it make sense to instead of trying to build from the tarball, just clone it from github as Map++ is also a module of OpenFAST: https://github.com/OpenFAST/openfast/tr … es-ext/map

Scimmia wrote:

2) Your actual error is '/usr/bin/ld: cannot find -llapacke', meaning that you don't have the necessary deps installed, specifically liblapacke.so

Ok i got confused here. I had lapack installed and thus was wondering as I wasn´t aware that there is a C interface to LAPACK called lapacke.

Now the only error remaining, I think is from 1)

$ make
fatal: not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
gcc -m64 -g -shared -llapacke -o libmap-1.30.00.so  lmder.o dpmpar.o lmpar.o qrsolv.o enorm.o enorm_u.o qrfac.o simclist.o bstrlib.o bstraux.o freedata.o mapinit.o maperror.o lineroutines.o numeric.o outputstream.o mapapi.o lmroutines.o jacobian.o residual.o  -lm -llapacke 
/usr/bin/ld: cannot find -llapacke
collect2: error: ld returned 1 exit status
make: *** [makefile:80: all] Error 1

Offline

#4 2019-02-16 16:02:07

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

Re: Seeking support for building a program from source

The error is from 2 see Scimmia's quote and the error message make is still producing.  Have you installed the lapacke package?

Offline

#5 2019-02-16 16:04:30

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Seeking support for building a program from source

To help yourself troubleshoot, I highly recommend that you make a PKGBUILD for this and build it in a clean-chroot.  Doing so will help you insure you have the needed makedeps and deps as you troubleshoot failed build attempts, and it will help you learn about how Arch builds and packages software.  An added bonus is you can upload the PKGBUILD to the AUR when you're finished to potentially help others in the future.

Recommended reading:
https://wiki.archlinux.org/index.php/Makepkg
https://wiki.archlinux.org/index.php/De … lassic_way optionally: https://aur.archlinux.org/packages/clea … t-manager/

Last edited by graysky (2019-02-16 16:10:19)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2019-02-24 10:44:37

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: Seeking support for building a program from source

Thank you,
I did write an PKGBUILD before by help of several forum members. I wasn´t aware that I should also write a PKGBUILD always when the software is not in the official repositories. However, the last time I wrote that PKGBUILD and build it I missed to do it in a clean-chroot. I would like to do it now, in a proper way.

When following the wiki https://wiki.archlinux.org/index.php/De … lassic_way it says:

Edit ~/.makepkg.conf to set the packager name and any makeflags. Also adjust the mirrorlist in $CHROOT/root/etc/pacman.d/mirrorlist and enable the testing repository in $CHROOT/root/etc/pacman.conf, if desired.

That is where I am lacking. In my home directory there is no .makepkg.conf. Furthermore I am not sure if I should change the mirrorlist? Should I enable the testing repository? I think I don´t need it atm.

Edit:
Okay https://wiki.archlinux.org/index.php/Makepkg explains it.

~/.makepkg.conf

is user specific, while

/etc/makepkg.conf

acts global.

So there is no need for the

~/.makepkg.conf

if it is defined in /etc/makepkg.conf

However, I am wondering if the edits (packager name) shall be made in /etc/makepkg.conf or in the /home/user/chroot/root/etc/makepkg.conf?

EDIT 2:

In the meanwhile I am trying to configure the PKGBUILD where I got some questions:

1. I used the PKGBUILD which I made by help of different users in the respective thread: https://bbs.archlinux.org/viewtopic.php?id=241145
    However, upstream of the aforementioned code was on github. I guess the same rules for github apply as for bitbucket?
2. I am not sure where to find the pkgver here.
3. Where can I find the different dependencies for this package?
4. For the OpenFAST PKGBUILD which I wrote as described in https://bbs.archlinux.org/viewtopic.php?id=241145 Different testing utilities where included. Also MAP++ offers testing utilities. But I don´t know how to write that into the PKGBUILD.



# Maintainer: funkaddict <funkaddict@gmx.de>

_pkgname=map-plus-plus
pkgname=${_pkgname}-git
pkgver=v1.20.10
pkgrel=1
pkgdesc="Standalone Mooring Analysis Program is a library to model static loads and geometry of cables"
arch=('x86_64')
url="https://bitbucket.org/mmasciola/${_pkgname}"
license=('Apache')
depends=('lapack' 'blas')
makedepends=('git' 'gcc-fortran' 'cmake' 'python' 'hdf5' 'yaml-cpp')
checkdepends=('python-numpy')
optdepends=('python' 'hdf5' 'yaml-cpp')

source=("$pkgname::git+https://bitbucket.org/mmasciola/${_pkgname}"
	'git+https://github.com/openfast/r-test'
        'git+https://github.com/Goddard-Fortran-Ecosystem/pFUnit')
md5sums=('SKIP'
	 'SKIP'
	 'SKIP')
provides=(${_pkgname})
conflicts=(${_pkgname})

prepare() {
  cd ${pkgname}
  git submodule init
  git config submodule.r-test.url "{$srcdir}"/r-test
  git config submodule.pFUnit.url "{$srcdir}"/pFUnit
  git submodule update --init --recursive
}

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

build() {
	mkdir -p ${pkgname}/build
	cd ${pkgname}/build
	cmake ../ \
	 -DCMAKE_INSTALL_PREFIX=/usr \
	 -DBUILD_DOCUMENTATION=ON \
	 -DBUILD_SHARED_LIBS=ON \
	 -DBUILD_TESTING=ON

	make -j 8
}

check() {
	cd "$pkgname/build"
	make test  || true
}

package() {
	cd "$pkgname/build"
	make DESTDIR="$pkgdir/" install
}

Last edited by funkaddict (2019-02-24 11:52:38)

Offline

#7 2019-02-24 12:49:46

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

Re: Seeking support for building a program from source

Edit : openfast thread was a fun thread to cooperate in, hope this one becomes as enjoyable.


map++ doesn't appear to use submodules, remove the lines related to r-test & pFUnit .

1.

However, upstream of the aforementioned code was on github. I guess the same rules for github apply as for bitbucket?

git IS NOT github .
Those rules are not dependent on where the sourcecode is hosted, but on the type of version control system the sourcecode is stored in.
Openfast and MAP++ both use git as their VCS so follow the same rules.

2.
pkgver() for vcs packages is often trial and error to get right.
leave as-is for now.

3 + 4 .
there doesn't appear to be much documentation about building included.
Check install.sh , that cds into src then executes make clean/make .
It also runs a test.

look at src/makefile , it gives several clues about dependencies.

Last edited by Lone_Wolf (2019-02-24 12:52:16)


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

#8 2019-02-24 14:32:49

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: Seeking support for building a program from source

Lone_Wolf wrote:

Edit : openfast thread was a fun thread to cooperate in, hope this one becomes as enjoyable.

Indeed, I really enjoyed your support. I most recently rebuild and compiled the newest OpenFAST version. It does fun to make it on my own. My colleagues always have to wait as they are depending on the prebuild windows executables wink

Lone_Wolf wrote:

map++ doesn't appear to use submodules, remove the lines related to r-test & pFUnit .

1.

However, upstream of the aforementioned code was on github. I guess the same rules for github apply as for bitbucket?

git IS NOT github .
Those rules are not dependent on where the sourcecode is hosted, but on the type of version control system the sourcecode is stored in.
Openfast and MAP++ both use git as their VCS so follow the same rules.

2.
pkgver() for vcs packages is often trial and error to get right.
leave as-is for now.

3 + 4 .
there doesn't appear to be much documentation about building included.
Check install.sh , that cds into src then executes make clean/make .
It also runs a test.

look at src/makefile , it gives several clues about dependencies.

In the makefile it reads

MAP_VER:=1.30.00

So I changed the version in my PKGBUILD accordingly.

Furthermore it reads

else ifeq ($(PLATFORM),Linux)
    LIB_EXT   = so
    CC_TOOLS  = gcc
    #CFLAGS    = -g -O1 -fsanitize=address -fno-omit-frame-pointer -fPIC -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\" -Icminpack -Isimclist
    #CFLAGS    = -g -fPIC -std=c99 -Wuninitialized -Wall -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\"
    CFLAGS    = $(BITS) -g -fPIC -std=c99 -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\" -D WITH_LAPACK
    LDFLAGS   = $(BITS) -g -shared -llapacke
    LIB_FLAGS := -lm -llapacke
  endif

So I assume

1.

CC_TOOLS  = gcc

means I need gcc.
2.

CFLAGS    = $(BITS) -g -fPIC -std=c99 -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\" -D WITH_LAPACK

-> I need lapack
3.

LIB_FLAGS := -lm -llapacke 

-> I need lapacke; What makes me wondere here is that lapacke is written with 2 ll in the makefile(?)

As you wrote in the OpenFAST thread:

Dependencies

gcc and make are in base-devel . Having base-devel group installed is a requirement  for building aur packages so those don't need to be mentioned.

-> So I wont write gcc into the dependencies.

Is that correct/did I overlook something?

Adding these to the PKGBUILD would make look it like this:

# Maintainer: funkaddict

_pkgname=map-plus-plus
pkgname=${_pkgname}-git
pkgver=v1.30.00
pkgrel=1
pkgdesc="Standalone Mooring Analysis Program is a library to model static loads and geometry of cables"
arch=('x86_64')
url="https://bitbucket.org/mmasciola/${_pkgname}"
license=('Apache')
depends=('lapack' 'lapacke')
makedepends=()
checkdepends=()
optdepends=()

source=("$pkgname::git+https://bitbucket.org/mmasciola/${_pkgname}")
md5sums=('SKIP'
	 'SKIP'
	 'SKIP')
provides=(${_pkgname})
conflicts=(${_pkgname})

prepare() {
  cd ${pkgname}
}

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

build() {
	mkdir -p ${pkgname}/build
	cd ${pkgname}/build
	cmake ../ \
	 -DCMAKE_INSTALL_PREFIX=/usr \
	 -DBUILD_DOCUMENTATION=ON \
	 -DBUILD_SHARED_LIBS=ON \
	 -DBUILD_TESTING=ON

	make -j 8
}

check() {
	cd "$pkgname/build"
	make test  || true
}

package() {
	cd "$pkgname/build"
	make DESTDIR="$pkgdir/" install
}

Bedanken!

Offline

#9 2019-02-24 15:29:14

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

Re: Seeking support for building a program from source

Try running the PKGBUILD using extra-x86_64 the problems should mostly be self explanatory.  Possibly not obvious the pkgver() fails because the git repository does not contain tags.

Offline

#10 2019-02-24 18:11:19

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: Seeking support for building a program from source

loqs wrote:

Try running the PKGBUILD using extra-x86_64

Sorry, I didn't get it. What does this mean? If you are talking about the extra repository, isn't it already included in the mirrors called by the pacman mirrorlist?

loqs wrote:

Possibly not obvious the pkgver() fails because the git repository does not contain tags.

Okay, so if upstream does not contain tags it makes sense to neglect the pkgver()?

Offline

#11 2019-02-24 18:22:08

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

Re: Seeking support for building a program from source

VCS_package_guidelines#Git see the pkgver function example for repositories without tags.
I mean check the PKGBUILD by running extra-x86_64-build  from devtools

extra-x86_64-build 
:: Synchronizing package databases...
 core is up to date
 extra                   1708.1 KiB  6.65M/s 00:00 [######################] 100%
 community                  4.9 MiB  11.8M/s 00:00 [######################] 100%
:: Starting full system upgrade...
 there is nothing to do
==> Building in chroot for [extra] (x86_64)...
==> Synchronizing chroot copy [/var/lib/archbuild/extra-x86_64/root] -> [testuser]...done
==> Making package: map-plus-plus-git v1.30.00-1 (Sun Feb 24 18:19:31 2019)
==> Retrieving sources...
  -> Cloning map-plus-plus-git git repo...
Cloning into bare repository '/tmp/test/map-plus-plus-git'...
remote: Counting objects: 2975, done.
remote: Compressing objects: 100% (886/886), done.
remote: Total 2975 (delta 2222), reused 2829 (delta 2084)
Receiving objects: 100% (2975/2975), 4.91 MiB | 4.52 MiB/s, done.
Resolving deltas: 100% (2222/2222), done.
==> ERROR: Integrity checks (md5) differ in size from the source array.
==> ERROR: Could not download sources.

Offline

#12 2019-02-26 16:35:32

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: Seeking support for building a program from source

loqs wrote:

VCS_package_guidelines#Git see the pkgver function example for repositories without tags.

Thanks, that sounds reasonable. Of course I got the same error as you did:

==> ERROR: Integrity checks (md5) differ in size from the source array.
==> ERROR: Could not download sources.

So I think it makes sense to change to:

md5sums=('SKIP')

as we have only one package here in the PKGBUILD. This leads to:

==> Validating source files with md5sums...
    map-plus-plus-git ... Skipped
==> ERROR: Cannot find the git package needed to handle git sources.
==> ERROR: Build failed, check /var/lib/archbuild/extra-x86_64/user/build

So I assume I need git package also. Which I have added:

depends=('git' 'lapack' 'lapacke')

Now I get an error about unknown command "cmake". -> Added cmake to the depends. Here is where I end up:

$ extra-x86_64-build
[sudo] password for user: 
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
:: Starting full system upgrade...
 there is nothing to do
==> Building in chroot for [extra] (x86_64)...
==> Synchronizing chroot copy [/var/lib/archbuild/extra-x86_64/root] -> [user]...done
==> Making package: map-plus-plus-git r310.7971939-1 (Tue Feb 26 17:26:06 2019)
==> Retrieving sources...
  -> Cloning map-plus-plus-git git repo...
Cloning into bare repository '/home/user/aur_packages/MAPPlusPlus/map-plus-plus-git'...
remote: Counting objects: 2975, done.
remote: Compressing objects: 100% (886/886), done.
remote: Total 2975 (delta 2224), reused 2827 (delta 2084)
Receiving objects: 100% (2975/2975), 4.91 MiB | 1.37 MiB/s, done.
Resolving deltas: 100% (2224/2224), done.
==> Validating source files with md5sums...
    map-plus-plus-git ... Skipped
==> Making package: map-plus-plus-git r310.7971939-1 (Tue 26 Feb 2019 05:26:11 PM CET)
==> Checking runtime dependencies...
==> Installing missing dependencies...
resolving dependencies...
looking for conflicting packages...

Packages (13) blas-3.8.0-2  jsoncpp-1.8.4-2  libnsl-1.2.0-1  libuv-1.26.0-1
              perl-error-0.17027-1  perl-mailtools-2.20-2  perl-timedate-2.30-5
              rhash-1.3.8-1  shared-mime-info-1.12-1  cmake-3.13.4-1
              git-2.21.0-1  lapack-3.8.0-2  lapacke-3.8.0-2

Total Installed Size:  89.25 MiB

:: Proceed with installation? [Y/n] 
(13/13) checking keys in keyring                   [######################] 100%
(13/13) checking package integrity                 [######################] 100%
(13/13) loading package files                      [######################] 100%
(13/13) checking for file conflicts                [######################] 100%
:: Processing package changes...
( 1/13) installing perl-error                      [######################] 100%
( 2/13) installing perl-timedate                   [######################] 100%
( 3/13) installing perl-mailtools                  [######################] 100%
( 4/13) installing git                             [######################] 100%
Optional dependencies for git
    tk: gitk and git gui
    perl-libwww: git svn
    perl-term-readkey: git svn and interactive.singlekey setting
    perl-mime-tools: git send-email
    perl-net-smtp-ssl: git send-email TLS support
    perl-authen-sasl: git send-email TLS support
    perl-mediawiki-api: git mediawiki support
    perl-datetime-format-iso8601: git mediawiki support
    perl-lwp-protocol-https: git mediawiki https support
    perl-cgi: gitweb (web interface) support
    python2: various helper scripts
    subversion: git svn
    gnome-keyring: GNOME keyring credential helper
    libsecret: libsecret credential helper [installed]
( 5/13) installing shared-mime-info                [######################] 100%
( 6/13) installing jsoncpp                         [######################] 100%
Optional dependencies for jsoncpp
    jsoncpp-doc: documentation
( 7/13) installing libnsl                          [######################] 100%
( 8/13) installing libuv                           [######################] 100%
( 9/13) installing rhash                           [######################] 100%
(10/13) installing cmake                           [######################] 100%
Optional dependencies for cmake
    qt5-base: cmake-gui
    libxkbcommon-x11: cmake-gui
(11/13) installing blas                            [######################] 100%
(12/13) installing lapack                          [######################] 100%
(13/13) installing lapacke                         [######################] 100%
:: Running post-transaction hooks...
(1/5) Warn about old perl modules
(2/5) Reloading system manager configuration...
  Skipped: Current root is not booted.
(3/5) Creating system user accounts...
Creating group git with gid 977.
Creating user git (git daemon user) with uid 977 and gid 977.
(4/5) Arming ConditionNeedsUpdate...
(5/5) Updating the MIME type database...
==> Checking buildtime dependencies...
==> Retrieving sources...
==> WARNING: Skipping all source file integrity checks.
==> Extracting sources...
  -> Creating working copy of map-plus-plus-git git repo...
Cloning into 'map-plus-plus-git'...
done.
==> Starting prepare()...
==> Starting pkgver()...
==> Starting build()...
CMake Error: The source directory "/build/map-plus-plus-git/src/map-plus-plus-git" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Build failed, check /var/lib/archbuild/extra-x86_64/user/build

The PKGBUILD is as folllows now:

# Maintainer: funkaddict

_pkgname=map-plus-plus
pkgname=${_pkgname}-git
pkgver=r310.7971939
pkgrel=1
pkgdesc="Standalone Mooring Analysis Program is a library to model static loads and geometry of cables"
arch=('x86_64')
url="https://bitbucket.org/mmasciola/${_pkgname}"
license=('Apache')
depends=('git' 'cmake' 'lapack' 'lapacke')
makedepends=()
checkdepends=()
optdepends=()

source=("$pkgname::git+https://bitbucket.org/mmasciola/${_pkgname}")
md5sums=('SKIP')
provides=(${_pkgname})
conflicts=(${_pkgname})

prepare() {
  cd ${pkgname}
}

pkgver() {
  cd "$pkgname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
	mkdir -p ${pkgname}/build
	cd ${pkgname}/build
	cmake ../ \
	 -DCMAKE_INSTALL_PREFIX=/usr \
	 -DBUILD_DOCUMENTATION=ON \
	 -DBUILD_SHARED_LIBS=ON \
	 -DBUILD_TESTING=ON

	make -j 8
}

check() {
	cd "$pkgname/build"
	make test  || true
}

package() {
	cd "$pkgname/build"
	make DESTDIR="$pkgdir/" install
}

Besides this I have a fundamental question besides chroot:

loqs wrote:

I mean check the PKGBUILD by running extra-x86_64-build  from devtools

Ok I got it, by "writing extra-x86_64-build into the terminal" in the directory where the PKGBUILD is located, I ask to build the package in the clean chroot. But what I don´t understand is what it exact does. Does make a parallel install of arch, a clean root directory? Because if it does this, I think I have two clean-chroots now, as I did as described in the wiki: https://wiki.archlinux.org/index.php/De … ean_chroot

So I did:

$ mkdir ~/chroot

and

$ CHROOT=$HOME/chroot

and finally

$ mkarchroot $CHROOT/root base-devel

Was this redundant?

Offline

#13 2019-02-26 17:04:06

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

Re: Seeking support for building a program from source

If you are using extra-x86_64-build you do not need to do anything else before running that command it will set up a clean chroot for you under /var/lib/archbuild/extra-x86_64/$USER

depends=('git' 'cmake' 'lapack' 'lapacke')

depends are needed at run time while makedepends are only needed to build the PKGBUILD so 'git' would be a makedepends.

CMake Error: The source directory "/build/map-plus-plus-git/src/map-plus-plus-git" does not appear to contain CMakeLists.txt.

The project does not use cmake it has a shell script which combines build and install which I would not use and there is a makefile under src

#   Copyright (C) 2014 mdm                                     
#   map[dot]plus[dot]plus[dot]help[at]gmail                                
#                                                              
# Licensed to the Apache Software Foundation (ASF) under one   
# or more contributor license agreements.  See the NOTICE file 
# distributed with this work for additional information        
# regarding copyright ownership.  The ASF licenses this file   
# to you under the Apache License, Version 2.0 (the            
# "License"); you may not use this file except in compliance   
# with the License.  You may obtain a copy of the License at   
#                                                              
#   http://www.apache.org/licenses/LICENSE-2.0                 
#                                                              
# Unless required by applicable law or agreed to in writing,   
# software distributed under the License is distributed on an  
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       
# KIND, either express or implied.  See the License for the    
# specific language governing permissions and limitations            
# under the License.                                             

MAP_VER:=1.30.00

BITS = -m64
PLATFORM = $(shell uname -s)
VPATH = cminpack:simclist:bstring:lapack


ifeq ($(OS),Windows_NT)
  DEL_CMD   = del
  LIB_EXT   = dll
  CFLAGS    = $(BITS) -g -std=c99 -DMAP_DLL_EXPORTS -DCMINPACK_NO_DLL  -DNDEBUG -D_WINDOWS -D_USRDLL -D_MINGW
  LDFLAGS   = $(BITS) -g -shared -Wl,--export-all-symbols
  LIB_FLAGS :=
else
  PLATFORM = $(shell uname -s)
  DEL_CMD   = rm -rf
  GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always)

  ifeq ($(PLATFORM),Darwin)
    LIB_EXT   = dylib
    CC_TOOLS  = clang
    CFLAGS    = -g -O1 -fno-omit-frame-pointer -fPIC -D DEBUG -Icminpack -Isimclist
    LDFLAGS   = -g -dynamiclib
    LIB_FLAGS := -lm
  else ifeq ($(PLATFORM),Linux)
    LIB_EXT   = so
    CC_TOOLS  = gcc
    #CFLAGS    = -g -O1 -fsanitize=address -fno-omit-frame-pointer -fPIC -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\" -Icminpack -Isimclist
    #CFLAGS    = -g -fPIC -std=c99 -Wuninitialized -Wall -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\"
    CFLAGS    = $(BITS) -g -fPIC -std=c99 -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\" -D WITH_LAPACK
    LDFLAGS   = $(BITS) -g -shared -llapacke
    LIB_FLAGS := -lm -llapacke
  endif
endif

DEBUG     = 
OBJ       = lmder.o \
	dpmpar.o \
	lmpar.o \
	qrsolv.o \
	enorm.o \
	enorm_u.o \
	qrfac.o \
	simclist.o \
	bstrlib.o \
	bstraux.o \
	freedata.o \
	mapinit.o \
	maperror.o \
	lineroutines.o \
	numeric.o \
	outputstream.o \
	mapapi.o \
	lmroutines.o \
	jacobian.o \
	residual.o \


all : $(OBJ)
	$(CC_TOOLS) $(LDFLAGS) -o libmap-$(MAP_VER).$(LIB_EXT) $(DEBUG) $(OBJ) $(LIB_FLAGS) 

.c.o :
	$(CC_TOOLS) -c $(CFLAGS) $<

clean:
	$(DEL_CMD) *.$(LIB_EXT) *.o *~

memcheck:	
	valgrind --tool=memcheck --leak-check=yes python -E -tt ./main.py	

Unfortunately the makefile uses some none standard variable names and does not add to existing values of variables.
This means the values of CFLAGS CPPFLAGS CXXFLAGS LDFLAGS passed in by makepkg will not be used.
The flags needed for lapacke are hardcoded instead of using pkg-config.

Offline

#14 2019-02-26 21:34:00

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: Seeking support for building a program from source

loqs wrote:

If you are using extra-x86_64-build you do not need to do anything else before running that command it will set up a clean chroot for you under /var/lib/archbuild/extra-x86_64/$USER

Ok, so everytime I run extra-x86_64-build it will create that directory? Should it then be deleted after completing the build process in the chroot?

loqs wrote:

depends are needed at run time while makedepends are only needed to build the PKGBUILD so 'git' would be a makedepends.

Of course, I will change that.

loqs wrote:

The project does not use cmake it has a shell script which combines build and install which I would not use and there is a makefile under src

#   Copyright (C) 2014 mdm                                     
#   map[dot]plus[dot]plus[dot]help[at]gmail                                
#                                                              
# Licensed to the Apache Software Foundation (ASF) under one   
# or more contributor license agreements.  See the NOTICE file 
# distributed with this work for additional information        
# regarding copyright ownership.  The ASF licenses this file   
# to you under the Apache License, Version 2.0 (the            
# "License"); you may not use this file except in compliance   
# with the License.  You may obtain a copy of the License at   
#                                                              
#   http://www.apache.org/licenses/LICENSE-2.0                 
#                                                              
# Unless required by applicable law or agreed to in writing,   
# software distributed under the License is distributed on an  
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       
# KIND, either express or implied.  See the License for the    
# specific language governing permissions and limitations            
# under the License.                                             

MAP_VER:=1.30.00

BITS = -m64
PLATFORM = $(shell uname -s)
VPATH = cminpack:simclist:bstring:lapack


ifeq ($(OS),Windows_NT)
  DEL_CMD   = del
  LIB_EXT   = dll
  CFLAGS    = $(BITS) -g -std=c99 -DMAP_DLL_EXPORTS -DCMINPACK_NO_DLL  -DNDEBUG -D_WINDOWS -D_USRDLL -D_MINGW
  LDFLAGS   = $(BITS) -g -shared -Wl,--export-all-symbols
  LIB_FLAGS :=
else
  PLATFORM = $(shell uname -s)
  DEL_CMD   = rm -rf
  GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always)

  ifeq ($(PLATFORM),Darwin)
    LIB_EXT   = dylib
    CC_TOOLS  = clang
    CFLAGS    = -g -O1 -fno-omit-frame-pointer -fPIC -D DEBUG -Icminpack -Isimclist
    LDFLAGS   = -g -dynamiclib
    LIB_FLAGS := -lm
  else ifeq ($(PLATFORM),Linux)
    LIB_EXT   = so
    CC_TOOLS  = gcc
    #CFLAGS    = -g -O1 -fsanitize=address -fno-omit-frame-pointer -fPIC -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\" -Icminpack -Isimclist
    #CFLAGS    = -g -fPIC -std=c99 -Wuninitialized -Wall -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\"
    CFLAGS    = $(BITS) -g -fPIC -std=c99 -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\" -D WITH_LAPACK
    LDFLAGS   = $(BITS) -g -shared -llapacke
    LIB_FLAGS := -lm -llapacke
  endif
endif

DEBUG     = 
OBJ       = lmder.o \
	dpmpar.o \
	lmpar.o \
	qrsolv.o \
	enorm.o \
	enorm_u.o \
	qrfac.o \
	simclist.o \
	bstrlib.o \
	bstraux.o \
	freedata.o \
	mapinit.o \
	maperror.o \
	lineroutines.o \
	numeric.o \
	outputstream.o \
	mapapi.o \
	lmroutines.o \
	jacobian.o \
	residual.o \


all : $(OBJ)
	$(CC_TOOLS) $(LDFLAGS) -o libmap-$(MAP_VER).$(LIB_EXT) $(DEBUG) $(OBJ) $(LIB_FLAGS) 

.c.o :
	$(CC_TOOLS) -c $(CFLAGS) $<

clean:
	$(DEL_CMD) *.$(LIB_EXT) *.o *~

memcheck:	
	valgrind --tool=memcheck --leak-check=yes python -E -tt ./main.py	

Unfortunately the makefile uses some none standard variable names and does not add to existing values of variables.
This means the values of CFLAGS CPPFLAGS CXXFLAGS LDFLAGS passed in by makepkg will not be used.
The flags needed for lapacke are hardcoded instead of using pkg-config.

I am not sure if I understood this correctly. How would I solve this issue?

Offline

#15 2019-02-26 21:54:08

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

Re: Seeking support for building a program from source

You could ignore the issue,  use sed or patch to change the makefile to resolve the issues or replace the makefile with an alternative.
Apart from ignoring the issue I do not know which would be simpler or considered the correct approach for a PKGBUILD.
makefile which does append to flags.

MAP_VER:=1.30.00
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always)

CFLAGS    += -std=c99 -D DEBUG -DGITVERSION=\"$(GIT_VERSION)\" -D WITH_LAPACK $(shell pkg-config --libs lapacke) -fPIC
LDFLAGS   += -shared $(shell pkg-config --libs lapacke)-lm

OBJ = cminpack/lmder.o \
  cminpack/dpmpar.o \
  cminpack/lmpar.o \
  cminpack/qrsolv.o \
  cminpack/enorm.o \
  cminpack/enorm_u.o \
  cminpack/qrfac.o \
  simclist/simclist.o \
  bstring/bstrlib.o \
  bstring/bstraux.o \
  freedata.o \
  mapinit.o \
  maperror.o \
  lineroutines.o \
  numeric.o \
  outputstream.o \
  mapapi.o \
  lmroutines.o \
  jacobian.o \
  residual.o \


all : $(OBJ)
	$(CC) $(LDFLAGS) -o libmap-$(MAP_VER).so $(OBJ)

Beyond that issue install.sh calls python main.py but there is not main.py in the src directory and the upstream makefile and install.sh both do not install anything.
So you need to decide where the .so is supposed to go.
Edit:

build() {
	cd ${pkgname}/src
	make
}

package() {
	cd "${pkgname}/src"
	install -dm 0755 "${pkgdir}/usr/lib"
	install -m 0644 libmap-1.30.00.so "${pkgdir}/usr/lib"
}

Last edited by loqs (2019-02-26 23:36:32)

Offline

#16 2019-02-27 16:35:51

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: Seeking support for building a program from source

loqs wrote:

You could ignore the issue,  use sed or patch to change the makefile to resolve the issues or replace the makefile with an alternative.
Apart from ignoring the issue I do not know which would be simpler or considered the correct approach for a PKGBUILD.
makefile which does append to flags.

I think I have to workt through the CMAKE tutorial https://cmake.org/cmake-tutorial/ Because I see that I am completely lost here and don´t understand anything.

loqs wrote:

Beyond that issue install.sh calls python main.py but there is not main.py in the src directory and the upstream makefile and install.sh both do not install anything.
So you need to decide where the .so is supposed to go.

Same as above, I think I still don´t really understand what we are doing here. I´ll try to get a better understanding here.

loqs wrote:

Edit:

build() {
	cd ${pkgname}/src
	make
}

package() {
	cd "${pkgname}/src"
	install -dm 0755 "${pkgdir}/usr/lib"
	install -m 0644 libmap-1.30.00.so "${pkgdir}/usr/lib"
}

Thank you, alot. With altering also check() accordingly, building works now. But I am not satisfied as I am not understanding how and what for the moment ^^
Anyway thanks for your time.

Offline

#17 2019-02-27 16:46:14

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

Re: Seeking support for building a program from source

map-plus-plus provides a makefile which make can use to build the project.  CMake uses CMakeLists.txt to produce a makefile which could then be used by make.
As map-plus-plus does not provide CMakeLists.txt you would have to convert the project from makefile to CMake if you want to use cmake then make.
There is a shell script file install.sh it calls make the same as the PKGBUILD it then calls python main.py but main.py is not in the working directory install.sh changed to.

Offline

Board footer

Powered by FluxBB