Opened 3 years ago

Closed 17 months ago

Last modified 17 months ago

#62911 closed defect (fixed)

qpdf @10.3.1 cannot be built with gcc because -latomic is not included in the link

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: leopard Cc:
Port: qpdf

Description

/bin/bash ./libtool --quiet --mode=compile /opt/local/bin/gcc-mp-7 -pipe -Os -arch ppc -fvisibility=hidden   -Wconversion -Wsign-conversion -Wshadow=local  -I/opt/local/include/p11-kit-1 -Wall -MD -MF libqpdf/build/sha2big.tdep -MP -Iinclude -Ilibqpdf -I/opt/local/include -c libqpdf/sha2big.c -o libqpdf/build/sha2big.o; sed -e 's/\.o:/.lo:/' < libqpdf/build/sha2big.tdep > libqpdf/build/sha2big.dep
/bin/bash ./libtool --mode=link /opt/local/bin/g++-mp-7  -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -fvisibility=hidden   -Wconversion -Wsign-conversion -Wshadow=local   -Wold-style-cast -Wall  -o libqpdf/build/libqpdf.la libqpdf/build/BitStream.lo libqpdf/build/BitWriter.lo libqpdf/build/Buffer.lo libqpdf/build/BufferInputSource.lo libqpdf/build/ClosedFileInputSource.lo libqpdf/build/ContentNormalizer.lo libqpdf/build/CryptoRandomDataProvider.lo libqpdf/build/FileInputSource.lo libqpdf/build/InputSource.lo libqpdf/build/InsecureRandomDataProvider.lo libqpdf/build/JSON.lo libqpdf/build/MD5.lo libqpdf/build/NNTree.lo libqpdf/build/OffsetInputSource.lo libqpdf/build/Pipeline.lo libqpdf/build/Pl_AES_PDF.lo libqpdf/build/Pl_ASCII85Decoder.lo libqpdf/build/Pl_ASCIIHexDecoder.lo libqpdf/build/Pl_Buffer.lo libqpdf/build/Pl_Concatenate.lo libqpdf/build/Pl_Count.lo libqpdf/build/Pl_DCT.lo libqpdf/build/Pl_Discard.lo libqpdf/build/Pl_Flate.lo libqpdf/build/Pl_LZWDecoder.lo libqpdf/build/Pl_MD5.lo libqpdf/build/Pl_PNGFilter.lo libqpdf/build/Pl_QPDFTokenizer.lo libqpdf/build/Pl_RC4.lo libqpdf/build/Pl_RunLength.lo libqpdf/build/Pl_SHA2.lo libqpdf/build/Pl_StdioFile.lo libqpdf/build/Pl_TIFFPredictor.lo libqpdf/build/QPDF.lo libqpdf/build/QPDFAcroFormDocumentHelper.lo libqpdf/build/QPDFAnnotationObjectHelper.lo libqpdf/build/QPDFCryptoProvider.lo libqpdf/build/QPDFEFStreamObjectHelper.lo libqpdf/build/QPDFEmbeddedFileDocumentHelper.lo libqpdf/build/QPDFExc.lo libqpdf/build/QPDFFileSpecObjectHelper.lo libqpdf/build/QPDFFormFieldObjectHelper.lo libqpdf/build/QPDFMatrix.lo libqpdf/build/QPDFNameTreeObjectHelper.lo libqpdf/build/QPDFNumberTreeObjectHelper.lo libqpdf/build/QPDFObjGen.lo libqpdf/build/QPDFObject.lo libqpdf/build/QPDFObjectHandle.lo libqpdf/build/QPDFOutlineDocumentHelper.lo libqpdf/build/QPDFOutlineObjectHelper.lo libqpdf/build/QPDFPageDocumentHelper.lo libqpdf/build/QPDFPageLabelDocumentHelper.lo libqpdf/build/QPDFPageObjectHelper.lo libqpdf/build/QPDFStreamFilter.lo libqpdf/build/QPDFSystemError.lo libqpdf/build/QPDFTokenizer.lo libqpdf/build/QPDFWriter.lo libqpdf/build/QPDFXRefEntry.lo libqpdf/build/QPDF_Array.lo libqpdf/build/QPDF_Bool.lo libqpdf/build/QPDF_Dictionary.lo libqpdf/build/QPDF_InlineImage.lo libqpdf/build/QPDF_Integer.lo libqpdf/build/QPDF_Name.lo libqpdf/build/QPDF_Null.lo libqpdf/build/QPDF_Operator.lo libqpdf/build/QPDF_Real.lo libqpdf/build/QPDF_Reserved.lo libqpdf/build/QPDF_Stream.lo libqpdf/build/QPDF_String.lo libqpdf/build/QPDF_encryption.lo libqpdf/build/QPDF_linearization.lo libqpdf/build/QPDF_optimization.lo libqpdf/build/QPDF_pages.lo libqpdf/build/QTC.lo libqpdf/build/QUtil.lo libqpdf/build/RC4.lo libqpdf/build/ResourceFinder.lo libqpdf/build/SecureRandomDataProvider.lo libqpdf/build/SF_FlateLzwDecode.lo libqpdf/build/SparseOHArray.lo libqpdf/build/qpdf-c.lo libqpdf/build/AES_PDF_native.lo libqpdf/build/MD5_native.lo libqpdf/build/QPDFCrypto_native.lo libqpdf/build/RC4_native.lo libqpdf/build/SHA2_native.lo libqpdf/build/rijndael.lo libqpdf/build/QPDFCrypto_openssl.lo libqpdf/build/QPDFCrypto_gnutls.lo libqpdf/build/sha2.lo libqpdf/build/sha2big.lo -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -L/opt/local/lib -L/opt/local/lib -lz -ljpeg -L/opt/local/lib -lssl -lcrypto -L/opt/local/lib -lgnutls -rpath /opt/local/lib -version-info 31:1:3 -no-undefined
libtool: link: /opt/local/bin/g++-mp-7  -dynamiclib  -o libqpdf/build/.libs/libqpdf.28.dylib  libqpdf/build/.libs/BitStream.o libqpdf/build/.libs/BitWriter.o libqpdf/build/.libs/Buffer.o libqpdf/build/.libs/BufferInputSource.o libqpdf/build/.libs/ClosedFileInputSource.o libqpdf/build/.libs/ContentNormalizer.o libqpdf/build/.libs/CryptoRandomDataProvider.o libqpdf/build/.libs/FileInputSource.o libqpdf/build/.libs/InputSource.o libqpdf/build/.libs/InsecureRandomDataProvider.o libqpdf/build/.libs/JSON.o libqpdf/build/.libs/MD5.o libqpdf/build/.libs/NNTree.o libqpdf/build/.libs/OffsetInputSource.o libqpdf/build/.libs/Pipeline.o libqpdf/build/.libs/Pl_AES_PDF.o libqpdf/build/.libs/Pl_ASCII85Decoder.o libqpdf/build/.libs/Pl_ASCIIHexDecoder.o libqpdf/build/.libs/Pl_Buffer.o libqpdf/build/.libs/Pl_Concatenate.o libqpdf/build/.libs/Pl_Count.o libqpdf/build/.libs/Pl_DCT.o libqpdf/build/.libs/Pl_Discard.o libqpdf/build/.libs/Pl_Flate.o libqpdf/build/.libs/Pl_LZWDecoder.o libqpdf/build/.libs/Pl_MD5.o libqpdf/build/.libs/Pl_PNGFilter.o libqpdf/build/.libs/Pl_QPDFTokenizer.o libqpdf/build/.libs/Pl_RC4.o libqpdf/build/.libs/Pl_RunLength.o libqpdf/build/.libs/Pl_SHA2.o libqpdf/build/.libs/Pl_StdioFile.o libqpdf/build/.libs/Pl_TIFFPredictor.o libqpdf/build/.libs/QPDF.o libqpdf/build/.libs/QPDFAcroFormDocumentHelper.o libqpdf/build/.libs/QPDFAnnotationObjectHelper.o libqpdf/build/.libs/QPDFCryptoProvider.o libqpdf/build/.libs/QPDFEFStreamObjectHelper.o libqpdf/build/.libs/QPDFEmbeddedFileDocumentHelper.o libqpdf/build/.libs/QPDFExc.o libqpdf/build/.libs/QPDFFileSpecObjectHelper.o libqpdf/build/.libs/QPDFFormFieldObjectHelper.o libqpdf/build/.libs/QPDFMatrix.o libqpdf/build/.libs/QPDFNameTreeObjectHelper.o libqpdf/build/.libs/QPDFNumberTreeObjectHelper.o libqpdf/build/.libs/QPDFObjGen.o libqpdf/build/.libs/QPDFObject.o libqpdf/build/.libs/QPDFObjectHandle.o libqpdf/build/.libs/QPDFOutlineDocumentHelper.o libqpdf/build/.libs/QPDFOutlineObjectHelper.o libqpdf/build/.libs/QPDFPageDocumentHelper.o libqpdf/build/.libs/QPDFPageLabelDocumentHelper.o libqpdf/build/.libs/QPDFPageObjectHelper.o libqpdf/build/.libs/QPDFStreamFilter.o libqpdf/build/.libs/QPDFSystemError.o libqpdf/build/.libs/QPDFTokenizer.o libqpdf/build/.libs/QPDFWriter.o libqpdf/build/.libs/QPDFXRefEntry.o libqpdf/build/.libs/QPDF_Array.o libqpdf/build/.libs/QPDF_Bool.o libqpdf/build/.libs/QPDF_Dictionary.o libqpdf/build/.libs/QPDF_InlineImage.o libqpdf/build/.libs/QPDF_Integer.o libqpdf/build/.libs/QPDF_Name.o libqpdf/build/.libs/QPDF_Null.o libqpdf/build/.libs/QPDF_Operator.o libqpdf/build/.libs/QPDF_Real.o libqpdf/build/.libs/QPDF_Reserved.o libqpdf/build/.libs/QPDF_Stream.o libqpdf/build/.libs/QPDF_String.o libqpdf/build/.libs/QPDF_encryption.o libqpdf/build/.libs/QPDF_linearization.o libqpdf/build/.libs/QPDF_optimization.o libqpdf/build/.libs/QPDF_pages.o libqpdf/build/.libs/QTC.o libqpdf/build/.libs/QUtil.o libqpdf/build/.libs/RC4.o libqpdf/build/.libs/ResourceFinder.o libqpdf/build/.libs/SecureRandomDataProvider.o libqpdf/build/.libs/SF_FlateLzwDecode.o libqpdf/build/.libs/SparseOHArray.o libqpdf/build/.libs/qpdf-c.o libqpdf/build/.libs/AES_PDF_native.o libqpdf/build/.libs/MD5_native.o libqpdf/build/.libs/QPDFCrypto_native.o libqpdf/build/.libs/RC4_native.o libqpdf/build/.libs/SHA2_native.o libqpdf/build/.libs/rijndael.o libqpdf/build/.libs/QPDFCrypto_openssl.o libqpdf/build/.libs/QPDFCrypto_gnutls.o libqpdf/build/.libs/sha2.o libqpdf/build/.libs/sha2big.o   -L/opt/local/lib -lz -ljpeg -lssl -lcrypto /opt/local/lib/libgnutls.dylib  -Os -arch ppc -Wl,-headerpad_max_install_names -arch ppc   -framework Security -framework CoreFoundation -install_name  /opt/local/lib/libqpdf.28.dylib -compatibility_version 32 -current_version 32.1 -Wl,-single_module
Undefined symbols for architecture ppc:
  "___atomic_fetch_add_8", referenced from:
      QPDF::QPDF()  in QPDF.o
