0

I'm trying to load a library to Firefox, and I get the following error in the terminal:

http://pastebin.com/ZLryd20D,

gcc -Wall -fPIC -c 11.cpp ,

gcc -shared  -o libshared.so 11.o -ldl ,

LD_PRELOAD=$PWD/libshared.so firefox ,

/bin/sh: symbol lookup error: /home/enigma/Desktop/compilacionproceso/libshared.so: undefined symbol: __gxx_personality_v0

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124

2 Answers2

0

gcc -shared -o libshared.so 11.o -ldl -lstdc++

That's the wrong solution, that happens to work on Linux by accident. The correct command line to build your shared library is:

g++ -shared -o libshared.so 11.o

(contrary to popular belief, gcc and g++ are not the same thing).

Employed Russian
  • 182,696
  • 29
  • 267
  • 329
0

Answer from the OP himself, taken from a revision of the question:

I solved the problem adding a flag -lstdc++ for create the library thanks to this post What is __gxx_personality_v0 for?

cd  /directory

gcc -Wall -fPIC -c 11.cpp 

gcc -shared  -o libshared.so 11.o -ldl -lstdc++

LD_PRELOAD=$PWD/libshared.so program 
Cœur
  • 34,719
  • 24
  • 185
  • 251