Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 109949 - Problem while emerge app-arch/p7zip-4.42
Summary: Problem while emerge app-arch/p7zip-4.42
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Mac OSX (show other bugs)
Hardware: PPC OS X
: High normal (vote)
Assignee: Gentoo for Mac OS X
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-20 13:44 UTC by Dirk Schoenberger
Modified: 2006-08-27 13:12 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
explicit cast to wanted pointer (DLL.patch,668 bytes, patch)
2005-10-25 11:52 UTC, Dirk Schoenberger
Details | Diff
create a MacOSX friendly build environment (ebuild-macosx.patch,406 bytes, patch)
2005-10-27 15:43 UTC, Dirk Schoenberger
Details | Diff
patch for the 42 ebuild (p7zip.diff,585 bytes, patch)
2006-08-27 11:19 UTC, Fabian Groffen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Schoenberger 2005-10-20 13:44:03 UTC
While trying to emerge p7zip-4.27 I ran into the following problem

g++ -O2 -pipe -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -
DENV_UNIX  -c -I../../../myWindows -I../../../ -I../../../include_windows ./OpenCallbackConsole.cpp
g++ -O2 -pipe -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -
DENV_UNIX  -c -I../../../myWindows -I../../../ -I../../../include_windows ./PercentPrinter.cpp
g++ -O2 -pipe -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -
DENV_UNIX  -c -I../../../myWindows -I../../../ -I../../../include_windows ./UpdateCallbackConsole.cpp
g++ -O2 -pipe -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -
DENV_UNIX  -c -I../../../myWindows -I../../../ -I../../../include_windows ./UserInputUtils.cpp
g++ -O2 -pipe -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -
DENV_UNIX  -c -I../../../myWindows -I../../../ -I../../../include_windows ../../../Windows/DLL.cpp
../../../Windows/DLL.cpp: In member function 'bool NWindows::NDLL::CLibrary::Free()':
../../../Windows/DLL.cpp:41: error: invalid conversion from 'void*' to '__NSModule*'
../../../Windows/DLL.cpp:41: error:   initializing argument 1 of 'bool NSUnLinkModule(__NSModule*, 
uint32_t)'
../../../Windows/DLL.cpp: In function 'int (* NWindows::NDLL::local_GetProcAddress(void*, const 
CHAR*))()':
../../../Windows/DLL.cpp:63: error: invalid conversion from 'void*' to '__NSModule*'
../../../Windows/DLL.cpp:63: error:   initializing argument 1 of '__NSSymbol* NSLookupSymbolInModule
(__NSModule*, const char*)'
make[1]: *** [DLL.o] Error 1
make: *** [7z] Error 2
make: *** Waiting for unfinished jobs....


Reproducible: Always
Steps to Reproduce:
1.
2.
3.




