blairkutz has asked for the wisdom of the Perl Monks concerning the following question:

Hey everybody,
I'm a pretty new Mac user, but have had trouble compiling DBD::ODBC on a new Mac mini machine. I don't want to scare off any non-mac users, cause I don't think it's really a mac problem.. But I'm really stumped on this!

Background:

Setup:

Problem:

When trying to compile DBD::ODBC I get error messages like:
dbdimp.c:3046: error: syntax error before '*' token dbdimp.c:3047: error: syntax error before '*' token dbdimp.c: In function 'S_dbOption': dbdimp.c:3050: error: 'pars' undeclared (first use in this function) dbdimp.c:3050: error: (Each undeclared identifier is reported only onc +e dbdimp.c:3050: error: for each function it appears in.) dbdimp.c:3051: error: 'key' undeclared (first use in this function) dbdimp.c:3051: error: 'len' undeclared (first use in this function)
then finally at the end of the build I get a lipo message about a file not existing..

I don't have ANY C experience, but this sure looks like a compiler thing to me.. The makefile is using a link cc -> gcc-4.0.1. I would have given up right there and thought that something is wrong with the gcc compiler. On a suggestion I tried installing ActivePerl for the mac machine. Tried the exact same steps and it built!!

So how can that be? Diffing the Makefile created by ActiverPerl and the leopard perl shows a lot of differences. I went through them one by one and found that when I change the leopard-perl Makefile's PERL_INC to the Activestate directory the code compiles!!
eg. PERL_INC = /System/Library/Perl/5.8.8/darwin-thread-multi-2level/CORE
to
PERL_INC = /usr/local/ActivePerl-5.8/lib/CORE

There are a lot of header files in there, so really not sure to look for the root cause..

I'm so confused? I don't understand how different header files can make syntax errors appear/disappear? Has anybody seen something like this before?

The goal is to install DBD::ODBC on leopard perl..

Thanks for any advice! :-)

Replies are listed 'Best First'.
Re: Really stumped trying to compile DBD::ODBC
by syphilis (Archbishop) on Feb 19, 2008 at 06:03 UTC
    Prior to the errors you quoted, was there any mention of a header file (or any other file, for that matter) that could not be found ?

    Cheers,
    Rob
      Hi Rob,

      Thanks for the help! I can't find any errors about missing files, but I'll attach the make output from using regular perl then using ActivePerl (sorry about all this text!)

      $ make realclean > /dev/null 2>&1
      $ perl Makefile.PL -o /var/root/perforce_install/ODBC/libiodbc_install_dir
      Useless use of private variable in void context at Makefile.PL line 52 +4. You are using a Perl configured with threading enabled. Please read the warnings in DBI about this. You should also be aware that on non-Windows platforms ODBC drivers co +me in two forms, thread-safe and non-thread-safe drivers and you may need to make sure you are using the right one. Press return to continue... Overriding ODBC Directory with command line option: /var/root/perforce +_install/ODBC/libiodbc_install_dir >>> Remember to actually *READ* the README file! And re-read it if you have any problems. Overriding ODBC Directory with command line option: /var/root/perforce +_install/ODBC/libiodbc_install_dir Using ODBC in /var/root/perforce_install/ODBC/libiodbc_install_dir Umm, this looks like a unixodbc type of driver manager. We expect to find the sql.h, sqlext.h and (which were supplied with unixODBC) in $ODBCHOME/include directory alongside the /var/root/perforce_install/ODBC/libiodbc_install_dir/lib/libodbc.a + library in $ODBCHOME/lib Warning: LD_LIBRARY_PATH doesn't include /var/root/perforce_install/OD +BC/libiodbc_install_dir Checking if your kit is complete... Looks good Using DBI 1.52 (for perl 5.008008 on darwin-thread-multi-2level) insta +lled in /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level/ +auto/DBI/ Using DBI 1.52 (for perl 5.008008 on darwin-thread-multi-2level) insta +lled in /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level/ +auto/DBI/ Writing Makefile for DBD::ODBC The DBD::ODBC tests will use these values for the database connection: DBI_DSN= e.g. dbi:ODBC:demo DBI_USER= DBI_PASS= Warning: not all required environment variables are set.
      $ make
