Opened 12 years ago

Closed 12 years ago

#36548 closed defect (invalid)

libmatheval doesn't work with gfortran

Reported by: angelo.graziosi@… Owned by: mww@…
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc:
Port: libmatheval

Description

The attachment contains examples from libmatheval manual...

...and while this works,

gcc evaluator.c $(pkg-config --cflags --libs libmatheval) \
    -o evaluator.out

gcc evaluator.c -I /opt/local/include -L /opt/local/lib -lmatheval \
    -o evaluator.out

./evaluator.out
[...]

this DOESN'T work,

gfortran evaluator.f -ff90 -ffree-form -L /opt/local/lib -lmatheval -o evaluator.out
gfortran: error: unrecognized command line option '-ff90'

gfortran evaluator.f90 $(pkg-config --cflags --libs libmatheval) -o evaluator.out
Undefined symbols for architecture x86_64:
  "_evaluator_create_", referenced from:
      _MAIN__ in cc7JYcDA.o
  "_evaluator_derivative_x_", referenced from:
      _MAIN__ in cc7JYcDA.o
  "_evaluator_destroy_", referenced from:
      _MAIN__ in cc7JYcDA.o
  "_evaluator_evaluate_x_", referenced from:
      _MAIN__ in cc7JYcDA.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

gfortran evaluator.f90 -L/opt/local/lib -lmatheval -o evaluator.outUndefined symbols for architecture x86_64:
  "_evaluator_create_", referenced from:
      _MAIN__ in cclTxXgn.o
  "_evaluator_derivative_x_", referenced from:
      _MAIN__ in cclTxXgn.o
  "_evaluator_destroy_", referenced from:
      _MAIN__ in cclTxXgn.o
  "_evaluator_evaluate_x_", referenced from:
      _MAIN__ in cclTxXgn.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

gfortran comes from Macports gcc47...

Ciao, Angelo.

Attachments (1)

examples.tar.bz2 (1.8 KB) - added by angelo.graziosi@… 12 years ago.
examples for libmatheval

Download all attachments as: .zip

Change History (4)

Changed 12 years ago by angelo.graziosi@…

Attachment: examples.tar.bz2 added

examples for libmatheval

comment:1 Changed 12 years ago by mf2k (Frank Schima)

Cc: mww@… removed
Keywords: matheval fortran removed
Owner: changed from macports-tickets@… to mww@…

comment:2 Changed 12 years ago by angelo.graziosi@…

I have just discovered that adding "-fsecond-underscore" works also with gfortran :-), i.e. all the following works

$ gfortran -fsecond-underscore evaluator.f90 $(pkg-config --cflags --libs libmatheval) -o evaluator.out

$ gfortran -fsecond-underscore evaluator.f90 -L /opt/local/lib -lmatheval -o evaluator.out

$ gfortran -fsecond-underscore evaluator.f -ffree-form -L /opt/local/lib -lmatheval -o evaluator.out

Ciao, Angelo.

comment:3 Changed 12 years ago by jmroot (Joshua Root)

Resolution: invalid
Status: newclosed

AIUI, that's just the way it is when mixing fortran code with C libraries.

Note: See TracTickets for help on using tickets.