ld: symbol(s) not found for architecture ppc
collect2: error: ld returned 1 exit status
make: *** [libqpdf/build/libqpdf.la] Error 1

Attachments (2)

main.log (136.1 KB) - added by ballapete (Peter "Pete" Dyballa) 3 years ago.
Main.log from PPC Leopard
ld_switch--as-needed.diff (446 bytes) - added by ballapete (Peter "Pete" Dyballa) 3 years ago.
Patch to remove the inappropriate '--as-needed' switches to ld

Download all attachments as: .zip

Change History (29)

Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Leopard

comment:1 Changed 3 years ago by kencu (Ken)

none of the gcc compilers will automatically add libatomic.dylib, where this function is implemented.

Something like this should do it:

configure.ldflags-append -latomic

with proper compiler guards, opening a bug report upstream, etc, etc, etc to dot the "i's" and cross the "t's" as is expected of all macporters.

comment:2 Changed 3 years ago by kencu (Ken)

BTW, there is already a gcc bug report about this, sitting there for years and years now -- I forget why they don't want to do it automatically exactly.

comment:3 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

The configure script has this test:

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use -latomic" >&5
$as_echo_n "checking whether to use -latomic... " >&6; }
oLDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--as-needed -latomic"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <atomic>
    int main()
    {
        static std::atomic<int> a{0};
        a = a.fetch_add(1);
        return 0;
    }