Re: Really stumped trying to compile DBD::ODBC
by chaos_cat (Scribe) on Feb 19, 2008 at 17:07 UTC
    Not sure if this applies here, but I've had problems in the past where modules try to compile with a different C compiler than the base perl build uses. You should be able to find out what C compiler and options your perl was built with via perl -V. Good luck.
      Thanks for the reply!

      Ok so this is the Perl -V output from the perl installed with leopard

      Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=darwin, osvers=9.0, archname=darwin-thread-multi-2level uname='darwin omen.apple.com 9.0 darwin kernel version 9.0.0b5: mo +n sep 10 17:17:11 pdt 2007; root:xnu-1166.6~1release_ppc power macint +osh ' config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags=- +Dman3ext=3pm -Duseithreads -Duseshrplib' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemulti +plicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-arch i386 -arch ppc -g -pipe -fno-common -DPER +L_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-sta +tement -I/usr/local/include', optimize='-O3', cppflags='-no-cpp-precomp -g -pipe -fno-common -DPERL_DARWIN -no-c +pp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/ +local/include' ccversion='', gccversion='4.0.1 (Apple Inc. build 5465)', gccosand +vers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc -mmacosx-version-min=10.5', ldflags ='-arch i386 -arch ppc +-L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libpe +rl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-arch i386 -arch ppc -bundle -undefined + dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Locally applied patches: fix for regcomp CVE-2007-5116 security vulnerability Built under darwin Compiled at Dec 7 2007 09:37:29 @INC: /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin +-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .

      Then the ActivePerl -V

      $ /usr/local/ActivePerl-5.8/bin/perl -V Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=darwin, osvers=8.10.0, archname=darwin-thread-multi-2level uname='darwin sphinx 8.10.0 darwin kernel version 8.10.0: wed may +23 16:50:59 pdt 2007; root:xnu-792.21.3~1release_ppc power macintosh +powerpc ' config_args='-ders -Dcc=gcc -Dusethreads -Duseithreads -Ud_sigsetj +mp -Uinstallusrbinperl -Ulocincpth= -Uloclibpth= -Ud_poll -Ui_poll -U +d_pthread_atfork -Ud_msg -Ud_lchown -Ud_attribute_format -Ud_attribut +e_malloc -Ud_attribute_nonnull -Ud_attribute_noreturn -Ud_attribute_p +ure -Ud_attribute_unused -Ud_attribute_warn_unused_result -Aldflags=- +Wl,-search_paths_first -Alddlflags=-Wl,-search_paths_first -Accflags= +-arch ppc -arch i386 -Aldflags=-arch ppc -arch i386 -Alddlflags=-arch + ppc -arch i386 -Accflags=-nostdinc -B/Developer/SDKs/MacOSX10.4u.sdk +/usr/include/gcc -B/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc -isyst +em/Developer/SDKs/MacOSX10.4u.sdk/usr/include -F/Developer/SDKs/MacOS +X10.4u.sdk/System/Library/Frameworks -mmacosx-version-min=10.3 -Aldfl +ags=-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version- +min=10.3 -Alddlflags=-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk +-mmacosx-version-min=10.3 -Accflags=-DUSE_SITECUSTOMIZE -Duselargefil +es -Accflags=-DNO_HASH_SEED -Accflags=-DPRIVLIB_LAST_IN_INC -Dprefix= +/usr/local/ActivePerl-5.8 -Dprivlib=/usr/local/ActivePerl-5.8/lib -Da +rchlib=/usr/local/ActivePerl-5.8/lib -Dsiteprefix=/usr/local/ActivePe +rl-5.8/site -Dsitelib=/usr/local/ActivePerl-5.8/site/lib -Dsitearch=/ +usr/local/ActivePerl-5.8/site/lib -Dsed=/usr/bin/sed -Duseshrplib -Dc +onfig_heavy=Config_dynamic.pl -Dcf_by=ActiveState -Dcf_email=support@ +ActiveState.com' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemulti +plicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -arc +h ppc -arch i386 -nostdinc -B/Developer/SDKs/MacOSX10.4u.sdk/usr/incl +ude/gcc -B/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc -isystem/Develo +per/SDKs/MacOSX10.4u.sdk/usr/include -F/Developer/SDKs/MacOSX10.4u.sd +k/System/Library/Frameworks -mmacosx-version-min=10.3 -DUSE_SITECUSTO +MIZE -DNO_HASH_SEED -DPRIVLIB_LAST_IN_INC -fno-strict-aliasing -pipe' +, optimize='-O3', cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precom +p -arch ppc -nostdinc -B/Developer/SDKs/MacOSX10.4u.sdk/usr/include/g +cc -B/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc -isystem/Developer/S +DKs/MacOSX10.4u.sdk/usr/include -F/Developer/SDKs/MacOSX10.4u.sdk/Sys +tem/Library/Frameworks -mmacosx-version-min=10.3 -DUSE_SITECUSTOMIZE +-DNO_HASH_SEED -DPRIVLIB_LAST_IN_INC -fno-strict-aliasing -pipe' ccversion='', gccversion='i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 + (Apple Inc. build 5465)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -Wl,-search_ +paths_first -arch ppc -arch i386 -Wl,-syslibroot,/Developer/SDKs/MacO +SX10.4u.sdk -mmacosx-version-min=10.3' libpth=/usr/lib /usr/local/lib libs=-ldbm -ldl -lm -lc perllibs=-ldl -lm -lc libc=, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -Wl, +-search_paths_first -arch ppc -arch i386 -Wl,-syslibroot,/Developer/S +DKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API USE_SITECUSTOMIZE Locally applied patches: ActivePerl Build 822 [280952] PerlEx support in CGI::Carp Less verbose ExtUtils::Install and Pod::Find Patch for CAN-2005-0448 from Debian with modifications Rearrange @INC so that 'site' is searched before 'perl' Partly reverted 24733 to preserve binary compatibility MAINT31223 plus additional changes 31324 Fix DynaLoader::dl_findfile() to locate .so files again 26970 Make Passive mode the default for Net::FTP 24699 ICMP_UNREACHABLE handling in Net::Ping Built under darwin Compiled at Jul 31 2007 19:44:51 @INC: /var/root/Library/ActivePerl/lib /usr/local/ActivePerl-5.8/site/lib /usr/local/ActivePerl-5.8/lib .
        The problem is the use of structure member names 'true' and 'false'. The compiler on os x does not seem to like these - perhaps they are macros. Just change all occurrences of 'true' and 'false' to xtrue and xfalse to fix or upgrade to DBD::ODBC 1.16 where this is fixed.
Re: Really stumped trying to compile DBD::ODBC
by Anonymous Monk on Feb 19, 2008 at 17:36 UTC
    I'm also trying to install DBD::ODBC and the make is also giving a bunch of errors (same as yours) and at the end the build bails out with a message

    lipo: can't open input file: /var/tmp//ccXRvwZH.out (No such file or directory).

    So there's something on the air with the Leopard's perl.

    Regards,
    Jokke H.

      Yeah I think so too. I've been trying to install P4perl on the leopard machine w/ no luck. Lots of error message about architecture :-(

      Same error here. OS X 10.5.2 -waltimo
Re: Really stumped trying to compile DBD::ODBC
by Anonymous Monk on Mar 01, 2008 at 22:35 UTC
    I GOT THE SAME ISSUE... man oh man!!!
      I'm getting the same error, except I'm on 10.4.11... tried different DBD drivers and receive the same exact error. Definitely seems like a compiler issue. My unixODBC and TDS drivers work perfectly when used independently.