From: Peter Wood Date: 2005-04-06T23:33:24+09:00 Subject: Re: extconf.rb and dyld problem >hello people! > >just trying to use extconf.rb script using mkmf to compile a bundle >for osx (some c++ libraries) > >compilation is going ok and linking (even libstdc++) seems ok, but >invoking the shared bundle in IRB gives me: > >dyld: ruby Undefined symbols: > >(long list of symbols) > >could someone point at the most common reason this happens? > >sorry for such n00b question, but just can't figure it out, tried >several different LDFLAGS options after googling, and currently have >the following options set: > >if RUBY_PLATFORM =~ /darwin/ > $CPPFLAGS += " -DUNIX" > $LDFLAGS += " -lstdc++ -L/usr/local/lib" > dir_config("fmod","/usr/local/include","/usr/local/lib") >end > >if have_header("fmod.h") > if RUBY_PLATFORM =~ /darwin/ > CONFIG["CC"] = "c++" > CONFIG["LDSHARED"].gsub!("cc","g++") #make sure you're using >g++ so it links libstdc++ > CONFIG['LDSHARED'].gsub!('gcc','g++') > $create = true if have_library("fmod") > elsif have_library("fmod") #more than likely a linux box > CONFIG['LDSHARED'].gsub!('gcc','g++') #make sure c++ gets >linked properly > $create = true > end >end > >any advice? > >thanks! > >david casal From your mail it looks as if you doing your best to use the C++ compiler rather than the standard C compiler. Won't you then be subject to name mangling? Ruby is expecting certain elements under standard names. If those names have been mangled by the C++ compiler it won't find them.