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,738
  • 21
  • 105
  • 131

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
  • 199,314
  • 34
  • 295
  • 362
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
  • 37,241
  • 25
  • 195
  • 267