PDA

View Full Version : Installing Perl packages, problem compiling/linking


stevec
01-25-2002, 09:42 AM
I'm trying to install the Perl Cryptix package (available from http://www.cryptix.com/). It uses the standard perl installation process (perl Makefile.PL, make, etc). However, I get the following error during the make step. Anyone have any suggestions?

(following lines pasted from console output)

/usr/bin/perl -I/System/Library/Perl/darwin -I/System/Library/Perl /System/Library/Perl/ExtUtils/xsubpp -typemap /System/Library/Perl/ExtUtils/typemap -typemap typemap Blowfish.xs > Blowfish.xsc && mv Blowfish.xsc Blowfish.c

cc -c -g -pipe -pipe -fno-common -no-cpp-precomp -flat_namespace -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing -O3 -DVERSION=\"1.03\" -DXS_VERSION=\"1.03\" -I/System/Library/Perl/darwin/CORE Blowfish.c

cc: -flat_namespace: linker input file unused since linking not done

Running Mkbootstrap for Crypt::Blowfish ()
chmod 644 Blowfish.bs
LD_RUN_PATH="" cc -o ../blib/arch/auto/Crypt/Blowfish/Blowfish.bundle -bundle -flat_namespace -undefined suppress Blowfish.o blowfish.o

/usr/bin/ld: multiple definitions of symbol _XS_Crypt__Blowfish_crypt

Blowfish.o definition of _XS_Crypt__Blowfish_crypt in section (__TEXT,__text)

blowfish.o definition of _XS_Crypt__Blowfish_crypt in section (__TEXT,__text)

/usr/bin/ld: multiple definitions of symbol _XS_Crypt__Blowfish_init

Blowfish.o definition of _XS_Crypt__Blowfish_init in section (__TEXT,__text)

blowfish.o definition of _XS_Crypt__Blowfish_init in section (__TEXT,__text)

/usr/bin/ld: multiple definitions of symbol _boot_Crypt__Blowfish

Blowfish.o definition of _boot_Crypt__Blowfish in section (__TEXT,__text)

blowfish.o definition of _boot_Crypt__Blowfish in section (__TEXT,__text)
make[1]: *** [../blib/arch/auto/Crypt/Blowfish/Blowfish.bundle] Error 1
make: *** [subdirs] Error 2
[

Novajo
01-25-2002, 10:51 AM
By far the best way to install perl modules is to use the CPAN.pm package.
CPAN allows you to download all the necessary packacges, compile, test and install with a single command. The module has to be on www.CPAN.org and I did not find cryptix, so this will be for future reference. Type

perl -MCPAN -e shell


Run it once, it will create a file called ~/.cpan/CPAN/MyConfig.pm). IF it does not, here is mine (which is a modified copy of /System/Library/Perl/CPAN/Config.pm):



# This is CPAN.pm's systemwide configuration file. This file provides
# defaults for users, and the values can be changed in a per-user
# configuration file. The user-config file is being looked for as
# ~/.cpan/CPAN/MyConfig.pm.

$CPAN::Config = {
'build_cache' => q[10],
'build_dir' => q[/Volumes/Documents/Users/dccote/.cpan/build],
'cpan_home' => q[/Volumes/Documents/Users/dccote/.cpan],
'ftp' => q[/usr/bin/ftp],
'ftp_proxy' => q[],
'getcwd' => q[cwd],
'gzip' => q[/usr/bin/gzip],
'http_proxy' => q[],
'inactivity_timeout' => q[0],
'index_expire' => q[1],
'inhibit_startup_message' => q[0],
'keep_source_where' => q[/Volumes/Documents/Users/dccote/.cpan/sources],
'lynx' => q[],
'make' => q[/usr/bin/make],
'make_arg' => q[],
'make_install_arg' => q[],
'makepl_arg' => q[PREFIX=/usr/local INSTALLMAN1DIR=/usr/local/share/man/man1 I
NSTALLMAN3DIR=/usr/local/share/man/man3],
'ncftp' => q[/usr/bin/ncftp],
'ncftpget' => q[],
'no_proxy' => q[],
'pager' => q[/usr/bin/less],
'prerequisites_policy' => q[follow],
'scan_cache' => q[atstart],
'shell' => q[/bin/tcsh],
'tar' => q[/usr/bin/tar],
'unzip' => q[/usr/bin/unzip],
'urllist' => [ q[ftp://cpan.mirror.smartworker.org/pub/CPAN] ],
'wait_list' => [q[wait://ls6.informatik.uni-dortmund.de:1404]],
};
1;
__END__


and then in the shell, type


install Apache::DBI (for instance)

This is very simple to use.

rudar
02-15-2002, 12:24 AM
Hey, wow. I might be able to offer useful advice!

There's some weirdness with apples compiling/ linking and two-level versus flat namespaces. Basically, flat namespace means that everything has a name, and that's all. Two-level namespace means that things have a name, and then a name of the thing that calls them that. (Does that make any sense?) Normally, two-level namespace is used by default by os x, but that often seems to cause trouble with porting packages, so we're often told to switch to flat namespace when compiling. Unfortunately, if you do this, sometimes two things will have named other things with the same name, which seems to be what your error messages are saying.

I would try compiling cryptix using the two-level namespace option. The qquestion is, how di you switch to flat namespace? Generally, this would be done by adding a 'setenv CFLAGS -flat_namespace' line to your .cshrc. Try typing 'env' at a prompt and look through the output. If there's something like the above (I must admit I'm too tired & drunk to remember the proper punctuation...), then type "setenv CFLAGS 'two-level_namespace'" (or maybe two_level_namespace, or twolevel_namespace). If there's nothing in your 'env' output, things might get confusing...

For more info, search Apple's Knowledge Base for flat namespace; there's an OK article on there about the issue.