You're welcome everybody.. it was such a pain to figure it out!
Anonymous.. you can do the linking in your local directory and link against the library from there
For example
ln -s /usr/lib/libf2c.a ~/libf2c.so
This will place libf2c.so in your home directory (you can choose something else)
When you compile you should include that in your LD_PATH path
For example
gcc my_program.c -L~ -lf2c
I suggest creating a directory called mylib in your home folder and put your custom libraries there and permanently change the LD_LIBRARY_PATH to point there by default
Thank you! I cannot even express how extremely helpful piece information this is for me. But I would be more than interested also why it's not working with shared library?
Thanks for pointing out the problem! Another fix, change the makefile, to link with f2c statically and with the rest dynamically, i.e.: LAPACKLIBS=-llapack -lblas -Wl,-Bstatic -lf2c -Wl,-Bdynamic
Which is on line 18 in levmar 2.5, works just fine :)
I tried doing this but it still gives me an error as -
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libf2c.so(main.o): In function `main': /build/buildd/libf2c2-20090411/main.c:138: undefined reference to `MAIN__' collect2: ld returned 1 exit status
Can you plz help me with this? Thanks in advance...
18 comments:
Thank you! This was killing me...
thanks, that was really helpful :)
i would never figure it out by my own.
Thank you!
Thanks, Thanks and thanks.
how can you do this without root access?
You're welcome everybody.. it was such a pain to figure it out!
Anonymous.. you can do the linking in your local directory and link against the library from there
For example
ln -s /usr/lib/libf2c.a ~/libf2c.so
This will place libf2c.so in your home directory (you can choose something else)
When you compile you should include that in your LD_PATH path
For example
gcc my_program.c -L~ -lf2c
I suggest creating a directory called mylib in your home folder and put your custom libraries there and permanently change the LD_LIBRARY_PATH to point there by default
mkdir ~/mylib
ln -s /usr/lib/libf2c.a ~/mylib/libf2c.so
in your .bashrc (csh is similar)
export LD_LIBRARY_PATH="$HOME/mylib":$LD_LIBRARAY_PATH
Good luck
Thank yoooooooou soooooooooooooooo much. I was going to kill myself....
wish the best for you! ;)
Thanks! Why does none of the gcc documentation mention this?!
Thanks! In my case I didn't even have to link the .a to the .so, just removing the original .so link was enough.
Thank you! I cannot even express how extremely helpful piece information this is for me. But I would be more than interested also why it's not working with shared library?
Thanks for pointing out the problem! Another fix, change the makefile, to link with f2c statically and with the rest dynamically, i.e.:
LAPACKLIBS=-llapack -lblas -Wl,-Bstatic -lf2c -Wl,-Bdynamic
Which is on line 18 in levmar 2.5, works just fine :)
You deserve a million thank yous...
Hello,
I tried doing this but it still gives me an error as -
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libf2c.so(main.o): In function `main':
/build/buildd/libf2c2-20090411/main.c:138: undefined reference to `MAIN__'
collect2: ld returned 1 exit status
Can you plz help me with this?
Thanks in advance...
I'm having exactly the same issue as Roger-- does anyone have any insight? Thank you!
Thank you!
Another big thank you!
Hello from 2017 ¬¬
I am having this problem, but with the file - libf2c.so.2 - I don't know how to link it to the dynamic.
I created this thread:
https://stackoverflow.com/questions/45382324/dont-know-how-to-deal-with-a-f2c-error
This:
rm /usr/lib/libf2c.so.2 && ln -s /usr/lib/libf2c.a /usr/lib/libf2c.so.2
Didn't work.
with modern gcc you can just link like this
-l:libf2c.a
to link to the static library on your system
Post a Comment