tinydtls configuration in Contiki - gcc

I am currently trying to configure tinydtls as described in the README in order to later include it into an application, or at least, make the examples run.
The first steps, including the resulting warnings:
home/name/contiki/apps/tinydtls$ autoreconf
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
home/name/contiki/apps/tinydtls$ ./configure --with-contiki
home/name/contiki/apps/tinydtls$ make
with both TARGET=native and TARGET=zoul
The compilation always ends with (many) undefined reference errors:
obj_zoul/dtls.o: In function dtls_add_ecdsa_signature_elem':
dtls.c:(.text.dtls_add_ecdsa_signature_elem+0x10): undefined reference to `dtls_ec_key_from_uint32_asn1'
dtls_ec_key_from_uint32_asn1 is located in contiki/apps/tinydtls/crypto.c.
Adding #include crypto.h in dtls.c doesn't fix the problem, but #include crypto.c does (fix this first error). Accordingly I assume the problem must have to do something with the linking.
How should the Makefile, of which I pasted a (hopefully significant) part under this question, be adjusted?
SHELL = /bin/sh
MKDIR = mkdir
ETAGS = /bin/false
prefix = /usr/local
exec_prefix = ${prefix}
abs_builddir = /home/name/contiki/apps/tinydtls
top_builddir = .
libdir = ${exec_prefix}/lib
includedir = ${prefix}/include/tinydtls
package = tinydtls-0.8.2
install := cp
# files and flags
SOURCES:= dtls.c crypto.c ccm.c hmac.c netq.c peer.c dtls_time.c session.c
ifneq ("", "1")
SOURCES += debug.c
endif
SUB_OBJECTS:=aes/rijndael.o ecc/ecc.o sha2/sha2.o
OBJECTS:= $(patsubst %.c, %.o, $(SOURCES)) $(SUB_OBJECTS)
HEADERS:=dtls.h hmac.h debug.h dtls_config.h uthash.h numeric.h crypto.h global.h ccm.h \
netq.h t_list.h alert.h utlist.h prng.h peer.h state.h dtls_time.h session.h \
tinydtls.h
CFLAGS:=-Wall -pedantic -std=c99
CPPFLAGS:= -DDTLSv12 -DWITH_SHA256 -DDTLS_CHECK_CONTENTTYPE
SUBDIRS:=tests doc platform-specific sha2 aes ecc
DISTSUBDIRS:=$(SUBDIRS) examples/contiki
DISTDIR=$(top_builddir)/$(package)
FILES:=Makefile.in configure configure.in dtls_config.h.in tinydtls.h.in \
Makefile.tinydtls $(SOURCES) $(HEADERS)
LIB:=libtinydtls.a
LDFLAGS:=
ARFLAGS:=cru
doc:=doc
Edit: Changed the directory for this post to /home/name/...
Edit2: Added warnings after 'autoreconf'.

Related

GCC Linking Error when Building Fast RCNN

I am trying to build the source code at https://github.com/craftGBD/craftGBD in order to achieve the same results of the published paper of authors to observe whether it is reproducible or not for my term project. I realized that I have to install Fast RCNN by running Makefile inside the craftGBD/evaluation/lib folder. However, I got following results when I run Makefile using make:
/cta/users/byaman/craftEnv/bin/python setup.py build_ext --inplace
python setup.py build_ext --inplace
running build_ext
cythoning utils/bbox.pyx to utils/bbox.c
/cta/users/byaman/craftEnv/lib/python2.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /cta/users/byaman/craftGBD/evaluation/lib/utils/bbox.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
cythoning nms/cpu_nms.pyx to nms/cpu_nms.c
/cta/users/byaman/craftEnv/lib/python2.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /cta/users/byaman/craftGBD/evaluation/lib/nms/cpu_nms.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
cythoning nms/gpu_nms.pyx to nms/gpu_nms.cpp
/cta/users/byaman/craftEnv/lib/python2.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /cta/users/byaman/craftGBD/evaluation/lib/nms/gpu_nms.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
skipping 'pycocotools/_mask.c' Cython extension (up-to-date)
building 'utils.cython_bbox' extension
['-Wno-cpp', '-Wno-unused-function'] .c ['-I/cta/users/byaman/craftEnv/lib/python2.7/site-packages/numpy/core/include', '-I/cta/users/byaman/craftEnv/include/python2.7', '-c'] ['-Wno-cpp', '-Wno-unused-function'] ['-I/cta/users/byaman/craftEnv/lib/python2.7/site-packages/numpy/core/include', '-I/cta/users/byaman/craftEnv/include/python2.7']
/cta/users/byaman/craftEnv/bin/x86_64-conda-linux-gnu-cc -fno-strict-aliasing -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -DNDEBUG -fwrapv -O3 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /cta/users/byaman/craftEnv/include -I/cta/apps/opt/spack/linux-ubuntu18.04-cascadelake/gcc-10.2.0/cuda-10.0.130-zjercki4memwdfwjztmfkq2yio2jcev4/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /cta/users/byaman/craftEnv/include -I/cta/apps/opt/spack/linux-ubuntu18.04-cascadelake/gcc-10.2.0/cuda-10.0.130-zjercki4memwdfwjztmfkq2yio2jcev4/include -fPIC -I/cta/users/byaman/craftEnv/lib/python2.7/site-packages/numpy/core/include -I/cta/users/byaman/craftEnv/include/python2.7 -c utils/bbox.c -o build/temp.linux-x86_64-2.7/utils/bbox.o -Wno-cpp -Wno-unused-function
x86_64-conda_cos6-linux-gnu-gcc -pthread -shared -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-rpath,/cta/users/byaman/craftEnv/lib -L/cta/users/byaman/craftEnv/lib -Wl,--no-as-needed -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/cta/users/byaman/craftEnv/lib -Wl,-rpath-link,/cta/users/byaman/craftEnv/lib -L/cta/users/byaman/craftEnv/lib -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /cta/users/byaman/craftEnv/include -I/cta/apps/opt/spack/linux-ubuntu18.04-cascadelake/gcc-10.2.0/cuda-10.0.130-zjercki4memwdfwjztmfkq2yio2jcev4/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /cta/users/byaman/craftEnv/include -I/cta/apps/opt/spack/linux-ubuntu18.04-cascadelake/gcc-10.2.0/cuda-10.0.130-zjercki4memwdfwjztmfkq2yio2jcev4/include build/temp.linux-x86_64-2.7/utils/bbox.o -L/cta/users/byaman/craftEnv/lib -lpython2.7 -o /cta/users/byaman/craftGBD/evaluation/lib/utils/cython_bbox.so
/cta/users/byaman/craftEnv/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /cta/users/byaman/craftEnv/lib/libc.a(__stack_chk_fail.o): relocation R_X86_64_32 against symbol `__stack_chk_guard' can not be used when making a shared object; recompile with -fPIC
collect2: error: ld returned 1 exit status
error: command 'x86_64-conda_cos6-linux-gnu-gcc' failed with exit status 1
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1
Note that my username is byaman and I run the code inside the Conda environment, which is craftEnv.
The code that is run by Makefile is:
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
from os.path import join as pjoin
from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import subprocess
import numpy as np
def find_in_path(name, path):
"Find a file in a search path"
# Adapted fom
# http://code.activestate.com/recipes/52224-find-a-file-given-a-search-path/
for dir in path.split(os.pathsep):
binpath = pjoin(dir, name)
if os.path.exists(binpath):
return os.path.abspath(binpath)
return None
def locate_cuda():
"""Locate the CUDA environment on the system
Returns a dict with keys 'home', 'nvcc', 'include', and 'lib64'
and values giving the absolute path to each directory.
Starts by looking for the CUDAHOME env variable. If not found, everything
is based on finding 'nvcc' in the PATH.
"""
# first check if the CUDAHOME env variable is in use
if 'CUDAHOME' in os.environ:
home = os.environ['CUDAHOME']
nvcc = pjoin(home, 'bin', 'nvcc')
else:
# otherwise, search the PATH for NVCC
default_path = pjoin(os.sep, 'usr', 'local', 'cuda', 'bin')
nvcc = find_in_path('nvcc', os.environ['PATH'] + os.pathsep + default_path)
if nvcc is None:
raise EnvironmentError('The nvcc binary could not be '
'located in your $PATH. Either add it to your path, or set $CUDAHOME')
home = os.path.dirname(os.path.dirname(nvcc))
cudaconfig = {'home':home, 'nvcc':nvcc,
'include': pjoin(home, 'include'),
'lib64': pjoin(home, 'lib64')}
for k, v in cudaconfig.iteritems():
if not os.path.exists(v):
raise EnvironmentError('The CUDA %s path could not be located in %s' % (k, v))
return cudaconfig
CUDA = locate_cuda()
# Obtain the numpy include directory. This logic works across numpy versions.
try:
numpy_include = np.get_include()
except AttributeError:
numpy_include = np.get_numpy_include()
def customize_compiler_for_nvcc(self):
"""inject deep into distutils to customize how the dispatch
to gcc/nvcc works.
If you subclass UnixCCompiler, it's not trivial to get your subclass
injected in, and still have the right customizations (i.e.
distutils.sysconfig.customize_compiler) run on it. So instead of going
the OO route, I have this. Note, it's kindof like a wierd functional
subclassing going on."""
# tell the compiler it can processes .cu
self.src_extensions.append('.cu')
# save references to the default compiler_so and _comple methods
default_compiler_so = self.compiler_so
super = self._compile
# now redefine the _compile method. This gets executed for each
# object but distutils doesn't have the ability to change compilers
# based on source extension: we add it.
def _compile(obj, src, ext, cc_args, extra_postargs, pp_opts):
if os.path.splitext(src)[1] == '.cu':
# use the cuda for .cu files
self.set_executable('compiler_so', CUDA['nvcc'])
# use only a subset of the extra_postargs, which are 1-1 translated
# from the extra_compile_args in the Extension class
postargs = extra_postargs['nvcc']
else:
postargs = extra_postargs['gcc']
super(obj, src, ext, cc_args, postargs, pp_opts)
# reset the default compiler_so, which we might have changed for cuda
self.compiler_so = default_compiler_so
# inject our redefined _compile method into the class
self._compile = _compile
# run the customize_compiler
class custom_build_ext(build_ext):
def build_extensions(self):
customize_compiler_for_nvcc(self.compiler)
build_ext.build_extensions(self)
ext_modules = [
Extension(
"utils.cython_bbox",
["utils/bbox.pyx"],
extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]},
include_dirs = [numpy_include]
),
Extension(
"nms.cpu_nms",
["nms/cpu_nms.pyx"],
extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]},
include_dirs = [numpy_include]
),
Extension('nms.gpu_nms',
['nms/nms_kernel.cu', 'nms/gpu_nms.pyx'],
library_dirs=[CUDA['lib64']],
libraries=['cudart'],
language='c++',
runtime_library_dirs=[CUDA['lib64']],
# this syntax is specific to this build system
# we're only going to use certain compiler args with nvcc and not with
# gcc the implementation of this trick is in customize_compiler() below
extra_compile_args={'gcc': ["-Wno-unused-function"],
'nvcc': ['-arch=sm_35',
'--ptxas-options=-v',
'-c',
'--compiler-options',
"'-fPIC'"]},
include_dirs = [numpy_include, CUDA['include']]
),
Extension(
'pycocotools._mask',
sources=['pycocotools/maskApi.c', 'pycocotools/_mask.pyx'],
include_dirs = [numpy_include, 'pycocotools'],
extra_compile_args={
'gcc': ['-Wno-cpp', '-Wno-unused-function', '-std=c99']},
),
]
setup(
name='fast_rcnn',
ext_modules=ext_modules,
# inject our custom trigger
cmdclass={'build_ext': custom_build_ext},
)
I don't know how to solve this problem even though I investigated following questions/answers:
"relocation R_X86_64_32S against " linking Error
How to recompile with -fPIC
Cython wrapping a class that uses another library