_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
  qpdf_USE_ATOMIC=1
else
  qpdf_USE_ATOMIC=0
fi

Could be it is too simplistic…

comment:4 in reply to:  1 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

none of the gcc compilers will automatically add libatomic.dylib, where this function is implemented.

Something like this should do it:

configure.ldflags-append -latomic

The port built with this extension.

comment:5 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

qpdf @10.3.2 cannot be built on PPC Leopard because it still misses that ld flag:

/bin/bash ./libtool --mode=link /opt/local/bin/g++-mp-7  -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -fvisibility=hidden   -Wconversion -Wsign-conversion -Wshadow=local   -Wold-style-cast -Wall  -o libqpdf/build/libqpdf.la libqpdf/build/BitStream.lo libqpdf/build/BitWriter.lo libqpdf/build/Buffer.lo libqpdf/build/BufferInputSource.lo libqpdf/build/ClosedFileInputSource.lo libqpdf/build/ContentNormalizer.lo libqpdf/build/CryptoRandomDataProvider.lo libqpdf/build/FileInputSource.lo libqpdf/build/InputSource.lo libqpdf/build/InsecureRandomDataProvider.lo libqpdf/build/JSON.lo libqpdf/build/MD5.lo libqpdf/build/NNTree.lo libqpdf/build/OffsetInputSource.lo libqpdf/build/Pipeline.lo libqpdf/build/Pl_AES_PDF.lo libqpdf/build/Pl_ASCII85Decoder.lo libqpdf/build/Pl_ASCIIHexDecoder.lo libqpdf/build/Pl_Buffer.lo libqpdf/build/Pl_Concatenate.lo libqpdf/build/Pl_Count.lo libqpdf/build/Pl_DCT.lo libqpdf/build/Pl_Discard.lo libqpdf/build/Pl_Flate.lo libqpdf/build/Pl_LZWDecoder.lo libqpdf/build/Pl_MD5.lo libqpdf/build/Pl_PNGFilter.lo libqpdf/build/Pl_QPDFTokenizer.lo libqpdf/build/Pl_RC4.lo libqpdf/build/Pl_RunLength.lo libqpdf/build/Pl_SHA2.lo libqpdf/build/Pl_StdioFile.lo libqpdf/build/Pl_TIFFPredictor.lo libqpdf/build/QPDF.lo libqpdf/build/QPDFAcroFormDocumentHelper.lo libqpdf/build/QPDFAnnotationObjectHelper.lo libqpdf/build/QPDFCryptoProvider.lo libqpdf/build/QPDFEFStreamObjectHelper.lo libqpdf/build/QPDFEmbeddedFileDocumentHelper.lo libqpdf/build/QPDFExc.lo libqpdf/build/QPDFFileSpecObjectHelper.lo libqpdf/build/QPDFFormFieldObjectHelper.lo libqpdf/build/QPDFMatrix.lo libqpdf/build/QPDFNameTreeObjectHelper.lo libqpdf/build/QPDFNumberTreeObjectHelper.lo libqpdf/build/QPDFObjGen.lo libqpdf/build/QPDFObject.lo libqpdf/build/QPDFObjectHandle.lo libqpdf/build/QPDFOutlineDocumentHelper.lo libqpdf/build/QPDFOutlineObjectHelper.lo libqpdf/build/QPDFPageDocumentHelper.lo libqpdf/build/QPDFPageLabelDocumentHelper.lo libqpdf/build/QPDFPageObjectHelper.lo libqpdf/build/QPDFStreamFilter.lo libqpdf/build/QPDFSystemError.lo libqpdf/build/QPDFTokenizer.lo libqpdf/build/QPDFWriter.lo libqpdf/build/QPDFXRefEntry.lo libqpdf/build/QPDF_Array.lo libqpdf/build/QPDF_Bool.lo libqpdf/build/QPDF_Dictionary.lo libqpdf/build/QPDF_InlineImage.lo libqpdf/build/QPDF_Integer.lo libqpdf/build/QPDF_Name.lo libqpdf/build/QPDF_Null.lo libqpdf/build/QPDF_Operator.lo libqpdf/build/QPDF_Real.lo libqpdf/build/QPDF_Reserved.lo libqpdf/build/QPDF_Stream.lo libqpdf/build/QPDF_String.lo libqpdf/build/QPDF_encryption.lo libqpdf/build/QPDF_linearization.lo libqpdf/build/QPDF_optimization.lo libqpdf/build/QPDF_pages.lo libqpdf/build/QTC.lo libqpdf/build/QUtil.lo libqpdf/build/RC4.lo libqpdf/build/ResourceFinder.lo libqpdf/build/SecureRandomDataProvider.lo libqpdf/build/SF_FlateLzwDecode.lo libqpdf/build/SparseOHArray.lo libqpdf/build/qpdf-c.lo libqpdf/build/AES_PDF_native.lo libqpdf/build/MD5_native.lo libqpdf/build/QPDFCrypto_native.lo libqpdf/build/RC4_native.lo libqpdf/build/SHA2_native.lo libqpdf/build/rijndael.lo libqpdf/build/QPDFCrypto_openssl.lo libqpdf/build/QPDFCrypto_gnutls.lo libqpdf/build/sha2.lo libqpdf/build/sha2big.lo -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -L/opt/local/lib -L/opt/local/lib -lz -ljpeg -L/opt/local/lib -lssl -lcrypto -L/opt/local/lib -lgnutls -rpath /opt/local/lib -version-info 31:2:3 -no-undefined
libtool: link: /opt/local/bin/g++-mp-7  -dynamiclib  -o libqpdf/build/.libs/libqpdf.28.dylib  libqpdf/build/.libs/BitStream.o libqpdf/build/.libs/BitWriter.o libqpdf/build/.libs/Buffer.o libqpdf/build/.libs/BufferInputSource.o libqpdf/build/.libs/ClosedFileInputSource.o libqpdf/build/.libs/ContentNormalizer.o libqpdf/build/.libs/CryptoRandomDataProvider.o libqpdf/build/.libs/FileInputSource.o libqpdf/build/.libs/InputSource.o libqpdf/build/.libs/InsecureRandomDataProvider.o libqpdf/build/.libs/JSON.o libqpdf/build/.libs/MD5.o libqpdf/build/.libs/NNTree.o libqpdf/build/.libs/OffsetInputSource.o libqpdf/build/.libs/Pipeline.o libqpdf/build/.libs/Pl_AES_PDF.o libqpdf/build/.libs/Pl_ASCII85Decoder.o libqpdf/build/.libs/Pl_ASCIIHexDecoder.o libqpdf/build/.libs/Pl_Buffer.o libqpdf/build/.libs/Pl_Concatenate.o libqpdf/build/.libs/Pl_Count.o libqpdf/build/.libs/Pl_DCT.o libqpdf/build/.libs/Pl_Discard.o libqpdf/build/.libs/Pl_Flate.o libqpdf/build/.libs/Pl_LZWDecoder.o libqpdf/build/.libs/Pl_MD5.o libqpdf/build/.libs/Pl_PNGFilter.o libqpdf/build/.libs/Pl_QPDFTokenizer.o libqpdf/build/.libs/Pl_RC4.o libqpdf/build/.libs/Pl_RunLength.o libqpdf/build/.libs/Pl_SHA2.o libqpdf/build/.libs/Pl_StdioFile.o libqpdf/build/.libs/Pl_TIFFPredictor.o libqpdf/build/.libs/QPDF.o libqpdf/build/.libs/QPDFAcroFormDocumentHelper.o libqpdf/build/.libs/QPDFAnnotationObjectHelper.o libqpdf/build/.libs/QPDFCryptoProvider.o libqpdf/build/.libs/QPDFEFStreamObjectHelper.o libqpdf/build/.libs/QPDFEmbeddedFileDocumentHelper.o libqpdf/build/.libs/QPDFExc.o libqpdf/build/.libs/QPDFFileSpecObjectHelper.o libqpdf/build/.libs/QPDFFormFieldObjectHelper.o libqpdf/build/.libs/QPDFMatrix.o libqpdf/build/.libs/QPDFNameTreeObjectHelper.o libqpdf/build/.libs/QPDFNumberTreeObjectHelper.o libqpdf/build/.libs/QPDFObjGen.o libqpdf/build/.libs/QPDFObject.o libqpdf/build/.libs/QPDFObjectHandle.o libqpdf/build/.libs/QPDFOutlineDocumentHelper.o libqpdf/build/.libs/QPDFOutlineObjectHelper.o libqpdf/build/.libs/QPDFPageDocumentHelper.o libqpdf/build/.libs/QPDFPageLabelDocumentHelper.o libqpdf/build/.libs/QPDFPageObjectHelper.o libqpdf/build/.libs/QPDFStreamFilter.o libqpdf/build/.libs/QPDFSystemError.o libqpdf/build/.libs/QPDFTokenizer.o libqpdf/build/.libs/QPDFWriter.o libqpdf/build/.libs/QPDFXRefEntry.o libqpdf/build/.libs/QPDF_Array.o libqpdf/build/.libs/QPDF_Bool.o libqpdf/build/.libs/QPDF_Dictionary.o libqpdf/build/.libs/QPDF_InlineImage.o libqpdf/build/.libs/QPDF_Integer.o libqpdf/build/.libs/QPDF_Name.o libqpdf/build/.libs/QPDF_Null.o libqpdf/build/.libs/QPDF_Operator.o libqpdf/build/.libs/QPDF_Real.o libqpdf/build/.libs/QPDF_Reserved.o libqpdf/build/.libs/QPDF_Stream.o libqpdf/build/.libs/QPDF_String.o libqpdf/build/.libs/QPDF_encryption.o libqpdf/build/.libs/QPDF_linearization.o libqpdf/build/.libs/QPDF_optimization.o libqpdf/build/.libs/QPDF_pages.o libqpdf/build/.libs/QTC.o libqpdf/build/.libs/QUtil.o libqpdf/build/.libs/RC4.o libqpdf/build/.libs/ResourceFinder.o libqpdf/build/.libs/SecureRandomDataProvider.o libqpdf/build/.libs/SF_FlateLzwDecode.o libqpdf/build/.libs/SparseOHArray.o libqpdf/build/.libs/qpdf-c.o libqpdf/build/.libs/AES_PDF_native.o libqpdf/build/.libs/MD5_native.o libqpdf/build/.libs/QPDFCrypto_native.o libqpdf/build/.libs/RC4_native.o libqpdf/build/.libs/SHA2_native.o libqpdf/build/.libs/rijndael.o libqpdf/build/.libs/QPDFCrypto_openssl.o libqpdf/build/.libs/QPDFCrypto_gnutls.o libqpdf/build/.libs/sha2.o libqpdf/build/.libs/sha2big.o   -L/opt/local/lib -lz -ljpeg -lssl -lcrypto /opt/local/lib/libgnutls.dylib  -Os -arch ppc -Wl,-headerpad_max_install_names -arch ppc   -framework Security -framework CoreFoundation -install_name  /opt/local/lib/libqpdf.28.dylib -compatibility_version 32 -current_version 32.2 -Wl,-single_module
Undefined symbols for architecture ppc:
  "___atomic_fetch_add_8", referenced from:
      QPDF::QPDF()  in QPDF.o
