Closed overshiki closed 1 year ago
Hi! Sorry, this got lost in my inbox. I guess you have figured this out by now. Either way I don’t think there’s much I can do, it is probably not related to the library but some specifics of your setup that would be hard to troubleshoot remotely.
fre 5 maj 2023 kl. 05:23 skrev overshiki @.***>:
Hi, I tried to build the example.c code following the C-API as demonstrated in http://freesasa.github.io/doxygen/API.html. Unfortunately, it does not work. More specifically, I first tried to build and make install the source code using the following command
git submodule init git submodule update autoreconf -i ./configure --prefix=my_install_location --disable-json make && make install
It successfully built the shared library with the following files:
/my_install_location/include/freesasa.h /my_install_location/bin/freesasa /my_install_location/lib/libfreesasa.a /my_install_location/share/some_other_files
I tested the executable my_install_location/bin/freesasa, and it works well.
Then I wrote an example.c code following the C-API:
include
include "freesasa.h"
void main() { FILE fp = fopen("1ubq.pdb", "r"); const freesasa_classifier classifier = &freesasa_default_classifier; freesasa_structure *structure = freesasa_structure_from_pdb(fp, classifier, 0);
freesasa_result *result = freesasa_calc_structure(structure, NULL); printf("Total area: %f A2\n",result->total);
}
and built it using the following command:
gcc -I/my_install_location/include -L/my_install_location/lib -lfreesasa -static example.c -o example
It raised the following error message:
/tmp/cc2tQGTg.o: In function
main': example.c:(.text+0x22): undefined reference to
freesasa_protor_classifier' example.c:(.text+0x3e): undefined reference tofreesasa_structure_from_pdb' example.c:(.text+0x53): undefined reference to
freesasa_calc_structure' collect2: error: ld returned 1 exit status Makefile:2: recipe for target 'target' failed make: *** [target] Error 1It seems gcc has successfully load the .h and .a file into the system, but it did not find a reference of freesasa_protor_classifier, freesasa_structure_from_pdb, freesasa_calc_structure as defined in the header file. (As you can see, freesasa_protor_classifier does not appear in the example.c file)
I'm a new comer of c-language, so maybe I made a mistake during the building process. Could you provide me some hint on what's going on and how could I fix this?
Thanks a lot in advance
— Reply to this email directly, view it on GitHub https://github.com/mittinatten/freesasa/issues/90, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVV4HGLSFU346I2DC7EJ23XERXETANCNFSM6AAAAAAXWSSERY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi, I tried to build the
example.c
code following the C-API as demonstrated in http://freesasa.github.io/doxygen/API.html. Unfortunately, it does not work. More specifically, I first tried to build and make install the source code using the following commandIt successfully built the shared library with the following files:
I tested the executable
my_install_location/bin/freesasa
, and it works well.Then I wrote an
example.c
code following the C-API:and built it using the following command:
It raised the following error message:
It seems
gcc
has successfully load the.h
and.a
file into the system, but it did not find a reference offreesasa_protor_classifier
,freesasa_structure_from_pdb
,freesasa_calc_structure
as defined in the header file. (As you can see,freesasa_protor_classifier
does not appear in theexample.c
file)I'm a new comer of c-language, so maybe I made a mistake during the building process. Could you provide me some hint on what's going on and how could I fix this?
Thanks a lot in advance