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
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.
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.
Created attachment 71440 [details, diff] explicit cast to wanted pointer
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?
> 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)
> 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.
Created attachment 71591 [details, diff] create a MacOSX friendly build environment
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.
Could You please test newest version of p7zip and provide Your observations?
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.
Was http://bugs.gentoo.org/show_bug.cgi?id=109949#c10 result of 4.42 compilation?
yes, I ran it before reporting.
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++ ?
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.
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 :)
thank You :) /silly me/