ld: symbol(s) not found for architecture ppc
collect2: error: ld returned 1 exit status
make: *** [libqpdf/build/libqpdf.la] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-10.3.2'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-10.3.2" && /usr/bin/make -j1 -w all 

comment:6 Changed 3 years ago by kencu (Ken)

Summary: qpdf @10.3.1 cannot be built on PPC Leopard because it misses a builtin functionqpdf @10.3.1 cannot be built with gcc because -latomic is not included in the link

comment:7 Changed 3 years ago by kencu (Ken)

there is an interesting writeup on the as-needed linker flag here:

https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed

I think that might be why configure is getting confused about whether -latomic should be added, but I haven't tested it.

comment:8 in reply to:  7 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

there is an interesting writeup on the as-needed linker flag here:

https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed

I think that might be why configure is getting confused about whether -latomic should be added, but I haven't tested it.

I never looked at configure's output or the contents of config.log – now I see that --as-needed causes the failure: ld: unknown option. So it should be best to patch the configure script…

comment:9 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

OK! The patches produces this configure output:

checking whether to use -latomic... yes

but on PPC Tiger compilation stops at once with:

make: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-10.3.2'
Makefile:61: *** unterminated call to function `foreach': missing `)'.  Stop.
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-10.3.2'

because Makefile has:

   60	# Prevent gnu make from trying to rebuild .dep files
   61	$(foreach B,$(BUILD_ITEMS),$(eval \
   62	  $(B)/$(OUTPUT_DIR)/%.dep: ;))
   63	
   64	# Prevent gnu make from trying to rebuild .mk files
   65	$(foreach B,$(BUILD_ITEMS),$(eval \
   66	  $(B)/%.mk: ;))
   67	%.mk: ;
   68	make/%.mk: ;
   69	
   70	BUILDRULES ?= libtool
   71	include make/rules.mk
   72	
   73	DUMMY := $(shell mkdir $(foreach B,$(BUILD_ITEMS),$(B)/$(OUTPUT_DIR)) 2>/dev/null)
   74	
   75	include $(foreach B,$(BUILD_ITEMS),$(B)/build.mk)
   76	
   77	ALL_TARGETS = $(foreach B,$(BUILD_ITEMS),$(TARGETS_$(B)))
   78	
   79	TEST_ITEMS = $(foreach D,\
   80	                 $(wildcard $(foreach B,$(BUILD_ITEMS),$(B)/qtest)),\
   81	                 $(subst /,,$(dir $(D))))

