Problem with mkmf on OS X

Hello,

I've got the following extconf.rb:

# begin
require "mkmf"

dir_config "SQLite", "/usr/local"

if find_library("sqlite", "sqlite_open", "/usr/local/lib", "/usr/pkg/lib", "/sw/lib") and have_header("sqlite.h")
  create_makefile "SQLite"
end
#end

When I run it I get "checking for sqlite_open() in -lsqlite... no",
although the sqlite lib exists in /sw/lib and the header file in
/sw/include.

mkmf.log follows:

find_library: checking for sqlite_open() in -lsqlite... --------------------
gcc -o conftest -I/sw/lib/ruby/1.8/powerpc-darwin -I/sw/lib/ruby/1.8/powerpc-darwin -I/usr/local/include -I/sw/include -g -O2 -fno-common -pipe conftest.c -L/sw/lib -L/usr/local/lib -lruby-static -lsqlite -ldl -lobjc
ld: warning -L: directory name (/usr/local/lib) does not exist
ld: can't locate file for: -lruby-static
checked program was:
/* begin */

int main() { return 0; }
int t() { sqlite_open(); return 0; }
/* end */

gcc -o conftest -I/sw/lib/ruby/1.8/powerpc-darwin -I/sw/lib/ruby/1.8/powerpc-darwin -I/usr/local/include -I/sw/include -g -O2 -fno-common -pipe conftest.c -L/sw/lib -L/usr/local/lib -lruby-static -lsqlite -ldl -lobjc
conftest.c: In function `t':
conftest.c:4: error: `sqlite_open' undeclared (first use in this function)
conftest.c:4: error: (Each undeclared identifier is reported only once
conftest.c:4: error: for each function it appears in.)
checked program was:
/* begin */

int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))sqlite_open; return 0; }
/* end */

gcc -o conftest -I/sw/lib/ruby/1.8/powerpc-darwin -I/sw/lib/ruby/1.8/powerpc-darwin -I/usr/local/include -I/sw/include -g -O2 -fno-common -pipe conftest.c -L/sw/lib -L/usr/local/lib -lruby-static -lsqlite -ldl -lobjc
ld: warning -L: directory name (/usr/local/lib) does not exist
ld: can't locate file for: -lruby-static
checked program was:
/* begin */

int main() { return 0; }
int t() { sqlite_open(); return 0; }
/* end */

gcc -o conftest -I/sw/lib/ruby/1.8/powerpc-darwin -I/sw/lib/ruby/1.8/powerpc-darwin -I/usr/local/include -I/sw/include -g -O2 -fno-common -pipe conftest.c -L/sw/lib -L/usr/local/lib -lruby-static -lsqlite -ldl -lobjc
conftest.c: In function `t':
conftest.c:4: error: `sqlite_open' undeclared (first use in this function)
conftest.c:4: error: (Each undeclared identifier is reported only once
conftest.c:4: error: for each function it appears in.)
checked program was:
/* begin */

int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))sqlite_open; return 0; }
/* end */

gcc -o conftest -I/sw/lib/ruby/1.8/powerpc-darwin -I/sw/lib/ruby/1.8/powerpc-darwin -I/usr/local/include -I/sw/include -g -O2 -fno-common -pipe conftest.c -L/sw/lib -L/usr/local/lib -L/usr/pkg/lib -lruby-static -lsqlite -ldl -lobjc
ld: warning -L: directory name (/usr/local/lib) does not exist
ld: warning -L: directory name (/usr/pkg/lib) does not exist
ld: can't locate file for: -lruby-static
checked program was:
/* begin */

int main() { return 0; }
int t() { sqlite_open(); return 0; }
/* end */

gcc -o conftest -I/sw/lib/ruby/1.8/powerpc-darwin -I/sw/lib/ruby/1.8/powerpc-darwin -I/usr/local/include -I/sw/include -g -O2 -fno-common -pipe conftest.c -L/sw/lib -L/usr/local/lib -L/usr/pkg/lib -lruby-static -lsqlite -ldl -lobjc
conftest.c: In function `t':
conftest.c:4: error: `sqlite_open' undeclared (first use in this function)
conftest.c:4: error: (Each undeclared identifier is reported only once
conftest.c:4: error: for each function it appears in.)
checked program was:
/* begin */

