Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / March 2008



Tip: Looking for answers? Try searching our database.

perl 5.10.0 / osx 10.5.2 'make' dies at "error: redefinition of 'union semun'"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Snowcrash+Perl - 05 Mar 2008 18:20 GMT
i'm building perl 5.10.0 on

    Darwin Kernel Version 9.2.0: Tue Feb  5 16:15:19 PST 2008;
root:xnu-1228.3.13~1/RELEASE_PPC
    powerpc-apple-darwin9-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5531)

currently,

    make

dies @ "redef of 'union semun'"

    cd /build/perl-5.10.0
    make
    ...
    In file included from miniperlmain.c:36:
    perl.h:5431: error: redefinition of 'union semun'
    make: *** [miniperlmain.o] Error 1

looking @ perl.h:5427
...
#ifdef HAS_SEM
#   include <sys/ipc.h>
#   include <sys/sem.h>
#   ifndef HAS_UNION_SEMUN  /* Provide the union semun. */
   union semun {
   int     val;
   struct semid_ds *buf;
   unsigned short  *array;
   };
#   endif
#   ifdef USE_SEMCTL_SEMUN
#   ifdef IRIX32_SEMUN_BROKEN_BY_GCC
           union gccbug_semun {
       int             val;
       struct semid_ds *buf;
       unsigned short  *array;
       char            __dummy[5];
       };
#           define semun gccbug_semun
#   endif
#       define Semctl(id, num, cmd, semun) semctl(id, num, cmd, semun)
#   else
#       ifdef USE_SEMCTL_SEMID_DS
#           ifdef EXTRA_F_IN_SEMUN_BUF
#               define Semctl(id, num, cmd, semun) semctl(id, num,
cmd, semun.buff)
#           else
#               define Semctl(id, num, cmd, semun) semctl(id, num,
cmd, semun.buf)
#           endif
#       endif
#   endif
#endif
...

it looks like a HAS_UNION_SEMUN or HAS_SEM needs to be undef'd?

i don't see this issue w/ 5.8.8, so it might be perl-src ...

before I blindly undef/def symbols, can anyone comment/hint on this?

thanks.
Edward Moy - 05 Mar 2008 18:34 GMT
When I build 5.10.0, I don't have this problem.  In config.h, I have:

#define HAS_UNION_SEMUN /**/

Did you run Configure and does your config.h define HAS_UNION_SEMUN?
--------------------------------------------------------------------------
Edward Moy
Apple Inc.
emoy@apple.com

On Mar 5, 2008, at 10:20 AM, snowcrash+perl wrote:

> i'm building perl 5.10.0 on
>
[quoted text clipped - 59 lines]
>
> thanks.
Snowcrash+Perl - 05 Mar 2008 19:02 GMT
hi edward,

> When I build 5.10.0, I don't have this problem.  In config.h, I have:
>
> #define HAS_UNION_SEMUN /**/
>
> Did you run Configure

yes

> and does your config.h define HAS_UNION_SEMUN?

if i

 ./Configure -Dfirstmakefile='GNUmakefile' ...

as usual,

grep HAS_UNION_SEMUN config.h
 /* HAS_UNION_SEMUN:
 /*#define HAS_UNION_SEMUN    / **/

after digging abt in perl src, i note that if i *ADD*

 ./Configure -Dfirstmakefile='GNUmakefile' ... -Dd_union_semun

then,

 grep HAS_UNION_SEMUN config.h
  /* HAS_UNION_SEMUN:
  #define HAS_UNION_SEMUN    /**/

and, subsequent

  make

seems happy with that.

so, the question is -- why's it need to be defined on my system, and
not on yours?

did _you_ run Configure? or the default install?

thanks.
Edward Moy - 05 Mar 2008 19:17 GMT
On Mar 5, 2008, at 11:02 AM, snowcrash+perl wrote:

> hi edward,
>
[quoted text clipped - 38 lines]
>
> did _you_ run Configure? or the default install?

Yes, I run Configure, and it prints:

You have union semun in <sys/sem.h>.

Configure determines this by trying to compile:

----------- try.c -----------
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
int main () { union semun semun; semun.buf = 0; }
------------------------------

What happens when you try to compile the above program?

I forgot to mention that I'm still using the 4.0.1 compiler, while it  
looks like you're using the 4.2 compiler.  If the above fails to  
compile with 4.2, you might try compiling try.c with 4.0.1 just to see  
if 4.2 has a bug (though I would think this unlikely).

