how to compile the test files of m4ri?

Issue #70 invalid
סיאנג היונג created an issue

Currently, I want to use the package 'm4ri' to solve system of linear equations. I installed the package on my linux server following the instruction on your website.

Then, I tried to compile the test_solve.c with the following command line:

gcc -std=gnu99 -lm -lm4ri -I/home/qarma/m4ri -O0 /home/qarma/m4ri/tests/test_solve.c

I could compile successful. But the problem is when I run with ./a.out, it returns segmentation fault.

As all the test files passed the 'make check' phase on my side, there should be no error in it. I think it should be the problem of flag.

Besides, I also installed it on my ubuntu with the following steps:

git clone https://senyang_haifa@bitbucket.org/senyang_haifa/m4ri.git
cd m4ri/
autoreconf --install
./configure
make
make check

And I compile the 'test_solve.c' with the following command line:

gcc -lm4ri -lm -I /home/senyanghuang/m4ri tests/test_solve.c

This time I can not compile but it returns the following errors:

/usr/bin/ld: /tmp/cc17cYIS.o: in function test_pluq_solve_left': test_solve.c:(.text+0x135): undefined reference tomzd_init'
/usr/bin/ld: test_solve.c:(.text+0x148): undefined reference to mzd_init' /usr/bin/ld: test_solve.c:(.text+0x158): undefined reference tomzd_randomize'
/usr/bin/ld: test_solve.c:(.text+0x164): undefined reference to mzd_randomize' /usr/bin/ld: test_solve.c:(.text+0x187): undefined reference tomzd_init_window'
/usr/bin/ld: test_solve.c:(.text+0x1ae): undefined reference to mzd_init_window' /usr/bin/ld: test_solve.c:(.text+0x1c8): undefined reference tomzd_init'
/usr/bin/ld: test_solve.c:(.text+0x262): undefined reference to mzd_copy' /usr/bin/ld: test_solve.c:(.text+0x277): undefined reference tomzd_echelonize'
/usr/bin/ld: test_solve.c:(.text+0x2ae): undefined reference to mzd_free' /usr/bin/ld: test_solve.c:(.text+0x2bf): undefined reference tomzd_copy'
/usr/bin/ld: test_solve.c:(.text+0x2dd): undefined reference to mzd_solve_left' /usr/bin/ld: test_solve.c:(.text+0x2f6): undefined reference tomzd_init'
/usr/bin/ld: test_solve.c:(.text+0x36d): undefined reference to mzd_mul' /usr/bin/ld: test_solve.c:(.text+0x386): undefined reference tomzd_add'
/usr/bin/ld: test_solve.c:(.text+0x3a3): undefined reference to mzd_is_zero' /usr/bin/ld: test_solve.c:(.text+0x3e9): undefined reference tomzd_free'
/usr/bin/ld: test_solve.c:(.text+0x3f5): undefined reference to mzd_free' /usr/bin/ld: test_solve.c:(.text+0x401): undefined reference tomzd_free'
/usr/bin/ld: test_solve.c:(.text+0x40d): undefined reference to mzd_free' /usr/bin/ld: test_solve.c:(.text+0x419): undefined reference tomzd_free'
/usr/bin/ld: /tmp/cc17cYIS.o:test_solve.c:(.text+0x425): more undefined references to mzd_free' follow /usr/bin/ld: /tmp/cc17cYIS.o: in functionmain':
test_solve.c:(.text+0x47f): undefined reference to m4ri_random_word' /usr/bin/ld: test_solve.c:(.text+0x492): undefined reference tom4ri_random_word'
collect2: error: ld returned 1 exit status

Would you please show me where the problem is?

Thank you!

Comments (8)

  1. Martin Albrecht repo owner

    To compile the tests, run make check.

    Manual compilation works here, too:

    gcc -I. tests/test_solve.c -lm -lm4ri -L.libs/ -o foo
    LD_LIBRARY_PATH="../.libs" ./foo
    

  2. סיאנג היונג reporter

    On my ubuntu, it shows the following error when I compile

    gcc -I. tests/test_solve.c -lm -lm4ri -L.libs/ -o foo
    /usr/bin/ld: .libs//libm4ri.so: undefined reference to log2' /usr/bin/ld: .libs//libm4ri.so: undefined reference toround'
    collect2: error: ld returned 1 exit status

  3. Log in to comment