Portage 2.0.51.22-r3 (default-darwin/macos/10.4, gcc-4.0.0, libsystem-7.1-r0, 8.2.0 Power 
Macintosh)
===============================================================
==
System uname: 8.2.0 Power Macintosh powerpc
macos-20041118
distcc 2.0.1-zeroconf powerpc-apple-darwin7.0 (protocol 1) (default port 3632) [disabled]
dev-lang/python:     [Not Present]
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  [Not Present]
sys-devel/automake:  [Not Present]
sys-devel/binutils:  [Not Present]
sys-devel/libtool:   [Not Present]
virtual/os-headers:  7.1
ACCEPT_KEYWORDS="ppc-macos"
AUTOCLEAN="yes"
CBUILD="powerpc-apple-darwin8"
CFLAGS="-O2 -pipe"
CHOST="powerpc-apple-darwin8"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/
qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig collision-protect distlocks sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/
gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="ppc aalib emboss gdbm gif imagemagick libwww nls ogg opengl png ppc-macos qt sdl slang tiff 
vorbis userland_Darwin kernel_Darwin elibc_Darwin"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Comment 1 Canal Vorfeed 2005-10-24 17:02:48 UTC
Note: this is known problem (see bug #104248) but noone who care about p7zip
have access to MacOS X so you are on your own there.
Comment 2 Dirk Schoenberger 2005-10-25 11:51:51 UTC
After searching a little the problem seems to be that MacOSXs gcc doesn't line to implicitly cast between a 
void* and a typed pointer.
The solution could be an explicit cast (as in the attached pacth against Windows/DLL.cc)
This is not tested.
Comment 3 Dirk Schoenberger 2005-10-25 11:52:32 UTC
Created attachment 71440 [details, diff]
explicit cast to wanted pointer
Comment 4 Fabian Groffen gentoo-dev 2005-10-26 02:46:34 UTC
hmmm, using your patch, I now get a normal error, Dirk:

powerpc-apple-darwin8-g++-4.0.0: unrecognized option '-shared'
/usr/bin/ld: Undefined symbols:
_main
collect2: ld returned 1 exit status
make[1]: *** [../../../bin/Formats/7z.so] Error 1
make: *** [7z] Error 2


Did you perhaps patch something more?
Comment 5 Dirk Schoenberger 2005-10-26 05:52:02 UTC
> hmmm, using your patch, I now get a normal error, Dirk:

> powerpc-apple-darwin8-g++-4.0.0: unrecognized option '-shared'

This means that the original problem (a compiler error about incompatibility
between a void* and __NSModule*) seems to be solved.
No there is only a linker error left.

Problem is I could not reproduce the compiler error without the ebuild, so my
patch was purely speculative (and seemingly not complete)
Comment 6 Dirk Schoenberger 2005-10-27 15:42:59 UTC
> hmmm, using your patch, I now get a normal error, Dirk:

> powerpc-apple-darwin8-g++-4.0.0: unrecognized option '-shared'
> /usr/bin/ld: Undefined symbols:
> _main

From what I understood, you are supposed to use the correct makefile.* in the root folder, and copy or 
link the correct file to makefile.machine. This makefile.machine file is included by several sub-
makefiles.
The remaining problem is that the application compiles and links fine, but it links against 
hardcoded .so (instead of .dylib) files. 

I attach a changed ebuild file. This must possibly be made platform dependent, i.e. it needs additional 
checks.
Comment 7 Dirk Schoenberger 2005-10-27 15:43:42 UTC
Created attachment 71591 [details, diff]
create a MacOSX friendly build environment
Comment 8 Fabian Groffen gentoo-dev 2006-01-31 13:36:56 UTC
a gcc4.1 fix has been committed for p7zip-4.30.  It compiles till the linker problem (
powerpc-apple-darwin8-g++-4.0.1: unrecognized option '-shared'
/usr/bin/ld: Undefined symbols:
_main
collect2: ld returned 1 exit status
), which if I read correctly is a 'profile' issue.  I hope to be able to look into this later to see if it is easy to 'switch' this profile from the ebuild somehow.
Comment 9 Radoslaw Stachowiak (RETIRED) gentoo-dev 2006-08-27 09:36:48 UTC
Could You please test newest version of p7zip and provide Your observations?
Comment 10 Fabian Groffen gentoo-dev 2006-08-27 10:28:53 UTC
g++ -O3 -pipe -s -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -DENV_UNIX -DCOMPRESS_MT -shared -o ../../../bin/Formats/7z.so -Wl,-search_paths_first ../../../Common/MyWindows.o ../../../Common/Alloc.o ../../../Common/Vector.o ../../../Common/StringConvert.o ../../../Common/String.o ../../../Common/CRC.o ../../../Common/IntToString.o ../../../Common/StringToInt.o DllExports.o 7zDecode.o 7zEncode.o 7zExtract.o 7zFolderInStream.o 7zFolderOutStream.o 7zHandler.o 7zHandlerOut.o 7zHeader.o 7zIn.o 7zMethodID.o 7zMethods.o 7zOut.o 7zProperties.o 7zSpecStream.o 7zUpdate.o CodecsPath.o CoderLoader.o CoderMixer2.o CoderMixer2MT.o CrossThreadProgress.o FilterCoder.o InStreamWithCRC.o ItemNameUtils.o MultiStream.o StreamUtils.o OutStreamWithCRC.o ParseProperties.o InOutTempBuffer.o LimitedStreams.o LockedStream.o OutBuffer.o ProgressUtils.o StreamBinder.o StreamObjects.o DLL.o FileDir.o FileFind.o FileIO.o PropVariant.o Synchronization.o CopyCoder.o ../../../myWindows/wine_date_and_time.o ../../../myWindows/myModuleFileName.o ../../../myWindows/myGetNumberOfProcessors.o -lpthread -ldl
powerpc-apple-darwin8-g++-4.0.1: unrecognized option '-shared'
/usr/bin/ld: Undefined symbols:
_main
collect2: ld returned 1 exit status
make[1]: *** [../../../bin/Formats/7z.so] Error 1
make: *** [7z] Error 2
make: *** Waiting for unfinished jobs....


Looks like the main program isn't linked in.  Haven't looked at it any closer.
Comment 11 Radoslaw Stachowiak (RETIRED) gentoo-dev 2006-08-27 10:38:41 UTC
Was http://bugs.gentoo.org/show_bug.cgi?id=109949#c10 result of 4.42 compilation?
Comment 12 Fabian Groffen gentoo-dev 2006-08-27 10:40:42 UTC
yes, I ran it before reporting.
Comment 13 Radoslaw Stachowiak (RETIRED) gentoo-dev 2006-08-27 10:45:29 UTC
I have no knowlegde of macos, but maybe 
"powerpc-apple-darwin8-g++-4.0.1: unrecognized option '-shared'" is a hint?
is there any documentation about -shared in mac g++ ?
Comment 14 Fabian Groffen gentoo-dev 2006-08-27 10:58:36 UTC
GCC on OSX can only do dynamic linking, so I'd expect the same behaviour even though the warning.  The Apple linker is just more picky than the GNU one.  Looking through the object list, I don't see an object that could carry main.  I will take a look in the code.
Comment 15 Fabian Groffen gentoo-dev 2006-08-27 11:19:45 UTC
Created attachment 95218 [details, diff]
patch for the 42 ebuild

duh...  See diff.  If you agree, you can apply it and close this bug.  You can include the ~ppc-macos keyword, I hereby grant you my permission for that :)
Comment 16 Radoslaw Stachowiak (RETIRED) gentoo-dev 2006-08-27 13:12:56 UTC
thank You :) /silly me/