# Porting libraries with USE_GCC



## jozze (Mar 15, 2014)

Hi guys,
I've been away for about a year now and I see a lot has changed. Well, in any case, I have a problem that I hope you will be able to help me with.

I made a port for a library called math/mathgl and the port did compile and passed all the tests suggested in the Porter's Handbook. I installed this library on my computer and wrote a program, that depended on it. However, when I actually linked to the library (with -lmgl), I got this error

```
...
clang++ -I/usr/local/include/eigen3  -I/usr/local/include  -Wall -O3 -march=corei7 -ffast-math -funroll-loops -L/usr/local/lib  -lm -lmgl main.o walker.o profiles.o -o prg
/usr/local/lib/libmgl.so: undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)@GLIBCXX_3.4.15'
/usr/local/lib/libmgl.so: undefined reference to `std::ctype<char>::_M_widen_init() const@GLIBCXX_3.4.11'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
*** [all] Error code 1
```

The thing is, I had to compile this library with USE_GCC= 4.7+ in order to support some options (like OpenMP for example). The only way for me to use this library then was to use a dirty hack, by adding these lines in /etc/libmap.conf:

```
libgcc_s.so.1    gcc47/libgcc_s.so.1
libgomp.so.1     gcc47/libgomp.so.1
libobjc.so.3     gcc47/libobjc.so.2
libssp.so.0      gcc47/libssp.so.0
libstdc++.so.6   gcc47/libstdc++.so.6
```
and compiling code that depended on this library with lang/gcc47 which I don't like.

Is it possible to build this library with lang/gcc47 and then use it with clang anyway? For now I've disabled the options that need lang/gcc47 so I can compile my programs that depend on MathGL with clang.

The .shar to the port can be found here.

Thank you for your time.


----------

