kubo / ruby-oci8

Ruby-oci8 - Oracle interface for ruby
Other
169 stars 78 forks source link

checking for OCIEnvCreate() in oci.h... no // M1 Monterey #240

Closed emgosa closed 8 months ago

emgosa commented 2 years ago

Hi, trying to install ruby-oci8 but dealing with some problems, i fixed all of them except this one... can someone help?

current directory: /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.4.1/ext/oci8 /Users/joker/.rbenv/versions/2.5.3/bin/ruby -r ./siteconf20211220-14166-19796tz.rb extconf.rb checking for load library path... DYLD_LIBRARY_PATH is not set. DYLD_FALLBACK_LIBRARY_PATH is not set. checking OCI_DIR... checking /opt/oracle/instantclient_19_8... yes checking dependent shared libraries in /opt/oracle/instantclient_19_8/libclntsh.dylib.19.1... /opt/oracle/instantclient_19_8/libclntsh.dylib.19.1 looks like an instant client. checking for cc... ok checking for gcc... yes checking for LP64... yes checking for sys/types.h... yes checking for ruby header... ok checking for OCIEnvCreate() in oci.h... no *** extconf.rb failed ***` `Could not create Makefile due to some reason, probably lack of necessary` `libraries and/or headers. Check the mkmf.log file for more details. You may` `need configuration options.` `Provided configuration options:` ` --with-opt-dir` ` --without-opt-dir` ` --with-opt-include` ` --without-opt-include=${opt-dir}/include` ` --with-opt-lib` ` --without-opt-lib=${opt-dir}/lib` ` --with-make-prog` ` --without-make-prog` ` --srcdir=.` ` --curdir` ` --ruby=/Users/joker/.rbenv/versions/2.5.3/bin/$(RUBY_BASE_NAME) --with-instant-client --without-instant-client /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.4.1/ext/oci8/oraconf.rb:1106:in 'block in initialize': RuntimeError (RuntimeError) from /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.4.1/ext/oci8/oraconf.rb:1074:in 'open' from /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.4.1/ext/oci8/oraconf.rb:1074:in 'initialize' from /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.4.1/ext/oci8/oraconf.rb:267:in 'new' from /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.4.1/ext/oci8/oraconf.rb:267:in 'get' from extconf.rb:22:in '<main>' ---------------------------------------------------` `Error Message:` ` Could not compile with Oracle instant client.` ` You may need to set the environment variable RC_ARCHS or ARCHFLAGS as follows:` ` RC_ARCHS=x86_64` ` export RC_ARCHS` ` or` ` ARCHFLAGS='-arch x86_64'` ` export RC_ARCHS` ` If it does not fix the problem, delete all '-arch arm64'` ` in '/Users/joker/.rbenv/versions/2.5.3/lib/ruby/2.5.0/-darwin21/rbconfig.rb'.` `Backtrace:` ` /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.4.1/ext/oci8/oraconf.rb:1106:in 'block in initialize'` ` /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.4.1/ext/oci8/oraconf.rb:1074:in 'open'` ` /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.4.1/ext/oci8/oraconf.rb:1074:in 'initialize'` ` /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.4.1/ext/oci8/oraconf.rb:267:in 'new'` ` /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.4.1/ext/oci8/oraconf.rb:267:in 'get'` ` extconf.rb:22:in `<main>'` --------------------------------------------------- See: http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-full-client.md for Oracle full client http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-instant-client.md for Oracle instant client http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-on-osx.md for OS X http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/report-installation-issue.md to report an issue. To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/extensions/-darwin-21/2.5.0/ruby-oci8-2.2.4.1/mkmf.log extconf failed, exit code 1`

and here is mkmf.log

"clang -o conftest -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/-darwin21 -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/ruby/backward -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0 -I. -I/Users/joker/.rbenv/versions/2.5.3/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/joker/.rbenv/versions/2.5.3/lib -L. -L/Users/joker/.rbenv/versions/2.5.3/lib -fstack-protector -lruby.2.5.3 -lpthread -ldl -lobjc " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return 0; 6: } /* end */ "clang -o conftest -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/-darwin21 -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/ruby/backward -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0 -I. -I/Users/joker/.rbenv/versions/2.5.3/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/joker/.rbenv/versions/2.5.3/lib -L. -L/Users/joker/.rbenv/versions/2.5.3/lib -fstack-protector -lruby.2.5.3 -lpthread -ldl -lobjc " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main() { return 0; } /* end */ ./conftest "clang -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/-darwin21 -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/ruby/backward -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0 -I. -I/Users/joker/.rbenv/versions/2.5.3/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -fno-common -pipe -c conftest.c" checked program was: /* begin */ 1: #include "ruby.h" 2: 3: /*top*/ 4: #ifndef __GNUC__ 5: # error 6: |:/ === __GNUC__ undefined === /:| 7: #endif /* end */ "clang -o conftest -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/-darwin21 -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/ruby/backward -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0 -I. -I/Users/joker/.rbenv/versions/2.5.3/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/joker/.rbenv/versions/2.5.3/lib -L. -L/Users/joker/.rbenv/versions/2.5.3/lib -fstack-protector -lruby.2.5.3 -lpthread -ldl -lobjc " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main() { return sizeof(long) == 8 ? 0 : 1; } /* end */ ./conftest have_header: checking for sys/types.h... -------------------- yes "clang -E -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/-darwin21 -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/ruby/backward -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0 -I. -I/Users/joker/.rbenv/versions/2.5.3/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -fno-common -pipe conftest.c -o conftest.i" checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include <sys/types.h> /* end */ -------------------- have_func: checking for OCIEnvCreate() in oci.h... -------------------- no "clang -o conftest -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/-darwin21 -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/ruby/backward -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0 -I. -I/Users/joker/.rbenv/versions/2.5.3/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -fno-common -pipe -I/opt/oracle/instantclient_19_8/sdk/include conftest.c -L. -L/Users/joker/.rbenv/versions/2.5.3/lib -L. -L/Users/joker/.rbenv/versions/2.5.3/lib -fstack-protector -L/Users/joker/.rbenv/versions/2.5.3/lib -L/opt/oracle/instantclient_19_8 -Wl,-rpath,/opt/oracle/instantclient_19_8 -lclntsh -lruby.2.5.3 -L/Users/joker/.rbenv/versions/2.5.3/lib -L/opt/oracle/instantclient_19_8 -Wl,-rpath,/opt/oracle/instantclient_19_8 -lclntsh -lpthread -ldl -lobjc " ld: warning: ignoring file /opt/oracle/instantclient_19_8/libclntsh.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 Undefined symbols for architecture arm64: "_OCIEnvCreate", referenced from: _t in conftest-4f632f.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include <oci.h> 4: 5: /*top*/ 6: extern int t(void); 7: int main(int argc, char **argv) 8: { 9: if (argc > 1000000) { 10: printf("%p", &t); 11: } 12: 13: return 0; 14: } 15: int t(void) { void ((*volatile p)()); p = (void ((*)()))OCIEnvCreate; return !p; } /* end */ "clang -o conftest -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/-darwin21 -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0/ruby/backward -I/Users/joker/.rbenv/versions/2.5.3/include/ruby-2.5.0 -I. -I/Users/joker/.rbenv/versions/2.5.3/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -fno-common -pipe -I/opt/oracle/instantclient_19_8/sdk/include conftest.c -L. -L/Users/joker/.rbenv/versions/2.5.3/lib -L. -L/Users/joker/.rbenv/versions/2.5.3/lib -fstack-protector -L/Users/joker/.rbenv/versions/2.5.3/lib -L/opt/oracle/instantclient_19_8 -Wl,-rpath,/opt/oracle/instantclient_19_8 -lclntsh -lruby.2.5.3 -L/Users/joker/.rbenv/versions/2.5.3/lib -L/opt/oracle/instantclient_19_8 -Wl,-rpath,/opt/oracle/instantclient_19_8 -lclntsh -lpthread -ldl -lobjc " conftest.c:15:13: error: conflicting types for 'OCIEnvCreate' extern void OCIEnvCreate(); /opt/oracle/instantclient_19_8/sdk/include/ociap.h:7324:9: note: previous declaration is here sword OCIEnvCreate (OCIEnv **envp, ub4 mode, void *ctxp, conftest.c:16:28: error: too few arguments to function call, expected 8, have 0 int t(void) { OCIEnvCreate(); return 0; } /opt/oracle/instantclient_19_8/sdk/include/ociap.h:7324:9: note: 'OCIEnvCreate' declared here sword OCIEnvCreate (OCIEnv **envp, ub4 mode, void *ctxp, 2 errors generated. checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include <oci.h> 4: 5: /*top*/ 6: extern int t(void); 7: int main(int argc, char **argv) 8: { 9: if (argc > 1000000) { 10: printf("%p", &t); 11: } 12: 13: return 0; 14: } 15: extern void OCIEnvCreate(); 16: int t(void) { OCIEnvCreate(); return 0; } /* end */ --------------------

kubo commented 2 years ago

@emgosa See https://github.com/kubo/ruby-oci8/issues/237#issuecomment-929703989 and replace /Users/mattgardner/.rbenv/versions/2.7.3/bin/ruby with /Users/joker/.rbenv/versions/2.5.3/bin/ruby in the comment.

I must write notice about M1 mac...