--------------------------------------------------------------------------
Edward Moy
Apple Inc.
emoy@apple.com
Snowcrash+Perl - 05 Mar 2008 19:38 GMT
hi,

> Configure determines this by trying to compile:
>
[quoted text clipped - 6 lines]
>
> What happens when you try to compile the above program?

with

    gcc --version
        powerpc-apple-darwin9-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5531)
    gcc -v try.c

looks ok to me,

    Using built-in specs.
    Target: powerpc-apple-darwin9
    Configured with:
/usr/ports/gcc_42-5531/gcc_42-5531/build/obj/src/configure
--disable-checking -enable-werror --prefix=/usr
--mandir=/usr/share/man --enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/
--with-gxx-include-dir=/usr/include/c++/4.0.0 --with-slibdir=/usr/lib
--build=powerpc-apple-darwin9 --host=powerpc-apple-darwin9
--target=powerpc-apple-darwin9
    Thread model: posix
    gcc version 4.2.1 (Apple Inc. build 5531)
    /usr/libexec/gcc/powerpc-apple-darwin9/4.2.1/cc1 -quiet -v
-D__DYNAMIC__ try.c -fPIC -quiet -dumpbase try.c
-mmacosx-version-min=10.5 -auxbase try -version -o
/var/folders/fi/fi+R69XvFXyPa7H6QIvBUk+++TI/-Tmp-//ccDnzd3s.s
    ignoring nonexistent directory
"/usr/lib/gcc/powerpc-apple-darwin9/4.2.1/../../../../powerpc-apple-darwin9/include"
    #include "..." search starts here:
    #include <...> search starts here:
    /usr/local/include
    /usr/lib/gcc/powerpc-apple-darwin9/4.2.1/include
    /usr/include
    /System/Library/Frameworks (framework directory)
    /Library/Frameworks (framework directory)
    End of search list.
    GNU C version 4.2.1 (Apple Inc. build 5531) (powerpc-apple-darwin9)
        compiled by GNU C version 4.2.1 (Apple Inc. build 5531).
    GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
    Compiler executable checksum: 388881bffcb05d987b0795677d6c6078
    /usr/libexec/gcc/powerpc-apple-darwin9/4.2.1/as -arch ppc -o
/var/folders/fi/fi+R69XvFXyPa7H6QIvBUk+++TI/-Tmp-//ccTS1Z3j.o
/var/folders/fi/fi+R69XvFXyPa7H6QIvBUk+++TI/-Tmp-//ccDnzd3s.s
    /usr/libexec/gcc/powerpc-apple-darwin9/4.2.1/collect2 -dynamic -arch
ppc -macosx_version_min 10.5 -weak_reference_mismatches non-weak -o
a.out -lcrt1.10.5.o -L/usr/lib/gcc/powerpc-apple-darwin9/4.2.1
-L/usr/lib/gcc/powerpc-apple-darwin9/4.2.1
-L/usr/lib/gcc/powerpc-apple-darwin9/4.2.1/../../..
/var/folders/fi/fi+R69XvFXyPa7H6QIvBUk+++TI/-Tmp-//ccTS1Z3j.o
-lgcc_s.10.5 -lgcc -lSystemStubs -lSystem

> I forgot to mention that I'm still using the 4.0.1 compiler, while it looks
> like you're using the 4.2 compiler.  If the above fails to compile with 4.2,
> you might try compiling try.c with 4.0.1 just to see if 4.2 has a bug
> (though I would think this unlikely).

    gcc_select 4.0
        Default compiler has been set to:
        gcc version 4.0.1 (Apple Inc. build 5465)
    gcc -v try.c

    Using built-in specs.
    Target: powerpc-apple-darwin9
    Configured with: /var/tmp/gcc/gcc-5465~16/src/configure
--disable-checking -enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.0/
--with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib
--build=i686-apple-darwin9 --program-prefix=
--host=powerpc-apple-darwin9 --target=powerpc-apple-darwin9
    Thread model: posix
    gcc version 4.0.1 (Apple Inc. build 5465)
    /usr/libexec/gcc/powerpc-apple-darwin9/4.0.1/cc1 -quiet -v
