Share

p7zip

Tracker: Bugs

5 Linking fails with MacOSX (all XCode-3.1.2 compilers) - ID: 2483775
Last Update: Comment added ( myspace )


Hi,

I am having a terribly difficult time trying to build p7zip-4.61 (this also
occurs with 4.58).

As the console log attachment shows, 'make all3' is unable to find some
symbols during link time of 7zCon.sfx and of 7z.

I have tested with all gcc-4.x and llvm compilers offered with Apple's
XCode-3.1.2 (latest ATM) running MacOSX Leopard 10.5.6 (latest ATM) on a
Core2Duo iMac.

The only thing I have not done is switch to gcc-3.3 which I really do not
want to do.

I _really_ want to use Apple's -fast and -mtune/-march flags as shown. In
order to be sure these get passed into the makefiles, I altered
makefile.macosx slightly and renamed it to makefile.machine (attached) with
related compiler env-vars set-&-exported.

BTW I also had to patch ./CPP/7zip/Archive/Zip/ZipHandler.h to fix another
missing symbol (easy to figure out, patch attached) because we did not have
COMPRESS_MT defined (doing that will cause other problems IIRC).

Could someone help me please with the link problems? Thank you very much.


Sci_Fi ( sci_fi ) - 2009-01-03 14:53

5

Open

None

my space

None

None

Public


Comments ( 3 )

Date: 2009-03-15 11:14
Sender: myspaceProject Admin


I just tried llvm-gcc/g++ 4.2 on Ubuntu 8.10 x86.

When I replace gcc/g++ with llvm-gcc/g++.
make clean
make all_test
do pass all the tests


But if I use these flags "-O4 -fast -mtune=core2 -march=core2" instead of
"-O"
the built failed with this error :
myGetTickCount.o: file not recognized: File format not recognized

I'm not surprised that a compiler generates bad binaries when using too
much optimisation flags ;)

That why, in the makefile provided with p7zip, I often use "-O1" flags
...
(on some version of gcc, "-O2" flag generated bad binaries ...)


Please try llvm-gcc/g++ with the flag "-O0", then "-O1", then "-O2", then
"-O4 -fast"
then add "-mtune=core2 -march=core2" ...
You should try "-m32" instead of "-m64" ...

I really think that you ask for too much optimizations ...

Remark : sometimes "-O1" builds a faster executable than "-O4" ...



Date: 2009-02-24 16:32
Sender: sci_fi


Hi,

Appreciate your help, yes I believe when I was using Tiger on the Core2Duo
we did not have much problem compiling 4.58.

But I said we use Leopard here anymore, so…

What's more, Apple intends to build everything inside SnowLeopard (10.6)
with the llvm compiler suite in XCode-3.x (we have 3.1.2 here now).

Anyway, we're getting a smidge-bit closer with the p7zip-4.65 tarball.

For some reason the DLL.o did not build here, I suppose because it is only
for m$ system.

(narrowed it down to this link cmd and location)

$ pwd
/Volumes/ProjectsTodoStuff/Projects/p7zip_4.65/CPP/7zip/Bundles/Alone7z

$ llvm-g++-4.2 -O4 -fast -g -mtune=core2 -march=core2
-force_cpusubtype_ALL -arch x86_64 -m64 -DENV_MACOSX
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -DENV_UNIX
-O4 -fast -g -mtune=core2 -march=core2 -force_cpusubtype_ALL -arch
x86_64 -m64 -I../../../myWindows -I../../../ -I../../../include_windows
-DENV_MACOSX -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG
-D_REENTRANT -DENV_UNIX -DCOMPRESS_MT -DEXTERNAL_LZMA -DEXTERNAL_CODECS
-DBREAK_HANDLER -DBENCH_MT -o ../../../../bin/7z -O4 -fast -g
-mtune=core2 -march=core2 -force_cpusubtype_ALL -arch x86_64 -m64
mySplitCommandLine.o myAddExeFlag.o wine_date_and_time.o ConsoleClose.o
ExtractCallbackConsole.o List.o Main.o MainAr.o OpenCallbackConsole.o
PercentPrinter.o UpdateCallbackConsole.o UserInputUtils.o
CommandLineParser.o CRC.o IntToString.o ListFileUtils.o StdInStream.o
StdOutStream.o MyString.o MyWindows.o StringConvert.o StringToInt.o
UTFConvert.o MyVector.o Wildcard.o DLL.o Error.o FileDir.o FileFind.o
FileIO.o FileName.o PropVariant.o PropVariantConversions.o System.o Time.o
FilePathAutoRename.o FileStreams.o ProgressUtils.o StreamUtils.o
ArchiveCommandLine.o ArchiveExtractCallback.o ArchiveOpenCallback.o
DefaultName.o EnumDirItems.o Extract.o ExtractingFilePath.o LoadCodecs.o
OpenArchive.o PropIDUtils.o SetProperties.o SortUtils.o TempFiles.o
Update.o UpdateAction.o UpdateCallback.o UpdatePair.o UpdateProduce.o
CopyCoder.o LzmaBench.o LzmaBenchCon.o Threads.o 7zCrc.o
i686-apple-darwin9-llvm-g++-4.2: DLL.o: No such file or directory

