That worked.
Original Message:
Sent: Fri September 26, 2025 12:47 PM
From: Ayappan P
Subject: gcc: invalid magic number
I am not sure how "-L/opt/freeware/lib64 -L/opt/freeware/lib" flags are added to it. If you can pass "-L/opt/freeware/lib/pthread" before this , that will resolve this problem.
------------------------------
Ayappan P
------------------------------
Original Message:
Sent: Fri September 26, 2025 11:00 AM
From: Emanuel Reisinger
Subject: gcc: invalid magic number
Better.
Last and maybe little linkage error.
# make
cp ./obj/gsromfs1_.c ./obj/gsromfs1.c
gcc -maix64 -pthread -O2 -DHAVE_MKSTEMP -DHAVE_FILE64 -DHAVE_FSEEKO -DHAVE_MKSTEMP64 -DHAVE_FONTCONFIG -DHAVE_SETLOCALE -DHAVE_BSWAP32 -DHAVE_STRERROR -DHAVE_ISNAN -DHAVE_ISINF -DHAVE_PREAD_PWRITE=1 -DGS_RECURSIVE_MUTEXATTR=PTHREAD_MUTEX_RECURSIVE -O2 -DNDEBUG -Wl,-brtl -D_LARGE_FILES -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -fno-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -Wno-unused-local-typedefs -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_NDIR_H=0 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_NDIR_H=0 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBDL=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1 -DHAVE_SNPRINTF -DGS_MEMPTR_ALIGNMENT=8 -DBUILD_PDF=1 -I./pdf -DHAVE_RESTRICT=1 -DHAVE_LIMITS_H=1 -DHAVE_STRING_H=1 -DUSE_LIBICONV_GNU -DPNG_POWERPC_VSX_OPT=0 -fno-strict-aliasing -DHAVE_POPEN_PROTO=1 -I./obj -I./base -I./devices -DWHICH_CMS="lcms2mt" -o ./obj/gsromfs1.o -c ./obj/gsromfs1.c
./obj/aux/echogs -w ./obj/ldt.tr -n - gcc -maix64 -pthread -O2 -Wl,-bbigtoc -pthread -o ./bin/gs
./obj/aux/echogs -a ./obj/ldt.tr -n -s ./obj/gsromfs1.o ./obj/gs.o -s
cat ./obj/gsld.tr >> ./obj/ldt.tr
./obj/aux/echogs -a ./obj/ldt.tr -s - -lm -ldl -liconv -L/opt/freeware/lib64 -L/opt/freeware/lib -lfontconfig -lfreetype -lpthread -lm -lstdc++
if [ x != x ]; then LD_RUN_PATH=; export LD_RUN_PATH; fi; \
XCFLAGS= XINCLUDE= XLDFLAGS= XLIBDIRS= XLIBS= \
PSI_FEATURE_DEVS= FEATURE_DEVS= DEVICE_DEVS= DEVICE_DEVS1= DEVICE_DEVS2= DEVICE_DEVS3= \
DEVICE_DEVS4= DEVICE_DEVS5= DEVICE_DEVS6= DEVICE_DEVS7= DEVICE_DEVS8= \
DEVICE_DEVS9= DEVICE_DEVS10= DEVICE_DEVS11= DEVICE_DEVS12= \
DEVICE_DEVS13= DEVICE_DEVS14= DEVICE_DEVS15= DEVICE_DEVS16= \
DEVICE_DEVS17= DEVICE_DEVS18= DEVICE_DEVS19= DEVICE_DEVS20= \
DEVICE_DEVS_EXTRA= \
/bin/sh <./obj/ldt.tr
ld: 0711-317 ERROR: Undefined symbol: ._ZNSt6thread4joinEv
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
make: *** [base/unixlink.mak:172: bin/gs] Error 1
------------------------------
Emanuel Reisinger
Original Message:
Sent: Fri September 26, 2025 10:44 AM
From: Ayappan P
Subject: gcc: invalid magic number
Oh.. It involves g++ also.,
We need to set CXX also then to "g++ -maix64 -pthread -O2" . Clean it up and start afresh.,
gmake distclean
export CC="gcc -maix64 -pthread -O2"
export CXX="g++ -maix64 -pthread -O2"
export OBJECT_MODE=64
./configure
------------------------------
Ayappan P
Original Message:
Sent: Fri September 26, 2025 10:41 AM
From: Emanuel Reisinger
Subject: gcc: invalid magic number
I get still the same error.
ld: 0711-738 ERROR: Input file ./obj/tessocr.o:
XCOFF32 object files are not allowed in 64-bit mode.
There is something strange happening. Because the object is built with -maix64 before. But at time of linking it's a 32Bit object.
g++ -Itesseract/include -Itesseract/src/api -Itesseract/src/arch -Itesseract/src/ccmain -Itesseract/src/ccstruct -Itesseract/src/ccutil -Itesseract/src/classify -Itesseract/src/cutil -Itesseract/src/dict -Itesseract/src/lstm -Itesseract/src/opencl -Itesseract/src/textord -Itesseract/src/training -Itesseract/src/viewer -Itesseract/src/wordrec -Ileptonica/src -I./base -I./obj -maix64 -pthread -std=c++17 -DHAVE_MKSTEMP -DHAVE_FILE64 -DHAVE_FSEEKO -DHAVE_MKSTEMP64 -DHAVE_FONTCONFIG -DHAVE_SETLOCALE -DHAVE_BSWAP32 -DHAVE_STRERROR -DHAVE_ISNAN -DHAVE_ISINF -DHAVE_PREAD_PWRITE=1 -DGS_RECURSIVE_MUTEXATTR=PTHREAD_MUTEX_RECURSIVE -O2 -DNDEBUG -Wl,-brtl -D_LARGE_FILES -Wall -Wundef -Wmissing-declarations -Wwrite-strings -fno-strict-aliasing -fno-builtin -fno-common -Werror=return-type -Wno-unused-local-typedefs -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_NDIR_H=0 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_NDIR_H=0 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBDL=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1 -DHAVE_SNPRINTF -DGS_MEMPTR_ALIGNMENT=8 -DBUILD_PDF=1 -I./pdf -maix64 -DHAVE_RESTRICT=1 -DHAVE_LIMITS_H=1 -DHAVE_STRING_H=1 -DUSE_LIBICONV_GNU -DPNG_POWERPC_VSX_OPT=0 -fno-strict-aliasing -DHAVE_POPEN_PROTO=1 -DTESSERACT_IMAGEDATA_AS_PIX -DTESSERACT_DISABLE_DEBUG_FONTS -DGRAPHICS_DISABLED -UCLUSTER -DOCR_SHARED=0 -DLEPTONICA_INTERCEPT_ALLOC=1 -I./obj/ -o ./obj/tessocr.o -c -DTESSDATA="/usr/local/share/tessdata" ./base/tessocr.cpp
When I remove the ./obj/tessocr.o and built it with this command it's a 64bit object.
In my console output tessocr.o is used in this line once more
./obj/aux/echogs -e .dev -w- -l-obj ./obj/libocr_1_0 ./obj/tessocr.o
It's completely strange.
After I have build tessocr.o again, now it's really 64Bit, make results in more linkage errors:
cp ./obj/gsromfs1_.c ./obj/gsromfs1.c
gcc -maix64 -pthread -O2 -DHAVE_MKSTEMP -DHAVE_FILE64 -DHAVE_FSEEKO -DHAVE_MKSTEMP64 -DHAVE_FONTCONFIG -DHAVE_SETLOCALE -DHAVE_BSWAP32 -DHAVE_STRERROR -DHAVE_ISNAN -DHAVE_ISINF -DHAVE_PREAD_PWRITE=1 -DGS_RECURSIVE_MUTEXATTR=PTHREAD_MUTEX_RECURSIVE -O2 -DNDEBUG -Wl,-brtl -D_LARGE_FILES -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -fno-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -Wno-unused-local-typedefs -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_NDIR_H=0 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_NDIR_H=0 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBDL=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1 -DHAVE_SNPRINTF -DGS_MEMPTR_ALIGNMENT=8 -DBUILD_PDF=1 -I./pdf -DHAVE_RESTRICT=1 -DHAVE_LIMITS_H=1 -DHAVE_STRING_H=1 -DUSE_LIBICONV_GNU -DPNG_POWERPC_VSX_OPT=0 -fno-strict-aliasing -DHAVE_POPEN_PROTO=1 -I./obj -I./base -I./devices -DWHICH_CMS="lcms2mt" -o ./obj/gsromfs1.o -c ./obj/gsromfs1.c
./obj/aux/echogs -w ./obj/ldt.tr -n - gcc -maix64 -pthread -O2 -Wl,-bbigtoc -pthread -o ./bin/gs
./obj/aux/echogs -a ./obj/ldt.tr -n -s ./obj/gsromfs1.o ./obj/gs.o -s
cat ./obj/gsld.tr >> ./obj/ldt.tr
./obj/aux/echogs -a ./obj/ldt.tr -s - -lm -ldl -liconv -L/opt/freeware/lib64 -L/opt/freeware/lib -lfontconfig -lfreetype -lpthread -lm -lstdc++
if [ x != x ]; then LD_RUN_PATH=; export LD_RUN_PATH; fi; \
XCFLAGS= XINCLUDE= XLDFLAGS= XLIBDIRS= XLIBS= \
PSI_FEATURE_DEVS= FEATURE_DEVS= DEVICE_DEVS= DEVICE_DEVS1= DEVICE_DEVS2= DEVICE_DEVS3= \
DEVICE_DEVS4= DEVICE_DEVS5= DEVICE_DEVS6= DEVICE_DEVS7= DEVICE_DEVS8= \
DEVICE_DEVS9= DEVICE_DEVS10= DEVICE_DEVS11= DEVICE_DEVS12= \
DEVICE_DEVS13= DEVICE_DEVS14= DEVICE_DEVS15= DEVICE_DEVS16= \
DEVICE_DEVS17= DEVICE_DEVS18= DEVICE_DEVS19= DEVICE_DEVS20= \
DEVICE_DEVS_EXTRA= \
/bin/sh <./obj/ldt.tr
ld: 0711-317 ERROR: Undefined symbol: .pixCreateHeader
ld: 0711-317 ERROR: Undefined symbol: .pixSetData
ld: 0711-317 ERROR: Undefined symbol: .pixSetPadBits
ld: 0711-317 ERROR: Undefined symbol: .pixSetXRes
ld: 0711-317 ERROR: Undefined symbol: .pixSetYRes
ld: 0711-317 ERROR: Undefined symbol: ._ZN9tesseract11TessBaseAPI8SetImageEP3Pix
ld: 0711-317 ERROR: Undefined symbol: ._ZN9tesseract11TessBaseAPI11GetUTF8TextEv
ld: 0711-317 ERROR: Undefined symbol: .pixDestroy
ld: 0711-317 ERROR: Undefined symbol: ._ZN9tesseract11TessBaseAPI11SetVariableEPKcS2_
ld: 0711-317 ERROR: Undefined symbol: ._ZN9tesseract11TessBaseAPI11GetHOCRTextEi
ld: 0711-317 ERROR: Undefined symbol: .setPixMemoryManager
ld: 0711-317 ERROR: Undefined symbol: ._ZN9tesseract11TessBaseAPIC1Ev
ld: 0711-317 ERROR: Undefined symbol: ._ZN9tesseract11TessBaseAPI4InitEPKciS2_NS_13OcrEngineModeEPPciPKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISC_EESG_bPFbS2_PS6_IcSB_EE
ld: 0711-317 ERROR: Undefined symbol: ._ZN9tesseract11TessBaseAPI3EndEv
ld: 0711-317 ERROR: Undefined symbol: ._ZN9tesseract11TessBaseAPI9RecognizeEPNS_10ETEXT_DESCE
ld: 0711-317 ERROR: Undefined symbol: ._ZN9tesseract11TessBaseAPI11GetIteratorEv
ld: 0711-317 ERROR: Undefined symbol: ._ZNK9tesseract12PageIterator5EmptyENS_17PageIteratorLevelE
ld: 0711-317 ERROR: Undefined symbol: _ZTVN9tesseract14ResultIteratorE
ld: 0711-317 ERROR: Undefined symbol: ._ZN9tesseract17LTRResultIteratorD2Ev
ld: 0711-317 ERROR: Undefined symbol: ._ZNK9tesseract12PageIterator11BoundingBoxENS_17PageIteratorLevelEPiS2_S2_S2_
ld: 0711-317 ERROR: Undefined symbol: ._ZNK9tesseract17LTRResultIterator18WordFontAttributesEPbS1_S1_S1_S1_S1_PiS2_
ld: 0711-317 ERROR: Undefined symbol: .pixGetData
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
make: *** [base/unixlink.mak:172: bin/gs] Error 1
It's onerous.
------------------------------
Emanuel Reisinger
Original Message:
Sent: Fri September 26, 2025 09:06 AM
From: Ayappan P
Subject: gcc: invalid magic number
Can you try the below ?
gmake distclean
export CC="gcc -maix64 -pthread -O2"
export OBJECT_MODE=64
./configure
------------------------------
Ayappan P
Original Message:
Sent: Fri September 26, 2025 09:03 AM
From: Emanuel Reisinger
Subject: gcc: invalid magic number
My fault, I can see the -maix64 flags in gcc command.
I've tried the whole build with -m64 but with the same result/error.
------------------------------
Emanuel Reisinger
Original Message:
Sent: Fri September 26, 2025 08:34 AM
From: Emanuel Reisinger
Subject: gcc: invalid magic number
Can you help me how I can set the correct parameters or arguments to build a 64bit version?
ghostpdl is a huge package configured by configure and all Makfiles for all submodules are generated. I've tried with export some variables
export OBJECT_MODE=64
export CFLAGS="-maix64"
export CXXFLAGS="-maix64"
export LDFLAGS="-maix64"
export AR="ar -X64"
... call configure with arguments
./configure CFLAGS="-maix64" CXXFLAGS="-maix64" LDFLAGS="-maix64" AR="ar -X64"
Only the initial error from initial post with genarch is gone and after a while compiling I get the next 32/64Bit error.
...
gcc -DHAVE_MKSTEMP -DHAVE_FILE64 -DHAVE_FSEEKO -DHAVE_MKSTEMP64 -DHAVE_FONTCONFIG -DHAVE_SETLOCALE -DHAVE_BSWAP32 -DHAVE_STRERROR -DHAVE_ISNAN -DHAVE_ISINF -DHAVE_PREAD_PWRITE=1 -DGS_RECURSIVE_MUTEXATTR=PTHREAD_MUTEX_RECURSIVE -O2 -DNDEBUG -Wl,-brtl -D_LARGE_FILES -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -fno-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -Wno-unused-local-typedefs -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_NDIR_H=0 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_NDIR_H=0 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBDL=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1 -DHAVE_SNPRINTF -DGS_MEMPTR_ALIGNMENT=8 -DBUILD_PDF=1 -I./pdf -maix64 -DHAVE_RESTRICT=1 -DHAVE_LIMITS_H=1 -DHAVE_STRING_H=1 -DUSE_LIBICONV_GNU -DPNG_POWERPC_VSX_OPT=0 -fno-strict-aliasing -DHAVE_POPEN_PROTO=1 -I./obj -I./base -I./devices -DWHICH_CMS="lcms2mt" -o ./obj/gsromfs1.o -c ./obj/gsromfs1.c
...
ld: 0711-736 ERROR: Input file ./obj/gsromfs1.o:
XCOFF64 object files are not allowed in 32-bit mode.
collect2: error: ld returned 8 exit status
make: *** [base/unixlink.mak:172: bin/gs] Error 1
As I can see in the gcc call above the CFLAGS are not considered.
I haven't found out what I have to do.
Have anyone any idea?
------------------------------
Emanuel Reisinger
Original Message:
Sent: Fri September 26, 2025 03:04 AM
From: Ayappan P
Subject: gcc: invalid magic number
Try to build a 64bit version of ghostpdl. ( Pass -maix64 to gcc during the compilation and OBJECT_MODE=64 ).
------------------------------
Ayappan P