int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))sqlite_open; return 0; }
/* end */

gcc -o conftest -I/sw/lib/ruby/1.8/powerpc-darwin -I/sw/lib/ruby/1.8/powerpc-darwin -I/usr/local/include -I/sw/include -g -O2 -fno-common -pipe conftest.c -L/sw/lib -L/usr/local/lib -L/sw/lib -lruby-static -lsqlite -ldl -lobjc
ld: warning -L: directory name (/usr/local/lib) does not exist
ld: can't locate file for: -lruby-static
checked program was:
/* begin */

int main() { return 0; }
int t() { sqlite_open(); return 0; }
/* end */

gcc -o conftest -I/sw/lib/ruby/1.8/powerpc-darwin -I/sw/lib/ruby/1.8/powerpc-darwin -I/usr/local/include -I/sw/include -g -O2 -fno-common -pipe conftest.c -L/sw/lib -L/usr/local/lib -L/sw/lib -lruby-static -lsqlite -ldl -lobjc
conftest.c: In function `t':
conftest.c:4: error: `sqlite_open' undeclared (first use in this function)
conftest.c:4: error: (Each undeclared identifier is reported only once
conftest.c:4: error: for each function it appears in.)
checked program was:
/* begin */

int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))sqlite_open; return 0; }
/* end */

-------------------- no

Hi,

At Sun, 27 Jun 2004 03:13:03 +0900,
Andreas Schwarz wrote in [ruby-talk:104645]:

When I run it I get "checking for sqlite_open() in -lsqlite... no",
although the sqlite lib exists in /sw/lib and the header file in
/sw/include.

ruby extconf.rb --with-opt-dir=/sw

···

--
Nobu Nakada

Hi,

At Sun, 27 Jun 2004 03:13:03 +0900,
Andreas Schwarz wrote in [ruby-talk:104645]:

gcc -o conftest -I/sw/lib/ruby/1.8/powerpc-darwin -I/sw/lib/ruby/1.8/powerpc-darwin -I/usr/local/include -I/sw/include -g -O2 -fno-common -pipe conftest.c -L/sw/lib -L/usr/local/lib -lruby-static -lsqlite -ldl -lobjc
ld: warning -L: directory name (/usr/local/lib) does not exist
ld: can't locate file for: -lruby-static

Is libruby-static.a installed underneath
/sw/lib/ruby/1.8/powerpc-darwin diretory?

And your ruby seems quite old.

···

--
Nobu Nakada

This doesn't change anything.

···

nobu.nokada@softhome.net wrote:

At Sun, 27 Jun 2004 03:13:03 +0900,
Andreas Schwarz wrote in [ruby-talk:104645]:

When I run it I get "checking for sqlite_open() in -lsqlite... no",
although the sqlite lib exists in /sw/lib and the header file in
/sw/include.

ruby extconf.rb --with-opt-dir=/sw

No, it didn't exist at all. Now that I have built ruby from source it works. Thanks for the hint!

Andreas

···

nobu.nokada@softhome.net wrote:

Hi,

At Sun, 27 Jun 2004 03:13:03 +0900,
Andreas Schwarz wrote in [ruby-talk:104645]:

gcc -o conftest -I/sw/lib/ruby/1.8/powerpc-darwin -I/sw/lib/ruby/1.8/powerpc-darwin -I/usr/local/include -I/sw/include -g -O2 -fno-common -pipe conftest.c -L/sw/lib -L/usr/local/lib -lruby-static -lsqlite -ldl -lobjc
ld: warning -L: directory name (/usr/local/lib) does not exist
ld: can't locate file for: -lruby-static

Is libruby-static.a installed underneath
/sw/lib/ruby/1.8/powerpc-darwin diretory?