-D__DYNAMIC__ try.c -fPIC -quiet -dumpbase try.c
-mmacosx-version-min=10.5 -auxbase try -version -o
/var/folders/fi/fi+R69XvFXyPa7H6QIvBUk+++TI/-Tmp-//ccNmRTyR.s
    ignoring nonexistent directory
"/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/../../../../powerpc-apple-darwin9/include"
    #include "..." search starts here:
    #include <...> search starts here:
    /usr/local/include
    /usr/lib/gcc/powerpc-apple-darwin9/4.0.1/include
    /usr/include
    /System/Library/Frameworks (framework directory)
    /Library/Frameworks (framework directory)
    End of search list.
    GNU C version 4.0.1 (Apple Inc. build 5465) (powerpc-apple-darwin9)
        compiled by GNU C version 4.0.1 (Apple Inc. build 5465).
    GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
    Compiler executable checksum: 9f5f0a20bb36a9596f05e3c117ac5032
    /usr/libexec/gcc/powerpc-apple-darwin9/4.0.1/as -arch ppc -o
/var/folders/fi/fi+R69XvFXyPa7H6QIvBUk+++TI/-Tmp-//ccvNbScg.o
/var/folders/fi/fi+R69XvFXyPa7H6QIvBUk+++TI/-Tmp-//ccNmRTyR.s
    /usr/libexec/gcc/powerpc-apple-darwin9/4.0.1/collect2 -dynamic -arch
ppc -macosx_version_min 10.5 -weak_reference_mismatches non-weak -o
a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin9/4.0.1
-L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1
-L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1
-L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/../../../powerpc-apple-darwin9/4.0.1
-L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/../../..
/var/folders/fi/fi+R69XvFXyPa7H6QIvBUk+++TI/-Tmp-//ccvNbScg.o
-lgcc_s.10.5 -lgcc -lSystemStubs -lSystem

looks effectively the same; only diff is:

GCC 4.2 -> ... --build=powerpc-apple-darwin9
--host=powerpc-apple-darwin9 --target=powerpc-apple-darwin9
GCC 4.0 -> ... --build=i686-apple-darwin9 ..
--host=powerpc-apple-darwin9 --target=powerpc-apple-darwin9
Edward Moy - 05 Mar 2008 20:01 GMT
On Mar 5, 2008, at 11:38 AM, snowcrash+perl wrote:

>> Configure determines this by trying to compile:
>>
[quoted text clipped - 14 lines]
>
> looks ok to me,

(snip)

>> I forgot to mention that I'm still using the 4.0.1 compiler, while  
>> it looks
>> like you're using the 4.2 compiler.  If the above fails to compile  
>> with 4.2,
>> you might try compiling try.c with 4.0.1 just to see if 4.2 has a bug
>> (though I would think this unlikely).

(snip)

> looks effectively the same; only diff is:
>
> GCC 4.2 -> ... --build=powerpc-apple-darwin9
> --host=powerpc-apple-darwin9 --target=powerpc-apple-darwin9
> GCC 4.0 -> ... --build=i686-apple-darwin9 ..
> --host=powerpc-apple-darwin9 --target=powerpc-apple-darwin9

Well, it's a mystery.  The only other thing I can think of is if  
somehow _POSIX_C_SOURCE or _XOPEN_SOURCE are being defined when  
Configure compiles try.c (and union semun would not be defined in sys/
sem.h as per POSIX), but when miniperlmain.c compiles, those macros  
aren't defined, so union semun is visible in sys/sem.h, but by that  
time HAS_UNION_SEMUN has been define, so union semun gets redefined.
--------------------------------------------------------------------------
Edward Moy
Apple Inc.
emoy@apple.com
Snowcrash+Perl - 05 Mar 2008 20:15 GMT
> Well, it's a mystery.

:-)

> The only other thing I can think of is if somehow
> _POSIX_C_SOURCE or _XOPEN_SOURCE are being defined when Configure compiles
> try.c (and union semun would not be defined in sys/sem.h as per POSIX), but
> when miniperlmain.c compiles, those macros aren't defined, so union semun is
> visible in sys/sem.h, but by that time HAS_UNION_SEMUN has been define, so
> union semun gets redefined.

possibly ... checking, neither _POSIX_C_SOURCE or _XOPEN_SOURCE are
def'd in perl's config.h

either way, for now, my workaround (adding the option to config) seems
to work -- and, afaict, causes no harm.

thanks for the help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.