Re: collect2: error: ld returned 1 exit status

Bill Allombert <[email protected]>
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <Z5aEyrpMM7dwgOtb@seventeen>
On Sun, Jan 26, 2025 at 07:01:49PM +0100, [email protected] wrote:
> Hello,
> 
>  I installed pari-2.17.1 on Linux Ubuntu in the folder $HOME/pari. avx could
> not be found in C lib, but all tests seem to run fine.
> 
>  Now I am using gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, and while my c
> code compiles all right, my simple test program (named "using_pari.c")

Hello,

Note that we provide compilation instruction in Appendix B of the libpari manual
and an example Makefile in the examples directory.
Using this Makefile, you can just do
make TARGET=using_pari

> #include "pari/pari-2.17.1/include/pari/pari.h"

Please do not do that, use -I pari/pari-2.17.1/include/ instead:
the correct way to include pari is:

#include <pari/pari.h>

> leitner@laptop:~$ gcc using_pari.c
> -L/home/leitner/pari/pari-2.17.1/lib/libpari.a -o using_pari

This is not a valid command line, -L expect a path, not a library, so this does nothing.

You should do

gcc -O3 -Wall using_pari.c -o using_pari -I /home/leitner/pari/pari-2.17.1/include -L/home/leitner/pari/pari-2.17.1/lib/ -lpari -Wl,-rpath=/home/leitner/pari/pari-2.17.1/lib/ 

Cheers,
Bill.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.