plus a few more statements that span more than one line.

Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: ld_switch--as-needed.diff added

Patch to remove the inappropriate '--as-needed' switches to ld

comment:10 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

I tried to use GNU Make instead of Tiger's ancient make 3.80 from 2002, first by adding MAKE=gmake when invoking port and second by adding the line configure.env-append MAKE=gmake to Portfile which both made configure report

checking for gnu make >= 3.81 (make)... no
checking for gnu make >= 3.81 (gmake)... yes

but in the end I got:

Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-10.3.2" && **/usr/bin/make** -j1 -w all 

so I do not know whether qpdf would be built OK. I think, I am going to try to build qpdf on Leopard.

comment:11 Changed 3 years ago by kencu (Ken)

In e56a99d697ddfa6bbd6795d9064ba42f5df9f53d/macports-ports (master):

qpdf: use newer make on Tiger

see: #62911

comment:12 Changed 3 years ago by kencu (Ken)

with the newer gmake added here in the above commit, qpdf built though on Tiger i386 without any errors about libatomic.

I'll try ppc tomorrow unless someone does it first.

Last edited 3 years ago by kencu (Ken) (previous) (diff)

comment:13 in reply to:  12 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

with the newer gmake added here in the above commit, qpdf built though on Tiger i386 without any errors about libatomic.

