collect2: error: ld returned 1 exit status

[email protected]
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <[email protected]>
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")

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

int main(void)
{
  GEN i,j,k;
  size_t size;
  ulong maxprime;

  size = 500000;
  maxprime = 2;
  pari_init(size, maxprime);

  i=gen_1;
  j=stoi(3);
  k=gadd(i,j);
  printf("1+3=%s",GENtostr(k));
  return 0;

}

does not compile:

leitner@laptop:~$ gcc using_pari.c 
-L/home/leitner/pari/pari-2.17.1/lib/libpari.a -o using_pari
/usr/bin/ld: /tmp/ccOS0lGW.o: warning: relocation against `gen_1' in 
read-only section `.text'
/usr/bin/ld: /tmp/ccOS0lGW.o: in function `set_avma':
using_pari.c:(.text+0x43): undefined reference to `avma'
/usr/bin/ld: /tmp/ccOS0lGW.o: in function `new_chunk':
using_pari.c:(.text+0x59): undefined reference to `avma'
/usr/bin/ld: using_pari.c:(.text+0x6f): undefined reference to `avma'
/usr/bin/ld: using_pari.c:(.text+0x76): undefined reference to 
`pari_mainstack'
/usr/bin/ld: using_pari.c:(.text+0x96): undefined reference to 
`new_chunk_resize'
/usr/bin/ld: /tmp/ccOS0lGW.o: in function `stoi':
using_pari.c:(.text+0x1e4): undefined reference to `gen_0'
/usr/bin/ld: /tmp/ccOS0lGW.o: in function `pari_err_OVERFLOW':
using_pari.c:(.text+0x22f): undefined reference to `pari_err'
/usr/bin/ld: /tmp/ccOS0lGW.o: in function `main':
using_pari.c:(.text+0x261): undefined reference to `pari_init'
/usr/bin/ld: using_pari.c:(.text+0x268): undefined reference to `gen_1'
/usr/bin/ld: using_pari.c:(.text+0x28d): undefined reference to `gadd'
/usr/bin/ld: using_pari.c:(.text+0x29d): undefined reference to 
`GENtostr'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status

  I am inexperienced with linker issues. Could you please help me to fix 
the problem?

  Cheers,
  Marianne

-- 
--
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the
individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately
by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified
that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.
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.