Makefile: embedded statements

I have in the /bin folder a file program.cc.
The following Makefile statements
BINS = $(wildcard bin/*.cc)
EXECS = $(notdir $(BINS))
EXECSR = $(EXECS:.cc=)
mean that EXECSR is program
I try to avoid the intermediary variable EXECS in the above statements
BINS = $(wildcard bin/*.cc)
EXECSR = $($(notdir $(BINS)):.cc=)
but this approach fails - EXECSR is empty. How should I modify the Makefile to avoid the intermediary variable EXECS?
EXECSR = $(notdir $(BINS:.cc=))

undefined reference to__aeabi_ldivmod when building kernel for arm32

When building one kernel image for arm32 platform, in the final linking, the error is:
arm-eabi-ld -EL -p --no-undefined -X --build-id -o .tmp_vmlinux1 -T obj/KERNEL/arch/arm/kernel/vmlinux.lds arch/arm/kernel/head.o init/built-in.o --start-group usr/built-in.o arch/arm/vfp/built-in.o arch/arm/kernel/built-in.o arch/arm/mm/built-in.o arch/arm/common/built-in.o arch/arm/net/built-in.o arch/arm/crypto/built-in.o arch/arm/mach-sc/built-in.o kernel/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o block/built-in.o arch/arm/lib/lib.a lib/lib.a arch/arm/lib/built-in.o lib/built-in.o drivers/built-in.o sound/built-in.o firmware/built-in.o arch/arm/oprofile/built-in.o net/built-in.o --end-group
drivers/built-in.o:
undefined reference to `__aeabi_ldivmod'
make[2]: *** [vmlinux] Error 1
I know the reason is my using 64bit divison for arm32 which 64bit is not supported, and using do_div() can get rid of the __aeabi_ldivmod error. I know __aeabi_ldivmod is defined in the libgcc.a, so I added the following code in my Kernel Makefile:
--- a/Makefile
+++ b/Makefile
## -677,6 +677,7 ##
LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
$(call cc-ldoption, -Wl$(comma)--build-id,))
KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
+LDFLAGS_vmlinux += -L$(MY_LIBPATH) -lgcc
But it still can't work, so can anybody help on my questions:
1) Why the libgcc.a is not linked default in the kernel building?
2) How to link the libgcc.a to fix the link error?
[Update]
OK, I found the following note for -lgcc in OSDev wiki:
-lgcc
You disable the important libgcc library when you pass -nodefaultlibs (implied by -nostdlib). The compiler needs this library for many operations that it cannot do itself or that is more efficient to put into a shared function. You must pass this library near the end of the link line, after all the other object files and libraries, or the linker won't use it and you get strange linker errors.
So I hard coded -L${MYLIB_PATH} -lgcc into into scripts/link-vmlinux.sh:
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
## -55,7 +55,7 ## vmlinux_link()
if [ "${SRCARCH}" != "um" ]; then
${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \
-T ${lds} ${KBUILD_VMLINUX_INIT} \
- --start-group ${KBUILD_VMLINUX_MAIN} --end-group ${1}
+ --start-group ${KBUILD_VMLINUX_MAIN} --end-group ${1} -L${MYLIB_PATH} -lgcc
else
${CC} ${CFLAGS_vmlinux} -o ${2} \
-Wl,-T,${lds} ${KBUILD_VMLINUX_INIT} \
Then the build went without __aeabi_ldivmod error.
While I want to find the better modifying than just harding coding and to know why kernel doesn't link libgcc default.
Don't edit scripts/link-vmlinux.sh, edit only certain Makefiles. For example if you have this error:
drivers/power/reset/msm-poweroff.c:249: undefined reference to `lge_set_restart_reason'
run cscope -R inside top of linux kernel source code directory, then find global definition for lge_set_restart_reason, it finds file definition in include/soc/qcom/lge/lge_handle_panic.h
But lge_handle_panic.h has only definition of lge_set_restart_reason, you need lge_handle_panic.c, which has this function, looking like this:
void lge_set_restart_reason(unsigned int reason)
{
writel_relaxed(reason, RESTART_REASON);
if(use_hardreset) {
qpnp_pon_set_restart_reason(map_imem_reboot_to_pmic(reason));
qpnp_pon_system_pwr_off(PON_POWER_OFF_HARD_RESET);
}
}
so you need to edit drivers/power/reset/Makefile to include lge_handle_panic.o object file:
obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o lge_handle_panic.o
In custom kernels, a lot of functions is enabled by config, what I mean is:
#ifdef CONFIG_LGE_HANDLE_PANIC
static void __iomem *msm_timer0_base;
void __iomem *wdt_timer_get_timer0_base(void)
{
return msm_timer0_base;
}
static void wdt_timer_set_timer0_base(void __iomem * iomem)
{
msm_timer0_base = iomem;
}
#endif
You need enable CONFIG_LGE_HANDLE_PANIC, or any config if you have again this error, or remove "ifdef" and "endif" (I'm not recommending doing this)

GNU Make: How to perform second expansion with suffix-changing substitution

What I'm going for (what's failing)
I have a list of dependencies for each file:
point_deps =
bounds_deps = point
triangle_deps = point bounds
Image_deps = types bounds triangle
main_deps = Image triangle bounds point types
I'd like to write a rule to include the relevant dependencies. Here's my best attempt:
out/%.o: src/%.cpp src/%.h $$($$*_deps:%=src/%.h)
g++ -o $# -c $<
I expect $* to evaluate to, for instance, "main". Then the suffix-changing substitution should change each entry in the dependency list to begin with "src/" and end with ".h".
When I try to run the code above, I get an error (on the out/%.o line):
makefile:26: *** multiple target patterns. Stop.
What's working (non-optimal)
For now I have to create a separate variable for each file's header dependencies:
point_deps_h = $(point_deps:%=src/%.h)
bounds_deps_h = $(bounds_deps:%=src/%.h)
triangle_deps_h = $(triangle_deps:%=src/%.h)
Image_deps_h = $(Image_deps:%=src/%.h)
main_deps_h = $(main_deps:%=src/%.h)
Then I can use secondary-expansion to include the correct header files:
out/%.o: src/%.cpp src/%.h $$($$*_deps_h)
g++ -o $# -c $<

gmake fails immediately in PASE

I'm a security officer on this iSeries, using PASE (Portable Application Security Environment -- essentially a virtual AIX-like sandbox on OS/400) to compile Ghostscript 9.05. I've downloaded and installed RPM for AIX in my PASE environment, and then used the RPMs for gcc (gcc-4.0.0-1.aix5.3.ppc) and the rest of a standard GNU dev environment to install them on PASE, as well. Configure works fine (within /QOpenSys/usr/bin/-sh, I use CALL QP2TERM to get there), but when I then attempt gmake (make defaults to cc instead of gcc here), it fails immediately with:
$ pwd
/QOpenSys/download/ghostscript-9.05/ghostscript-9.05
$ gmake
Makefile:1: *** missing separator. Stop.
I read the previous question on this, and purged my Makefile.in of comments and ran it through cat -vet Makefile.in. Results are included below; they look fine to me, but I still receive the error above. (Note that this was pulled from a 5250 emulator session; line breaks in the display do not correlate with Makefile.in line breaks, which are shown as a $ instead):
$ cat -vet Makefile.in
BINDIR=./$(BUILDDIRPREFIX)bin$
GLSRCDIR=./base$
GLGENDIR=./$(BUILDDIRPREFIX)#OBJDIR_BSDMAKE_WORKAROUND#$
GLOBJDIR=./$(BUILDDIRPREFIX)#OBJDIR_BSDMAKE_WORKAROUND#$
AUXDIR=$(GLGENDIR)/aux$
PSSRCDIR=./psi$
PSLIBDIR=./lib$
PSRESDIR=./Resource$
PSGENDIR=./$(BUILDDIRPREFIX)#OBJDIR_BSDMAKE_WORKAROUND#$
PSOBJDIR=./$(BUILDDIRPREFIX)#OBJDIR_BSDMAKE_WORKAROUND#$
CONTRIBDIR=./contrib$
include $(GLSRCDIR)/version.mak$
DD=$(GLGENDIR)/$
GLD=$(GLGENDIR)/$
PSD=$(PSGENDIR)/$
INSTALL = $(GLSRCDIR)/instcopy -c$
INSTALL_PROGRAM = $(INSTALL) -m 755$
INSTALL_DATA = $(INSTALL) -m 644$
INSTALL_SHARED = #INSTALL_SHARED#$
prefix = #prefix#$
exec_prefix = #exec_prefix#$
bindir = #bindir#$
scriptdir = $(bindir)$
includedir = #includedir#$
libdir = #libdir#$
mandir = #mandir#$
man1ext = 1$
man1dir = $(mandir)/man$(man1ext)$
datadir = #datadir#$
datarootdir = #datarootdir#$
gsdir = #datadir#/ghostscript$
gsdatadir = $(gsdir)/$(GS_DOT_VERSION)$
gssharedir = #libdir#/ghostscript/$(GS_DOT_VERSION)$
gsincludedir = #includedir#/ghostscript/$
docdir=$(gsdatadir)/doc$
exdir=$(gsdatadir)/examples$
GS_DOCDIR=$(docdir)$
CUPSCFLAGS=#CUPSCFLAGS#$
CUPSLIBS=#CUPSLIBS#$
CUPSLIBDIRS=#CUPSLIBDIRS#$
CUPSSERVERBIN=#CUPSSERVERBIN#$
CUPSSERVERROOT=#CUPSSERVERROOT#$
CUPSDATA=#CUPSDATA#$
CUPSPDFTORASTER=#CUPSPDFTORASTER#$
CUPSINSTTARGET=#CUPSINSTALL#$
COMPILE_INITS=#COMPILE_INITS#$
GS_LIB_DEFAULT=$(gsdatadir)/Resource/Init:$(gsdatadir)/lib:$(gsdatadir)/Resou
rce/Font:$(gsdir)/fonts:#fontpath#$
GS_CACHE_DIR="~/.ghostscript/cache/"$
SEARCH_HERE_FIRST=0$
GS_INIT=gs_init.ps$
GENOPT=$
CAPOPT= #HAVE_MKSTEMP# #HAVE_FILE64# #HAVE_MKSTEMP64# #HAVE_FONTCONFIG# #HAVE
_LIBIDN# #HAVE_SETLOCALE# #HAVE_SSE2# #HAVE_DBUS# #HAVE_BSWAP32# #HAVE_BYTESW
AP_H#$
GS=#GS##EXEEXT#$
DEBUGDIRPREFIX=debug$
MEMENTODIRPREFIX=mem$
PGDIRPREFIX=pg$
FT_BRIDGE=#FT_BRIDGE#$
SHARE_FT=#SHARE_FT#$
FTSRCDIR=#FTSRCDIR#$
FT_CFLAGS=#FT_CFLAGS#$
FT_LIBS=#FT_LIBS#$
FT_CONFIG_SYSTEM_ZLIB=#FT_SYS_ZLIB#$
#INSERT_UFST_BRIDGE_EQUAL_ONE#$
UFST_ROOT=#UFST_ROOT#$
UFST_LIB_EXT=#UFST_LIB_EXT#$
UFST_ROMFS_ARGS?=-b \$
-P $(UFST_ROOT)/fontdata/mtfonts/pcl45/mt3/ -d fontdata/mtfonts/pcl45/mt3/ p
cl___xj.fco plug__xi.fco wd____xh.fco \$
-P $(UFST_ROOT)/fontdata/mtfonts/pclps2/mt3/ -d fontdata/mtfonts/pclps2/mt3/
pclp2_xj.fco \$
-c -P $(PSSRCDIR)/../lib/ -d Resource/Init/ FAPIconfig-FCO$
UFSTROMFONTDIR=\"%rom%fontdata/\"$
UFSTDISCFONTDIR?=\"$(UFST_ROOT)/fontdata/\"$
UFST_CFLAGS=#UFST_CFLAGS#$
JSRCDIR=#LIBJPEGDIR#$
SHARE_JPEG=#SHARE_LIBJPEG#$
JPEG_NAME=jpeg$
SHARE_LIBPNG=#SHARE_LIBPNG#$
PNGSRCDIR=#LIBPNGDIR#$
LIBPNG_NAME=png$
SHARE_LIBTIFF=#SHARE_LIBTIFF#$
TIFFSRCDIR=#LIBTIFFDIR#$
TIFFPLATFORM=unix$
TIFFCONFIG_SUFFIX=$
LIBTIFF_NAME=tiff$
SHARE_ZLIB=#SHARE_ZLIB#$
ZSRCDIR=#ZLIBDIR#$
ZLIB_NAME=z$
JBIG2_LIB=#JBIG2_DECODER#$
SHARE_JBIG2=#SHARE_JBIG2#$
JBIG2SRCDIR=#JBIG2DIR#$
JBIG2_CFLAGS=#JBIG2_AUTOCONF_CFLAGS#$
JPX_LIB=#JPX_DECODER#$
SHARE_JPX=#SHARE_JPX#$
JPXSRCDIR=#JPXDIR#$
JPX_CFLAGS=#JPX_AUTOCONF_CFLAGS#$
ICCSRCDIR=icclib$
SHARE_LCMS=#SHARELCMS#$
LCMSSRCDIR=#LCMSDIR#$
LCMS2SRCDIR=#LCMS2DIR#$
LCMS_CFLAGS=#LCMS_ENDIAN#$
LCMS2_CFLAGS=#LCMS2_ENDIAN#$
WHICH_CMS=#WHICHLCMS#$
SHARE_IJS=#SHAREIJS#$
IJS_NAME=#IJSLIB#$
IJSSRCDIR=#IJSDIR#$
IJSEXECTYPE=unix$
SHARE_LCUPS=#SHARELCUPS#$
LCUPS_NAME=cups$
LCUPSSRCDIR=cups$
LCUPSBUILDTYPE=#LCUPSBUILDTYPE#$
CUPS_CC=$(CC)$
SHARE_LCUPSI=#SHARELCUPSI#$
LCUPSI_NAME=cupsimage$
LCUPSISRCDIR=cups$
CUPS_CC=$(CC)$
AR=ar$
ARFLAGS=qc$
RANLIB=#RANLIB#$
CC=#CC#$
CCAUX=#CC#$
CCLD=$(CC)$
CCAUXLD=$(CCAUX)$
GCFLAGS=#CPPFLAGS# #GCFLAGS# #CFLAGS#$
CFLAGS_STANDARD=#OPT_CFLAGS#$
CFLAGS_DEBUG=#DBG_CFLAGS#$
CFLAGS_PROFILE=-pg #OPT_CFLAGS#$
CFLAGS_SO=#DYNAMIC_CFLAGS#$
AC_CFLAGS=#DYNAMIC_FLAGS#$
FONTCONFIG_CFLAGS=#FONTCONFIG_CFLAGS#$
FONTCONFIG_LIBS=#FONTCONFIG_LIBS#$
DBUS_CFLAGS=#DBUS_CFLAGS#$
DBUS_LIBS=#DBUS_LIBS#$
ACDEFS=#DEFS#$
CFLAGS=$(CFLAGS_STANDARD) $(GCFLAGS) $(AC_CFLAGS) $(XCFLAGS)$
AC_LDFLAGS=#X_LDFLAGS#$
LDFLAGS=#LDFLAGS# $(AC_LDFLAGS) $(XLDFLAGS)$
EXTRALIBS=$(XTRALIBS) #LIBS# #DYNAMIC_LIBS# #FONTCONFIG_LIBS# #FT_LIBS#$
STDLIBS=#PTHREAD_LIBS# -lm$
XINCLUDE=#X_CFLAGS#$
XLIBDIRS=#X_LDFLAGS#$
XLIBDIR=$
XLIBS=#X_LIBS#$
SYNC=#SYNC#$
RM=rm -f$
SOC_CFLAGS^I=^I#SOC_CFLAGS#$
SOC_LIBS^I=^I#SOC_LIBS#$
SOC_LOADER^I=^I#SOC_LOADER#$
FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev
$(PSD)epsf.dev $(GLD)pipe.dev $(GLD)gsnogc.dev $(GLD)htxlib.dev $(PSD)fapi.de
v #JBIG2DEVS# #JPXDEVS# #UTF8DEVS#$
FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.
dev $(PSD)rasterop.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $
(GLD)pipe.dev $(GLD)gsnogc.dev $(GLD)htxlib.dev #JBIG2DEVS# #JPXDEVS# #UTF8DE
VS#$
RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource
/Font/ Resource/ProcSet/ Resource/IdiomSet/ Resource/CIDFont/$
BAND_LIST_STORAGE=file$
BAND_LIST_COMPRESSOR=zlib$
FILE_IMPLEMENTATION=stdio$
STDIO_IMPLEMENTATION=c$
GS_DEV_DEFAULT="x11alpha bbox"$
DISPLAY_DEV=$(DD)bbox.dev$
DEVICE_DEVS=$(DISPLAY_DEV) #X11_DEVS#$
DEVICE_DEVS1=#F_DEVS#$
DEVICE_DEVS2=#P_DEVS#$
DEVICE_DEVS3=#CUPS_DEVS#$
DEVICE_DEVS4=#IJS_DEVS#$
DEVICE_DEVS5=#OMNIDEVS#$
DEVICE_DEVS6=#PNG_DEVS#$
DEVICE_DEVS7=#JBIG2_DEVS#$
DEVICE_DEVS8=#SVG_DEVS#$
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_DEVS21=$
GS_SHARED_OBJS=#DYNAMIC_DEVS#$
MAKEFILE=Makefile$
TOP_MAKEFILES=$(MAKEFILE) $(GLSRCDIR)/unixhead.mak$
AK=$
CCFLAGS=$(GENOPT) $(CAPOPT) $(CFLAGS)$
CC_=$(CC) $(CCFLAGS)$
CCAUX_=$(CCAUX) $(CFLAGS)$
CC_LEAF=$(CC_)$
CC_LEAF_PG=$(CC_)$
CC_NO_WARN=$(CC_)$
CCAUX_NO_WARN=$(CCAUX_)$
CC_SHARED=$(CC_) #DYNAMIC_CFLAGS#$
LD_SET_DT_SONAME=#SET_DT_SONAME#$
FOR_MAC=#SO_FOR_MAC#$
MAKEDIRS=| directories$
MAKEDIRSTOP=$
INSTALL_CONTRIB=#INSTALL_CONTRIB#$
include $(GLSRCDIR)/unixhead.mak$
include $(GLSRCDIR)/gs.mak$
include $(PSSRCDIR)/psromfs.mak$
include $(GLSRCDIR)/lib.mak$
include $(PSSRCDIR)/int.mak$
include $(GLSRCDIR)/freetype.mak$
include $(GLSRCDIR)/jpeg.mak$
include $(GLSRCDIR)/zlib.mak$
include $(GLSRCDIR)/png.mak$
include $(GLSRCDIR)/tiff.mak$
include $(GLSRCDIR)/jbig2.mak$
include $(GLSRCDIR)/jasper.mak$
include $(GLSRCDIR)/ldf_jb2.mak$
include $(GLSRCDIR)/lwf_jp2.mak$
include $(GLSRCDIR)/openjpeg.mak$
include $(GLSRCDIR)/icclib.mak$
include $(GLSRCDIR)/$(WHICH_CMS).mak$
include $(GLSRCDIR)/ijs.mak$
#LCUPSINCLUDE#$
#LCUPSIINCLUDE#$
include $(GLSRCDIR)/devs.mak$
include $(GLSRCDIR)/contrib.mak$
include $(GLSRCDIR)/unix-aux.mak$
include $(GLSRCDIR)/unixlink.mak$
include $(GLSRCDIR)/unix-dll.mak$
include $(GLSRCDIR)/unix-end.mak$
include $(GLSRCDIR)/unixinst.mak$
#CONTRIBINCLUDE#$
#CUPSINCLUDE#$
distclean : clean config-clean soclean pgclean debugclean$
^I-$(RM_) -r $(BINDIR) $(GLOBJDIR) $(PSOBJDIR) $(AUXDIR)$
^I-$(RM_) -r autom4te.cache$
^I-$(RM_) config.log config.status$
^I-$(RM_) Makefile$
^I#-rmdir $(BINDIR) $(GLOBJDIR) $(PSOBJDIR)$
^I-$(RM_) $(TIFFSRCDIR)$(D)libtiff$(D)tif_config.h $(TIFFSRCDIR)$(D)libtiff$(
D)tiffconf.h$
debug-clean : debugclean$
memento-clean : mementoclean$
maintainer-clean : distclean$
^I-$(RM_) configure.ac$
^I-$(RM_) configure$
^I-$(RM_) Makefile.in$
check : default$
^I$(NO_OP)$
Figured this out. Full details and steps to reproduce are here: http://hewhocutsdown.net/blog/2012/04/25/how-to-compile-ghostscript-for-pase/
It came down to three items:
Using gcc 4.2.0 instead of older versions.
Running configure with the –build=”powerpc-ibmaix5.3.0.0” option.
Apply an AIX-specific patch to opj_malloc.h (an OpenJPEG libray), patch here: http://openjpeg.googlecode.com/issues/attachment?aid=1390001000&name=Issue_139-AIX-memalign.patch&token=fTYKtT77eCQohWNtP2epWWxP2xQ%3A1335385237594
gmake most likely does not do any character conversion, so it just reads raw EBCDIC.
Check the CCSID on the IFS file is 819.
(My usual trick for creating an empty file is touch -C 819 file. Also if at all possible compile on native AIX)
What's the value of the environment variable BUILDDIRPREFIX? Should it end with a '/'?

Resources