With or without the '--as-needed' patch?

comment:14 in reply to:  12 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

I'll try ppc tomorrow unless someone does it first.

On PPC Leopard I just saw that configure tried to find a utility sha256sum – without success. gsha256sum does exist…

comment:15 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

With my patch qpdf built on PPC Leopard with found libatomic. Could be the patch needs to be extended:

configure.ac:263:dnl -latomic in order for std::atomic to work. Passing --as-needed
configure.ac:266:LDFLAGS="$LDFLAGS -Wl,--as-needed -latomic"

It might also be useful to add configure options --with-docbook-xsl=/opt/local/share/xsl/docbook-xsl-nons --with-docbookx-dtd=/opt/local/share/xml/docbook/4.5/docbookx.dtd and also set SHA256SUM=gsha256sum.

comment:16 Changed 3 years ago by kencu (Ken)

no patch needed for me. on Tiger i386. will try ppc tomorrow.

comment:17 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Installed qpdf @10.3.2 produces reports like this one in Console:

21.08.21 22:22:54 qpdf[64641] qpdf Error qpdf(64641) malloc: *** error for object 0xa004636c: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug 

It uses the standard C++ library. When I invoke make -k check for the newly built version quite a lot crashes happen. (And some tests never finish!) Could this also be due to using the wrong standard C++ library?

Last edited 3 years ago by ballapete (Peter "Pete" Dyballa) (previous) (diff)

comment:18 Changed 3 years ago by kencu (Ken)

Oh, that's too bad. That error is the one we usually see when there is an ABI mismatch between the system libstdc++ and the libstdc++ installed by the libgcc port.

That error did not happen with libgcc 7.4.0 but does sometimes with libgcc 7.5.0 and newer, and all the macports-gcc versions use libgcc 7.5.0+.

We have a workaround that we use to "wrap" the binaries and force the libstdc++ we need, but that will take some time to get sorted out, I'm afraid. The wrapping mechanism is part of the legacysupport-1.0 PortGroup if you feel enthusiastic :>

I'll get to it (or somebody will) in due course.

Last edited 3 years ago by kencu (Ken) (previous) (diff)

comment:19 Changed 3 years ago by kencu (Ken)

I thought I might try our binwrapping fix:

https://github.com/kencu/macports-ports/commit/d7758d5172d75502ffb1cf1b757bfd3b14d704f3

but it doesn't fix the problem for me, unfortunately. qpdf just segfaults.

So still no bueno.

comment:20 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Trying to upgrade to version 10.4.0 produces this (well-known) error on PPC Leopard, Mac OS X 10.5.8:

