I'm attempting to create a ruby native extension, but when I run rake
which uses ext/example_project/extconf.rb
to build my project and run my tests under test/
, I get the following error when the tests are run:
./home/jbuesking/.rbenv/versions/2.3.0/bin/ruby: symbol lookup error:
/home/jbuesking/repositories/example_project/lib/example_project/example_project.so: undefined symbol: some_function
I'm pretty sure my files are not being linked correctly and that I need to alter my extconf.rb
and/or Rakefile
in some way, but I'm not sure how.
I've created a simple repository that demonstrates the issue over on GitHub. It'll fail with the same error if you clone it and run rake
from the projects root.
Some additional information:
- I used the ruby gem
hoe
to create the project viasow example_project
- The failing function is attempting to call a function defined in the subdirectory
ext/example_project/c_example_project
. My actual project uses a git submodule from theext/example_project
directory, which in turn sets up the submodule as a subdirectory. The submodule is a c project with a flattened structure (all files in the root directory). Note: That wording may be confusing, but the key point is that there's a nested c project defined atext/example_project/c_example_project
which has methods I'm trying to call.
Let me know if any clarification is needed, and I'll do my best to provide it.