So I took out the DLL.o in the above:

$ llvm-g++-4.2 -O4 -fast -g -mtune=core2 -march=core2
-force_cpusubtype_ALL -arch x86_64 -m64 -DENV_MACOSX
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -DENV_UNIX
-O4 -fast -g -mtune=core2 -march=core2 -force_cpusubtype_ALL -arch
x86_64 -m64 -I../../../myWindows -I../../../ -I../../../include_windows
-DENV_MACOSX -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG
-D_REENTRANT -DENV_UNIX -DCOMPRESS_MT -DEXTERNAL_LZMA -DEXTERNAL_CODECS
-DBREAK_HANDLER -DBENCH_MT -o ../../../../bin/7z -O4 -fast -g
-mtune=core2 -march=core2 -force_cpusubtype_ALL -arch x86_64 -m64
mySplitCommandLine.o myAddExeFlag.o wine_date_and_time.o ConsoleClose.o
ExtractCallbackConsole.o List.o Main.o MainAr.o OpenCallbackConsole.o
PercentPrinter.o UpdateCallbackConsole.o UserInputUtils.o
CommandLineParser.o CRC.o IntToString.o ListFileUtils.o StdInStream.o
StdOutStream.o MyString.o MyWindows.o StringConvert.o StringToInt.o
UTFConvert.o MyVector.o Wildcard.o DLL.o Error.o FileDir.o FileFind.o
FileIO.o FileName.o PropVariant.o PropVariantConversions.o System.o Time.o
FilePathAutoRename.o FileStreams.o ProgressUtils.o StreamUtils.o
ArchiveCommandLine.o ArchiveExtractCallback.o ArchiveOpenCallback.o
DefaultName.o EnumDirItems.o Extract.o ExtractingFilePath.o LoadCodecs.o
OpenArchive.o PropIDUtils.o SetProperties.o SortUtils.o TempFiles.o
Update.o UpdateAction.o UpdateCallback.o UpdatePair.o UpdateProduce.o
CopyCoder.o LzmaBench.o LzmaBenchCon.o Threads.o 7zCrc.o
Undefined symbols:
"NCompress::NLzma::CDecoder::CDecoder()", referenced from:
llvm bitcode in LzmaBench.o
"NCompress::NLzma::CEncoder::CEncoder()", referenced from:
llvm bitcode in LzmaBench.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I can manually build DLL.o and put it into the link, but we still have the
missing symbols problem, same as above.

I believe the smaller restricted 7za and 7zr do build and pass "make test"
at least.

Apparently the 7zCon.sfx builds also, but no way to test it here (and not
so worried about it myself).

The "do-everything" 7z binary is the _only_ thing now that won't build
with the 4.65 tarball here ("make all3").

Thank you for any help.




Date: 2009-02-14 19:03
Sender: myspaceProject Admin

Hi,

I always try to build p7ip on MacOSX
- 10.4.8 x86 with XCode 2.4.1 (gcc 4.0.1).
- 10.3 ppc32 with gcc 3.x

p7zip-4.61 (and now p7zip-4.65) are successfully built on this MacOSX.

procedure :

cp makefile.macosx makefile.machine

make all_test

7za, 7z, 7zr pass all my tests ;)

Please try p7zip-4.65 with this procedure on your MacOSX.




Attached Files ( 3 )

Filename Description Download
p7zip461makeerrorsconsolelog.txt console output from 'make all3' showing missing symbols Download
makefile.machine main makefile includes this Download
ZipHandler.h.patch patch to ensure _numThreads is declared no matter what Download

Changes ( 4 )

Field Old Value Date By
assigned_to nobody 2009-03-15 11:14 myspace
File Added 307622: ZipHandler.h.patch 2009-01-03 14:57 sci_fi
File Added 307621: makefile.machine 2009-01-03 14:55 sci_fi
File Added 307620: p7zip461makeerrorsconsolelog.txt 2009-01-03 14:53 sci_fi