/bin/bash ./libtool --mode=link --tag=CXX /opt/local/bin/g++-mp-7  -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -fvisibility=hidden     -Wconversion -Wsign-conversion -Wshadow=local -I/opt/local/include/p11-kit-1  -Wold-style-cast -Wall  -o libqpdf/build/libqpdf.la libqpdf/build/BitStream.lo libqpdf/build/BitWriter.lo libqpdf/build/Buffer.lo libqpdf/build/BufferInputSource.lo libqpdf/build/ClosedFileInputSource.lo libqpdf/build/ContentNormalizer.lo libqpdf/build/CryptoRandomDataProvider.lo libqpdf/build/FileInputSource.lo libqpdf/build/InputSource.lo libqpdf/build/InsecureRandomDataProvider.lo libqpdf/build/JSON.lo libqpdf/build/MD5.lo libqpdf/build/NNTree.lo libqpdf/build/OffsetInputSource.lo libqpdf/build/Pipeline.lo libqpdf/build/Pl_AES_PDF.lo libqpdf/build/Pl_ASCII85Decoder.lo libqpdf/build/Pl_ASCIIHexDecoder.lo libqpdf/build/Pl_Buffer.lo libqpdf/build/Pl_Concatenate.lo libqpdf/build/Pl_Count.lo libqpdf/build/Pl_DCT.lo libqpdf/build/Pl_Discard.lo libqpdf/build/Pl_Flate.lo libqpdf/build/Pl_LZWDecoder.lo libqpdf/build/Pl_MD5.lo libqpdf/build/Pl_PNGFilter.lo libqpdf/build/Pl_QPDFTokenizer.lo libqpdf/build/Pl_RC4.lo libqpdf/build/Pl_RunLength.lo libqpdf/build/Pl_SHA2.lo libqpdf/build/Pl_StdioFile.lo libqpdf/build/Pl_TIFFPredictor.lo libqpdf/build/QPDF.lo libqpdf/build/QPDFAcroFormDocumentHelper.lo libqpdf/build/QPDFAnnotationObjectHelper.lo libqpdf/build/QPDFCryptoProvider.lo libqpdf/build/QPDFEFStreamObjectHelper.lo libqpdf/build/QPDFEmbeddedFileDocumentHelper.lo libqpdf/build/QPDFExc.lo libqpdf/build/QPDFFileSpecObjectHelper.lo libqpdf/build/QPDFFormFieldObjectHelper.lo libqpdf/build/QPDFMatrix.lo libqpdf/build/QPDFNameTreeObjectHelper.lo libqpdf/build/QPDFNumberTreeObjectHelper.lo libqpdf/build/QPDFObjGen.lo libqpdf/build/QPDFObject.lo libqpdf/build/QPDFObjectHandle.lo libqpdf/build/QPDFOutlineDocumentHelper.lo libqpdf/build/QPDFOutlineObjectHelper.lo libqpdf/build/QPDFPageDocumentHelper.lo libqpdf/build/QPDFPageLabelDocumentHelper.lo libqpdf/build/QPDFPageObjectHelper.lo libqpdf/build/QPDFStreamFilter.lo libqpdf/build/QPDFSystemError.lo libqpdf/build/QPDFTokenizer.lo libqpdf/build/QPDFWriter.lo libqpdf/build/QPDFXRefEntry.lo libqpdf/build/QPDF_Array.lo libqpdf/build/QPDF_Bool.lo libqpdf/build/QPDF_Dictionary.lo libqpdf/build/QPDF_InlineImage.lo libqpdf/build/QPDF_Integer.lo libqpdf/build/QPDF_Name.lo libqpdf/build/QPDF_Null.lo libqpdf/build/QPDF_Operator.lo libqpdf/build/QPDF_Real.lo libqpdf/build/QPDF_Reserved.lo libqpdf/build/QPDF_Stream.lo libqpdf/build/QPDF_String.lo libqpdf/build/QPDF_encryption.lo libqpdf/build/QPDF_linearization.lo libqpdf/build/QPDF_optimization.lo libqpdf/build/QPDF_pages.lo libqpdf/build/QTC.lo libqpdf/build/QUtil.lo libqpdf/build/RC4.lo libqpdf/build/ResourceFinder.lo libqpdf/build/SecureRandomDataProvider.lo libqpdf/build/SF_FlateLzwDecode.lo libqpdf/build/SparseOHArray.lo libqpdf/build/qpdf-c.lo libqpdf/build/AES_PDF_native.lo libqpdf/build/MD5_native.lo libqpdf/build/QPDFCrypto_native.lo libqpdf/build/RC4_native.lo libqpdf/build/SHA2_native.lo libqpdf/build/rijndael.lo libqpdf/build/QPDFCrypto_gnutls.lo libqpdf/build/sha2.lo libqpdf/build/sha2big.lo -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -L/opt/local/lib -L/opt/local/lib -lz -ljpeg -L/opt/local/lib -lgnutls -rpath /opt/local/lib -version-info 32:0:4 -no-undefined
libtool: link: /opt/local/bin/g++-mp-7  -dynamiclib  -o libqpdf/build/.libs/libqpdf.28.dylib  libqpdf/build/.libs/BitStream.o libqpdf/build/.libs/BitWriter.o libqpdf/build/.libs/Buffer.o libqpdf/build/.libs/BufferInputSource.o libqpdf/build/.libs/ClosedFileInputSource.o libqpdf/build/.libs/ContentNormalizer.o libqpdf/build/.libs/CryptoRandomDataProvider.o libqpdf/build/.libs/FileInputSource.o libqpdf/build/.libs/InputSource.o libqpdf/build/.libs/InsecureRandomDataProvider.o libqpdf/build/.libs/JSON.o libqpdf/build/.libs/MD5.o libqpdf/build/.libs/NNTree.o libqpdf/build/.libs/OffsetInputSource.o libqpdf/build/.libs/Pipeline.o libqpdf/build/.libs/Pl_AES_PDF.o libqpdf/build/.libs/Pl_ASCII85Decoder.o libqpdf/build/.libs/Pl_ASCIIHexDecoder.o libqpdf/build/.libs/Pl_Buffer.o libqpdf/build/.libs/Pl_Concatenate.o libqpdf/build/.libs/Pl_Count.o libqpdf/build/.libs/Pl_DCT.o libqpdf/build/.libs/Pl_Discard.o libqpdf/build/.libs/Pl_Flate.o libqpdf/build/.libs/Pl_LZWDecoder.o libqpdf/build/.libs/Pl_MD5.o libqpdf/build/.libs/Pl_PNGFilter.o libqpdf/build/.libs/Pl_QPDFTokenizer.o libqpdf/build/.libs/Pl_RC4.o libqpdf/build/.libs/Pl_RunLength.o libqpdf/build/.libs/Pl_SHA2.o libqpdf/build/.libs/Pl_StdioFile.o libqpdf/build/.libs/Pl_TIFFPredictor.o libqpdf/build/.libs/QPDF.o libqpdf/build/.libs/QPDFAcroFormDocumentHelper.o libqpdf/build/.libs/QPDFAnnotationObjectHelper.o libqpdf/build/.libs/QPDFCryptoProvider.o libqpdf/build/.libs/QPDFEFStreamObjectHelper.o libqpdf/build/.libs/QPDFEmbeddedFileDocumentHelper.o libqpdf/build/.libs/QPDFExc.o libqpdf/build/.libs/QPDFFileSpecObjectHelper.o libqpdf/build/.libs/QPDFFormFieldObjectHelper.o libqpdf/build/.libs/QPDFMatrix.o libqpdf/build/.libs/QPDFNameTreeObjectHelper.o libqpdf/build/.libs/QPDFNumberTreeObjectHelper.o libqpdf/build/.libs/QPDFObjGen.o libqpdf/build/.libs/QPDFObject.o libqpdf/build/.libs/QPDFObjectHandle.o libqpdf/build/.libs/QPDFOutlineDocumentHelper.o libqpdf/build/.libs/QPDFOutlineObjectHelper.o libqpdf/build/.libs/QPDFPageDocumentHelper.o libqpdf/build/.libs/QPDFPageLabelDocumentHelper.o libqpdf/build/.libs/QPDFPageObjectHelper.o libqpdf/build/.libs/QPDFStreamFilter.o libqpdf/build/.libs/QPDFSystemError.o libqpdf/build/.libs/QPDFTokenizer.o libqpdf/build/.libs/QPDFWriter.o libqpdf/build/.libs/QPDFXRefEntry.o libqpdf/build/.libs/QPDF_Array.o libqpdf/build/.libs/QPDF_Bool.o libqpdf/build/.libs/QPDF_Dictionary.o libqpdf/build/.libs/QPDF_InlineImage.o libqpdf/build/.libs/QPDF_Integer.o libqpdf/build/.libs/QPDF_Name.o libqpdf/build/.libs/QPDF_Null.o libqpdf/build/.libs/QPDF_Operator.o libqpdf/build/.libs/QPDF_Real.o libqpdf/build/.libs/QPDF_Reserved.o libqpdf/build/.libs/QPDF_Stream.o libqpdf/build/.libs/QPDF_String.o libqpdf/build/.libs/QPDF_encryption.o libqpdf/build/.libs/QPDF_linearization.o libqpdf/build/.libs/QPDF_optimization.o libqpdf/build/.libs/QPDF_pages.o libqpdf/build/.libs/QTC.o libqpdf/build/.libs/QUtil.o libqpdf/build/.libs/RC4.o libqpdf/build/.libs/ResourceFinder.o libqpdf/build/.libs/SecureRandomDataProvider.o libqpdf/build/.libs/SF_FlateLzwDecode.o libqpdf/build/.libs/SparseOHArray.o libqpdf/build/.libs/qpdf-c.o libqpdf/build/.libs/AES_PDF_native.o libqpdf/build/.libs/MD5_native.o libqpdf/build/.libs/QPDFCrypto_native.o libqpdf/build/.libs/RC4_native.o libqpdf/build/.libs/SHA2_native.o libqpdf/build/.libs/rijndael.o libqpdf/build/.libs/QPDFCrypto_gnutls.o libqpdf/build/.libs/sha2.o libqpdf/build/.libs/sha2big.o   -L/opt/local/lib -lz -ljpeg /opt/local/lib/libgnutls.dylib  -Os -arch ppc -Wl,-headerpad_max_install_names -arch ppc   -framework Security -framework CoreFoundation -install_name  /opt/local/lib/libqpdf.28.dylib -compatibility_version 33 -current_version 33.0 -Wl,-single_module
Undefined symbols for architecture ppc:
  "___atomic_fetch_add_8", referenced from:
      QPDF::QPDF()  in QPDF.o
