unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Need help packaging IUP (part 1: IM)
@ 2023-03-20 22:44 Ekaitz Zarraga
  2023-03-20 22:59 ` Felix Lechner via
  2023-03-21 12:25 ` Reza Housseini
  0 siblings, 2 replies; 6+ messages in thread
From: Ekaitz Zarraga @ 2023-03-20 22:44 UTC (permalink / raw)
  To: help-guix\@gnu.org

Hi,

I'm trying to package IUP (https://www.tecgraf.puc-rio.br/iup/) and I'm already stuck on the first package :)

They have a pretty wild general Makefile but I think I'm managing to deal with it.

The main problem I have now is the RUNPATH is not set properly. If I keep the RUNPATH validation phase it fails.

I tried several ways to add it but I didn't manage to fix it.

I leave my current package description below.

Thanks for your help!

Cheers,
Ekaitz


PS: Also, anyone has a suggestion on how can I transform the phases to turn then something like:
(add-build-phase "im_jp2") => (add-before build' build-im_jp2 (lambda _ (invoke ...)))
I tried with a simple function but the the quoting killed all my hopes and I'm not good with macros (yet).

---

(define-module (iup)
  #:use-module (guix packages)
  #:use-module (guix gexp)
  #:use-module (gnu packages)
  #:use-module ((gnu packages base) #:prefix base:)
  #:use-module (gnu packages algebra)
  #:use-module (gnu packages commencement)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages image)
  #:use-module (gnu packages lua)
  #:use-module (gnu packages xorg)
  #:use-module (guix download)
  #:use-module (guix build utils)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system cmake)
  #:use-module ((guix licenses) #:prefix license:))

(define-public im
  (package
    (name "im")
    (version "3.15")
    (source (origin
              (method url-fetch)
              (uri (string-append
                     "https://sourceforge.net/projects/imtoolkit/files/"
                     version "/Docs%20and%20Sources/im-" version
                     "_Sources.tar.gz"))
              (sha256
                (base32 "1c5p8j7sw3r7kmkd4qa49zmh3dlp5zszp2sagi71aqjq84pngp40"))))

    (inputs (list base:which
                  libpng
                  fftw
                  fftwf))
    (build-system gnu-build-system)
    (arguments
      (list
        #:tests? #f
        #:validate-runpath? #f ;; FIXME: Fix the runpath!!
        #:phases
        #~(modify-phases %standard-phases
            (add-before 'configure 'set-ldflags
              ;; FIXME: LDFLAGS don't work, so the runpath is broken
              (lambda _
                (setenv "LDFLAGS" (string-append "-Wl,-rpath=" #$output "/lib"))))
            (delete 'configure)
            ;; Left lua-related libs out of the mix for the moment as they
            ;; have some build errors and I don't need them yet.
            (add-before 'build 'cd
                        (lambda _
                          (chdir "src")))
            (add-before 'build 'build-im
                        (lambda _
                          (invoke "make" "im")))
            (add-before 'build 'build-im-jp2
                        (lambda _
                          (invoke "make" "im_jp2")))
            (add-before 'build 'build-im-process
                        (lambda _
                          (invoke "make" "im_process")))
            (add-before 'build 'build-im-process-omp
                        (lambda _
                          (invoke "make" "im_process_omp")))
            (add-before 'build 'build-im-fftw3
                        (lambda _
                          (invoke "make" "im_fftw3")))
            (delete 'build)
            (replace 'install
              (lambda* (#:key outputs #:allow-other-keys)
                (let* ((include (string-append #$output "/include"))
                       (lib (string-append #$output "/lib")))
                  (mkdir-p include)
                  (mkdir-p lib)
                  (copy-recursively "../include" include)
                  (invoke "find" "../lib" "-exec" "cp" "{}" lib ";")))))))
    (home-page "https://www.tecgraf.puc-rio.br/im")
    (synopsis "IM is a toolkit for image representation, storage, capture and
processing")
    (description "The main goal of the library is to provide a simple API and
abstraction of imaging for scientific applications. The most popular file
formats are supported: TIFF, BMP, PNG, JPEG, GIF and AVI. Image representation
includes scientific data types, and about a hundred Image Processing operations
are available.")
    (license license:expat)))



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Need help packaging IUP (part 1: IM)
  2023-03-20 22:44 Need help packaging IUP (part 1: IM) Ekaitz Zarraga
@ 2023-03-20 22:59 ` Felix Lechner via
  2023-03-21 12:25 ` Reza Housseini
  1 sibling, 0 replies; 6+ messages in thread
From: Felix Lechner via @ 2023-03-20 22:59 UTC (permalink / raw)
  To: Ekaitz Zarraga; +Cc: help-guix\@gnu.org

Hi Ekaitz,

On Mon, Mar 20, 2023 at 3:45 PM Ekaitz Zarraga <ekaitz@elenq.tech> wrote:
>
> The main problem I have now is the RUNPATH is not set properly.

I hope it's okay to amend your note briefly. The captive shared
library libim.so is not being found by (guix build-system gnu) when
setting the RUNPATH for libim_jp.so, because both libraries are being
built in the same package.

The issue seemed similar to the circumstances in our repo here [1]
here [2] here [3] and here [4] but somehow those solutions did not
work for Ekaitz.

Here is the error message Ekaitz saw from 'validate-runpath:

    /gnu/store/d4z5069a5z9nn4wj2ji52cv60ghkm0ip-im-3.15/lib/libim_jp2.so:
    error: depends on 'libim.so', which cannot be found in RUNPATH
    ("/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib"
    "/gnu/store/094bbaq6glba86h1d4cj16xhdi6fk2jl-gcc-10.3.0-lib/lib"
    "/gnu/store/p7iq81hxxyk9zy7a9dngbf16zm8d4klx-libpng-1.6.37/lib"
    "/gnu/store/8qv5kb2fgm4c3bf70zcg9l6hkf3qzpw9-zlib-1.2.11/lib"
    "/gnu/store/094bbaq6glba86h1d4cj16xhdi6fk2jl-gcc-10.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/10.3.0/../../..")

Kind regards
Felix Lechner

[1] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/video.scm#n1776
[2] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/boost.scm#n97
[3] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/kde-plasma.scm#n237
[4] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/bootloaders.scm#n583


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Need help packaging IUP (part 1: IM)
  2023-03-20 22:44 Need help packaging IUP (part 1: IM) Ekaitz Zarraga
  2023-03-20 22:59 ` Felix Lechner via
@ 2023-03-21 12:25 ` Reza Housseini
  2023-03-21 12:45   ` Ekaitz Zarraga
  1 sibling, 1 reply; 6+ messages in thread
From: Reza Housseini @ 2023-03-21 12:25 UTC (permalink / raw)
  To: help-guix


[-- Attachment #1.1.1: Type: text/plain, Size: 460 bytes --]

Have you tried something like

(add-before 'configure 'set-ldflags
   (lambda _
     (substitute* "tecmake.mak"
       (("STDLDFLAGS := -shared" all) (string-append all " 
-Wl,-rpath="#$output "/lib")))))

not tested though.

Also it looks like a cmake project, why are you not using the 
cmake-build-system?

Cheers,

-- 
Reza Housseini

This message is signed with my GnuPG key:

     C0F3 0812 9AF2 80F4 0830 C2C1 C375 C6AF 0512 5C52


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 15557 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Need help packaging IUP (part 1: IM)
  2023-03-21 12:25 ` Reza Housseini
@ 2023-03-21 12:45   ` Ekaitz Zarraga
  2023-03-21 15:43     ` Ekaitz Zarraga
  0 siblings, 1 reply; 6+ messages in thread
From: Ekaitz Zarraga @ 2023-03-21 12:45 UTC (permalink / raw)
  To: Reza Housseini; +Cc: help-guix

Hi Reza,
Thanks for the help!
I'll answer inline:
------- Original Message -------
On Tuesday, March 21st, 2023 at 13:25, Reza Housseini <reza.housseini@gmail.com> wrote:


> Have you tried something like
> 
> (add-before 'configure 'set-ldflags
> (lambda _
> (substitute* "tecmake.mak"
> (("STDLDFLAGS := -shared" all) (string-append all "
> -Wl,-rpath="#$output "/lib")))))
> 
> not tested though.

I'll give a try to this. I didn't try it!
Thanks!

> 
> Also it looks like a cmake project, why are you not using the
> cmake-build-system?

The CMake they use gives syntax errors and the official docs describe to use the Makefile and they don't mention the CMake.
It's probably poorly maintained.

Thanks for the help! I'll answer back when I try the STDLDFLAGS!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Need help packaging IUP (part 1: IM)
  2023-03-21 12:45   ` Ekaitz Zarraga
@ 2023-03-21 15:43     ` Ekaitz Zarraga
  2023-03-21 16:01       ` Reza Housseini
  0 siblings, 1 reply; 6+ messages in thread
From: Ekaitz Zarraga @ 2023-03-21 15:43 UTC (permalink / raw)
  To: Ekaitz Zarraga; +Cc: Reza Housseini, help-guix

 
> > Have you tried something like
> > 
> > (add-before 'configure 'set-ldflags
> > (lambda _
> > (substitute* "tecmake.mak"
> > (("STDLDFLAGS := -shared" all) (string-append all "
> > -Wl,-rpath="#$output "/lib")))))
> > 
> > not tested though.
> 
> 
> I'll give a try to this. I didn't try it!
> Thanks!
> 

Worked! Thank you!!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Need help packaging IUP (part 1: IM)
  2023-03-21 15:43     ` Ekaitz Zarraga
@ 2023-03-21 16:01       ` Reza Housseini
  0 siblings, 0 replies; 6+ messages in thread
From: Reza Housseini @ 2023-03-21 16:01 UTC (permalink / raw)
  To: Ekaitz Zarraga; +Cc: help-guix


[-- Attachment #1.1.1: Type: text/plain, Size: 972 bytes --]

On 3/21/23 16:43, Ekaitz Zarraga wrote:
>   
>>> Have you tried something like
>>>
>>> (add-before 'configure 'set-ldflags
>>> (lambda _
>>> (substitute* "tecmake.mak"
>>> (("STDLDFLAGS := -shared" all) (string-append all "
>>> -Wl,-rpath="#$output "/lib")))))
>>>
>>> not tested though.
>>
>>
>> I'll give a try to this. I didn't try it!
>> Thanks!
>>
> 
> Worked! Thank you!!

There is a confusion (which I also had) linking LDFLAGS to GCC, but 
there is no connection, see for example this stackoverflow answer: 
https://stackoverflow.com/a/16047559.
There are only a handful of environment variables affecting the GCC 
compiler (https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html) 
and none of them is for setting rpaths. Therefore you have to provide 
them explicitly to the compiler via normal flags.

-- 
Reza Housseini

This message is signed with my GnuPG key:

     C0F3 0812 9AF2 80F4 0830 C2C1 C375 C6AF 0512 5C52


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 15557 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-21 16:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20 22:44 Need help packaging IUP (part 1: IM) Ekaitz Zarraga
2023-03-20 22:59 ` Felix Lechner via
2023-03-21 12:25 ` Reza Housseini
2023-03-21 12:45   ` Ekaitz Zarraga
2023-03-21 15:43     ` Ekaitz Zarraga
2023-03-21 16:01       ` Reza Housseini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).