ld: symbol(s) not found for architecture ppc
collect2: error: ld returned 1 exit status
make: *** [libqpdf/build/libqpdf.la] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-10.4.0'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-10.4.0" && /usr/bin/make -j1 -w all 

comment:21 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

For a first try it built using the additional line in Portfile

configure.ldflags-append -latomic

and for a second try it also built with the patch to change the configure script.

comment:22 in reply to:  15 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

Replying to ballapete:

It might also be useful to add configure options --with-docbook-xsl=/opt/local/share/xsl/docbook-xsl-nons --with-docbookx-dtd=/opt/local/share/xml/docbook/4.5/docbookx.dtd and also set SHA256SUM=gsha256sum.

The two options seem to be unnecessary. During the build process they are not needed. gsha256sum might be needed for some operations when being used…

comment:23 Changed 2 years ago by ballapete (Peter "Pete" Dyballa)

make check is very bad. Some tests do not seem to finish during an averagee man's (or PowerBook's) life…

comment:24 Changed 17 months ago by ballapete (Peter "Pete" Dyballa)

Recent version @11.2.0 does not build:

[ 22%] Building CXX object libqpdf/CMakeFiles/libqpdf_object.dir/QUtil.cc.o
cd /opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/build/libqpdf && /opt/local/bin/g++-mp-7 -DPOINTERHOLDER_TRANSITION=4 -DQPDF_DISABLE_QTC=1 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-11.2.0/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-11.2.0/libqpdf -I/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/build/libqpdf -isystem /opt/local/include -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -O3 -DNDEBUG -arch ppc -mmacosx-version-min=10.4 -fvisibility=hidden -Wall -Wconversion -Wsign-conversion -Wshadow=local -Wold-style-cast -std=c++1z -MD -MT libqpdf/CMakeFiles/libqpdf_object.dir/QUtil.cc.o -MF CMakeFiles/libqpdf_object.dir/QUtil.cc.o.d -o CMakeFiles/libqpdf_object.dir/QUtil.cc.o -c /opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-11.2.0/libqpdf/QUtil.cc
/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-11.2.0/libqpdf/QUtil.cc: In function 'QUtil::QPDFTime QUtil::get_current_qpdf_time()':
/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/qpdf-11.2.0/libqpdf/QUtil.cc:951:43: error: invalid operands of types 'char*(int, int)' and 'int' to binary 'operator/'
     int tzoff = static_cast<int>(timezone / 60);
                                  ~~~~~~~~~^~~~
make[2]: *** [libqpdf/CMakeFiles/libqpdf_object.dir/QUtil.cc.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_textproc_qpdf/qpdf/work/build'

comment:25 Changed 17 months ago by ballapete (Peter "Pete" Dyballa)

Since a newer version, @10.4.0, is installed this ticket can be closed.

comment:26 Changed 17 months ago by kencu (Ken)

Owner: set to kencu
Resolution: fixed
Status: newclosed

In eefb1879f79653ad670db3b1f8d41748ff46ce49/macports-ports (master):

qpdf: fix build on Tiger

closes: #62911

previously an issue with -latomic was identified, but this appears to have been fixed upstream as it no longer occurs

comment:27 Changed 17 months ago by kencu (Ken)

$ port -v installed qpdf
The following ports are currently installed:
  qpdf @11.2.0_0+gnutls (active) requested_variants='' platform='darwin 8' archs='ppc' date='2022-12-10T12:20:09-0800'
Note: See TracTickets for help on using tickets.