[omniORB] Patches to compile OO4 on AIX
Carl Thompson
cet@carlthompson.net
Wed, 14 Nov 2001 22:44:42 -0800
This is a multi-part message in MIME format.
--------------080600020801070205050807
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Hello,
I have attached patches to OO4 snapshot 2001-11-14 to allow it to be
compiled on AIX. Also includes some minor fixes for Windows and other
platforms...
IBM's VisualAge C++ compiler is severely broken. It didn't take long
for me to give up trying to get it to work. Consequently, this patch just
gets GCC 2.95 working on AIX. I added the file
mk/platforms/powerpc_aix_4.3_gcc.mk
which has the settings you need.
You _should_ be using a version of GCC compiled to use the GNU
assembler from the GNU binutils package because on at least one of the big
files (/src/lib/omniORB/dynamic/irstub.cc) the compiler generates too much
assembler code for the IBM assembler to handle. If you don't want to change
your GCC you can just try skipping libomniDynamic if you don't need it.
Your GCC must use the IBM linker because linker options need to be
passed. You don't have any choice anyway because the GNU linker currently
does not work on AIX.
Note that I had to hack up src/tool/omniidl/cxx/idlpython.cc a bit
because the Python method that was used to find the libraries did not seem
to work in all cases. I don't know Python so I fixed it using C++ code.
Enjoy,
Carl Thompson
--------------080600020801070205050807
Content-Type: text/plain;
name="omniORB-20011114-aix.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="omniORB-20011114-aix.patch"
Index: pkgs/omniORB/src/mk/platforms/i586_linux_2.0_glibc2.1.mk
diff -c pkgs/omniORB/src/mk/platforms/i586_linux_2.0_glibc2.1.mk:1.1.1.1 pkgs/omniORB/src/mk/platforms/i586_linux_2.0_glibc2.1.mk:1.3
*** pkgs/omniORB/src/mk/platforms/i586_linux_2.0_glibc2.1.mk:1.1.1.1 Fri Oct 12 22:27:46 2001
--- pkgs/omniORB/src/mk/platforms/i586_linux_2.0_glibc2.1.mk Tue Nov 6 17:05:09 2001
***************
*** 18,25 ****
#PYTHON = $(ABSTOP)/$(BINDIR)/omnipython
#PYTHON = /usr/local/bin/python
-
#
# Include general unix things
#
--- 18,25 ----
#PYTHON = $(ABSTOP)/$(BINDIR)/omnipython
#PYTHON = /usr/local/bin/python
+ PYTHON = /usr/bin/python
#
# Include general unix things
#
***************
*** 136,143 ****
#
#OPEN_SSL_ROOT = /usr/local/openssl
#
OPEN_SSL_CPPFLAGS = -I$(OPEN_SSL_ROOT)/include
! OPEN_SSL_LIB = -L$(OPEN_SSL_ROOT)/lib -lssl -lcrypto
OMNIORB_SSL_LIB += $(OPEN_SSL_LIB)
OMNIORB_SSL_CPPFLAGS += $(OPEN_SSL_CPPFLAGS)
--- 136,144 ----
#
#OPEN_SSL_ROOT = /usr/local/openssl
#
OPEN_SSL_CPPFLAGS = -I$(OPEN_SSL_ROOT)/include
! OPEN_SSL_LIB = -L$(OPEN_SSL_ROOT) -lssl -lcrypto
OMNIORB_SSL_LIB += $(OPEN_SSL_LIB)
OMNIORB_SSL_CPPFLAGS += $(OPEN_SSL_CPPFLAGS)
Index: pkgs/omniORB/src/mk/platforms/powerpc_aix_4.3_gcc.mk
diff -c /dev/null pkgs/omniORB/src/mk/platforms/powerpc_aix_4.3_gcc.mk:1.3
*** /dev/null Wed Nov 14 20:38:07 2001
--- pkgs/omniORB/src/mk/platforms/powerpc_aix_4.3_gcc.mk Wed Nov 14 20:23:01 2001
***************
*** 0 ****
--- 1,265 ----
+ #
+ # powerpc_aix_4.3_gcc.mk - make variables and rules specific to gcc 2.95
+ # on PowerPC AIX 4.3
+ #
+
+ AIX = 1
+ PowerPCProcessor = 1
+
+ ABSTOP = $(shell cd $(TOP); pwd)
+
+ AIX_MAJOR_VERS := $(shell uname -v)
+ AIX_MINOR_VERS := $(shell uname -r)
+
+ #
+ # Python set-up
+ #
+ # You must set paths to a Python 1.5.2 interpreter and library.
+
+ #PYTHON = /usr/local/bin/python
+ #PYTHONLIBDIR = /usr/local/lib/python1.5/config
+
+ #
+ # Include general unix things
+ #
+
+ include $(THIS_IMPORT_TREE)/mk/unix.mk
+
+ #
+ # C preprocessor macro definitions for this architecture
+ #
+
+ IMPORT_CPPFLAGS += -D__aix__ -D__powerpc__ -D__OSVERSION__=${AIX_MAJOR_VERS}
+
+ #
+ # Standard programs
+ #
+
+ AR = ar r
+ RANLIB = /bin/true
+ MKDIRHIER = mkdir -p
+ INSTALL = $(BASE_OMNI_TREE)/bin/scripts/install-sh -c
+
+ CMAKEDEPEND += -D_AIX
+ CXXMAKEDEPEND += -D__cplusplus -D_AIX
+
+ ############################################################################
+ # Using gcc 2.95 (built with --enable-threads) #
+ # Not well tested yet. #
+ ############################################################################
+ CXX = gcc
+ CXXDEBUGFLAGS = -O2
+ CXXOPTIONS =
+ CXXLINK = g++
+ MTFLAGS =
+ #
+ CC = gcc
+ CLINK = gcc
+ #############################################################################
+
+
+ # Name all static libraries with -ar.a suffix.
+ LibPattern = lib%-ar.a
+ LibDebugPattern = lib%-ar.a
+ LibNoDebugPattern = lib%-ar.a
+ LibSuffixPattern = %-ar.a
+ LibSearchPattern = -l%-ar
+
+ # Name all shared libraries with .a suffix
+ LibSharedPattern = lib%.a
+ LibSharedSuffixPattern = %.a
+ LibSharedSearchPattern = -l%
+
+ #
+ # OMNI thread stuff
+ #
+ ThreadSystem = Posix
+
+ OMNITHREAD_POSIX_CPPFLAGS = -DNoNanoSleep -DPthreadDraftVersion=10
+ OMNITHREAD_CPPFLAGS = -D_REENTRANT -D_THREAD_SAFE
+ OMNITHREAD_LIB = -lomnithread$(OMNITHREAD_MAJOR_VERSION)$(OMNITHREAD_MINOR_VERSION) $(OMNITHREAD_PLATFORM_LIB)
+ OMNITHREAD_STATIC_LIB = -lomnithread-ar -lpthreads-ar
+ OMNITHREAD_PLATFORM_LIB = -lpthreads
+
+ #
+ # CORBA stuff
+ #
+
+ CorbaImplementation = OMNIORB
+
+ CXXLINKOPTIONS=-Wl,-bbigtoc
+ CLINKOPTIONS=-Wl,-bbigtoc
+
+
+ define CXXExecutable
+ (set -x; \
+ $(RM) $@; \
+ $(CXXLINK) -o $@ $(CXXLINKOPTIONS) $(IMPORT_LIBRARY_FLAGS) \
+ $(filter-out $(LibSharedSuffixPattern), $(filter-out $(LibSuffixPattern),$^)) $$libs; \
+ )
+ endef
+
+ define CExecutable
+ (set -x; \
+ $(RM) $@; \
+ $(CLINK) -o $@ $(CLINKOPTIONS) $(IMPORT_LIBRARY_FLAGS) \
+ $(filter-out $(LibSharedSuffixPattern), $(filter-out $(LibSuffixPattern),$^)) $$libs; \
+ )
+ endef
+
+ # Default location of the omniORB configuration file [falls back to this if
+ # the environment variable OMNIORB_CONFIG is not set] :
+
+ OMNIORB_CONFIG_DEFAULT_LOCATION = /etc/omniORB.cfg
+
+ # Default directory for the omniNames log files.
+ OMNINAMES_LOG_DEFAULT_LOCATION = /var/omninames
+
+ ##########################################################################
+ #
+ # Shared library support stuff
+ #
+ # Default setup. Work for most platforms. For those exceptions, override
+ # the rules in their platform files.
+ #
+ SHAREDLIB_SUFFIX = a
+
+ SharedLibraryFullNameTemplate = lib$$1$$2$$3$$4.$(SHAREDLIB_SUFFIX)
+ SharedLibrarySoNameTemplate = lib$$1$$2.$(SHAREDLIB_SUFFIX).$$3
+ SharedLibraryLibNameTemplate = lib$$1$$2$$3.$(SHAREDLIB_SUFFIX)
+
+
+ BuildSharedLibrary = 1 # Enable
+ SHAREDLIB_CPPFLAGS =
+
+ define MakeCXXSharedLibrary
+ $(ParseNameSpec); \
+ soname=$(SharedLibrarySoNameTemplate); \
+ set -x; \
+ $(RM) $@; \
+ $(CXXLINK) -shared \
+ -o $$soname $(IMPORT_LIBRARY_FLAGS) \
+ $(filter-out $(LibSuffixPattern),$^) $$extralibs ; \
+ ar cq $@ $$soname; \
+ $(RM) $$soname;
+ endef
+
+
+ # ExportSharedLibrary- export sharedlibrary
+ # Expect shell variable:
+ # namespec = <library name> <major ver. no.> <minor ver. no.> <micro ver. no>
+ # e.g. namespec = "COS 3 0 0" --> shared library libCOS300.a
+ #
+ define ExportSharedLibrary
+ $(ExportLibrary); \
+ $(ParseNameSpec); \
+ libname=$(SharedLibraryLibNameTemplate); \
+ set -x; \
+ cd $(EXPORT_TREE)/$(LIBDIR); \
+ $(RM) $$libname; \
+ ln -s $(<F) $$libname;
+ endef
+
+ OPEN_SSL_ROOT = $(ABSTOP)/../../../openssl/work/src
+
+ OPEN_SSL_CPPFLAGS = -I$(OPEN_SSL_ROOT)/include
+ OPEN_SSL_LIB = -L$(OPEN_SSL_ROOT) -lssl -lcrypto
+ OMNIORB_SSL_LIB += $(OPEN_SSL_LIB)
+ OMNIORB_SSL_CPPFLAGS += $(OPEN_SSL_CPPFLAGS)
Index: pkgs/omniORB/src/mk/platforms/powerpc_aix_4.3_xlc5.mk
diff -c pkgs/omniORB/src/mk/platforms/powerpc_aix_4.3_xlc5.mk:1.1.1.1 pkgs/omniORB/src/mk/platforms/powerpc_aix_4.3_xlc5.mk:1.3
*** pkgs/omniORB/src/mk/platforms/powerpc_aix_4.3_xlc5.mk:1.1.1.1 Fri Oct 12 22:27:46 2001
--- pkgs/omniORB/src/mk/platforms/powerpc_aix_4.3_xlc5.mk Tue Nov 6 17:05:09 2001
***************
*** 236,238 ****
--- 236,245 ----
$(RM) $$libname; \
ln -s $(<F) $$libname;
endef
+
+ OPEN_SSL_ROOT = $(ABSTOP)/../../../openssl/work/src
+
+ OPEN_SSL_CPPFLAGS = -I$(OPEN_SSL_ROOT)/include
+ OPEN_SSL_LIB = -L$(OPEN_SSL_ROOT) -lssl -lcrypto
+ OMNIORB_SSL_LIB += $(OPEN_SSL_LIB)
+ OMNIORB_SSL_CPPFLAGS += $(OPEN_SSL_CPPFLAGS)
Index: pkgs/omniORB/src/mk/platforms/sun4_sosV_5.6.mk
diff -c pkgs/omniORB/src/mk/platforms/sun4_sosV_5.6.mk:1.1.1.1 pkgs/omniORB/src/mk/platforms/sun4_sosV_5.6.mk:1.4
*** pkgs/omniORB/src/mk/platforms/sun4_sosV_5.6.mk:1.1.1.1 Fri Oct 12 22:27:46 2001
--- pkgs/omniORB/src/mk/platforms/sun4_sosV_5.6.mk Wed Nov 14 20:24:40 2001
***************
*** 39,45 ****
AR = ar cq
! MKDIRHIER = mkdirhier
INSTALL = $(BASE_OMNI_TREE)/bin/scripts/install-sh -c
CPP = /usr/ccs/lib/cpp
--- 40,46 ----
AR = ar cq
! MKDIRHIER = mkdir -p
INSTALL = $(BASE_OMNI_TREE)/bin/scripts/install-sh -c
CPP = /usr/ccs/lib/cpp
***************
*** 165,167 ****
--- 166,174 ----
endif
+ OPEN_SSL_ROOT = $(ABSTOP)/../../../openssl/work/src
+
+ OPEN_SSL_CPPFLAGS = -I$(OPEN_SSL_ROOT)/include
+ OPEN_SSL_LIB = -L$(OPEN_SSL_ROOT) -lssl -lcrypto
+ OMNIORB_SSL_LIB += $(OPEN_SSL_LIB)
+ OMNIORB_SSL_CPPFLAGS += $(OPEN_SSL_CPPFLAGS)
Index: pkgs/omniORB/src/mk/platforms/sun4_sosV_5.7.mk
diff -c pkgs/omniORB/src/mk/platforms/sun4_sosV_5.7.mk:1.1.1.1 pkgs/omniORB/src/mk/platforms/sun4_sosV_5.7.mk:1.4
*** pkgs/omniORB/src/mk/platforms/sun4_sosV_5.7.mk:1.1.1.1 Fri Oct 12 22:27:47 2001
--- pkgs/omniORB/src/mk/platforms/sun4_sosV_5.7.mk Wed Nov 14 20:24:40 2001
***************
*** 40,46 ****
AR = ar cq
! MKDIRHIER = mkdirhier
INSTALL = $(BASE_OMNI_TREE)/bin/scripts/install-sh -c
CPP = /usr/ccs/lib/cpp
--- 41,47 ----
AR = ar cq
! MKDIRHIER = mkdir -p
INSTALL = $(BASE_OMNI_TREE)/bin/scripts/install-sh -c
CPP = /usr/ccs/lib/cpp
***************
*** 167,169 ****
--- 168,176 ----
endif
+ OPEN_SSL_ROOT = $(ABSTOP)/../../../openssl/work/src
+
+ OPEN_SSL_CPPFLAGS = -I$(OPEN_SSL_ROOT)/include
+ OPEN_SSL_LIB = -L$(OPEN_SSL_ROOT) -lssl -lcrypto
+ OMNIORB_SSL_LIB += $(OPEN_SSL_LIB)
+ OMNIORB_SSL_CPPFLAGS += $(OPEN_SSL_CPPFLAGS)
Index: pkgs/omniORB/src/mk/platforms/x86_nt_4.0.mk
diff -c pkgs/omniORB/src/mk/platforms/x86_nt_4.0.mk:1.1.1.1 pkgs/omniORB/src/mk/platforms/x86_nt_4.0.mk:1.4
*** pkgs/omniORB/src/mk/platforms/x86_nt_4.0.mk:1.1.1.1 Fri Oct 12 22:27:47 2001
--- pkgs/omniORB/src/mk/platforms/x86_nt_4.0.mk Tue Nov 6 17:20:00 2001
***************
*** 20,29 ****
# Python from ftp://ftp.uk.research.att.com/pub/omniORB/python/
# In that case, uncomment the first line below.
! #PYTHON = $(ABSTOP)/$(BINDIR)/omnipython
#PYTHON = //c/progra~1/Python/python
-
#
# Include general win32 things
#
--- 20,28 ----
# Python from ftp://ftp.uk.research.att.com/pub/omniORB/python/
# In that case, uncomment the first line below.
! PYTHON = $(ABSTOP)/$(BINDIR)/omnipython
#PYTHON = //c/progra~1/Python/python
#
# Include general win32 things
#
Index: pkgs/omniORB/src/src/lib/omniORB/orbcore/ssl/dir.mk
diff -c pkgs/omniORB/src/src/lib/omniORB/orbcore/ssl/dir.mk:1.1.1.1 pkgs/omniORB/src/src/lib/omniORB/orbcore/ssl/dir.mk:1.3
*** pkgs/omniORB/src/src/lib/omniORB/orbcore/ssl/dir.mk:1.1.1.1 Fri Oct 12 22:28:30 2001
--- pkgs/omniORB/src/src/lib/omniORB/orbcore/ssl/dir.mk Wed Oct 31 12:53:16 2001
***************
*** 18,24 ****
CXXSRCS = $(SSL_SRCS)
ifdef Win32Platform
! EXTRA_LIBS = $(SOCKET_LIB) advapi32.lib
SHARED_ONLY_OBJS = msvcdllstub.o
endif
--- 18,24 ----
CXXSRCS = $(SSL_SRCS)
ifdef Win32Platform
! EXTRA_LIBS = $(SOCKET_LIB) advapi32.lib gdi32.lib
SHARED_ONLY_OBJS = msvcdllstub.o
endif
Index: pkgs/omniORB/src/src/tool/omniidl/dir.mk
diff -c pkgs/omniORB/src/src/tool/omniidl/dir.mk:1.1.1.1 pkgs/omniORB/src/src/tool/omniidl/dir.mk:1.2
*** pkgs/omniORB/src/src/tool/omniidl/dir.mk:1.1.1.1 Fri Oct 12 22:28:35 2001
--- pkgs/omniORB/src/src/tool/omniidl/dir.mk Wed Nov 14 20:25:55 2001
***************
*** 1,4 ****
! SUBDIRS = cxx python
ifndef PYTHON
all::
--- 1,4 ----
! SUBDIRS = python cxx
ifndef PYTHON
all::
Index: pkgs/omniORB/src/src/tool/omniidl/cxx/dir.mk
diff -c pkgs/omniORB/src/src/tool/omniidl/cxx/dir.mk:1.1.1.2 pkgs/omniORB/src/src/tool/omniidl/cxx/dir.mk:1.2
*** pkgs/omniORB/src/src/tool/omniidl/cxx/dir.mk:1.1.1.2 Tue Oct 30 17:49:24 2001
--- pkgs/omniORB/src/src/tool/omniidl/cxx/dir.mk Wed Nov 14 20:26:42 2001
***************
*** 228,235 ****
; \
)
- endif
-
all:: $(lib)
clean::
--- 228,233 ----
***************
*** 240,245 ****
--- 238,293 ----
endif
+
+ ifeq ($(notdir $(CXX)),g++)
+
+ # Build omniidl as an executable by linking in the python runtime library.
+
+ DIR_CPPFLAGS += -DOMNIIDL_EXECUTABLE
+ CXXLINKOPTIONS += -L$(PYTHONLIBDIR)
+
+
+ omniidl = $(patsubst %,$(BinPattern),omniidl)
+
+ all:: $(omniidl)
+
+ export:: $(omniidl)
+ @$(ExportExecutable)
+
+ clean::
+ $(RM) $(omniidl)
+
+ $(omniidl): $(OBJS) $(PYOBJS)
+ @(libs="-lpython$(PYVERSION) -lpthread -lm"; $(CXXExecutable))
+
+ endif
+
+
+ ifeq ($(notdir $(CXX)),gcc)
+
+ # Build omniidl as an executable by linking in the python runtime library.
+
+ DIR_CPPFLAGS += -DOMNIIDL_EXECUTABLE
+ CXXLINKOPTIONS += -L$(PYTHONLIBDIR)
+
+
+ omniidl = $(patsubst %,$(BinPattern),omniidl)
+
+ all:: $(omniidl)
+
+ export:: $(omniidl)
+ @$(ExportExecutable)
+
+ clean::
+ $(RM) $(omniidl)
+
+ $(omniidl): $(OBJS) $(PYOBJS)
+ @(libs="-lpython$(PYVERSION) -lpthread -lm"; $(CXXExecutable))
+
+ endif
+
+
+ endif
#############################################################################
# Make rules for FreeBSD #
Index: pkgs/omniORB/src/src/tool/omniidl/cxx/idlpython.cc
diff -c pkgs/omniORB/src/src/tool/omniidl/cxx/idlpython.cc:1.1.1.2 pkgs/omniORB/src/src/tool/omniidl/cxx/idlpython.cc:1.2
*** pkgs/omniORB/src/src/tool/omniidl/cxx/idlpython.cc:1.1.1.2 Tue Oct 30 17:49:24 2001
--- pkgs/omniORB/src/src/tool/omniidl/cxx/idlpython.cc Wed Nov 14 20:31:40 2001
***************
*** 1518,1523 ****
--- 1523,1531 ----
extern "C" int PyVMS_init(int* pvi_argc, char*** pvi_argv);
#endif
+ #include <stdio.h>
+ #include <string.h>
+
// It's awkward to make a command named 'omniidl' on NT which runs
// Python, so we make the front-end a Python executable which always
// runs omniidl.main.
***************
*** 1525,1535 ****
int
main(int argc, char** argv)
{
! const char* omniidl_string =
"import sys, os, os.path, string\n"
"\n"
"pylibdir = None\n"
! "binarchdir = os.path.abspath(os.path.dirname(sys.executable))\n"
"\n"
"if binarchdir != '':\n"
" sys.path.insert(0, binarchdir)\n"
--- 1533,1555 ----
int
main(int argc, char** argv)
{
! // The Python method used before to get command name doesn't work
! // right for all cases so use argv[0] instead. (Is there a better
! // Python method? I don't know Python...)
! // Convert backslashes in command name to forward slashes.
! char *argv0 = strdup(argv[0]);
! for (char *p; (p = strchr(argv0, '\\')); ) *p = '/';
!
! char omniidl_string[16384];
! #ifndef __WIN32__
! snprintf(omniidl_string, sizeof(omniidl_string),
! #else
! sprintf(omniidl_string,
! #endif
"import sys, os, os.path, string\n"
"\n"
"pylibdir = None\n"
! "binarchdir = os.path.abspath(os.path.dirname('%s'))\n"
"\n"
"if binarchdir != '':\n"
" sys.path.insert(0, binarchdir)\n"
***************
*** 1556,1562 ****
" sys.stderr.flush()\n"
" sys.exit(1)\n"
"\n"
! "omniidl.main.main()\n";
#ifdef __VMS
PyVMS_init(&argc, &argv);
--- 1576,1583 ----
" sys.stderr.flush()\n"
" sys.exit(1)\n"
"\n"
! "omniidl.main.main()\n",
! argv0);
#ifdef __VMS
PyVMS_init(&argc, &argv);
Index: pkgs/omniORB/src/src/tool/omniidl/cxx/cccp/dir.mk
diff -c pkgs/omniORB/src/src/tool/omniidl/cxx/cccp/dir.mk:1.1.1.1 pkgs/omniORB/src/src/tool/omniidl/cxx/cccp/dir.mk:1.2
*** pkgs/omniORB/src/src/tool/omniidl/cxx/cccp/dir.mk:1.1.1.1 Fri Oct 12 22:28:52 2001
--- pkgs/omniORB/src/src/tool/omniidl/cxx/cccp/dir.mk Wed Nov 14 20:30:07 2001
***************
*** 19,26 ****
--- 19,28 ----
#############################################################################
ifdef AIX
+ ifeq ($(notdir $(CXX)),xlC_r)
DIR_CPPFLAGS += -ma
endif
+ endif
ifdef Win32Platform
***************
*** 32,37 ****
--- 34,40 ----
export:: $(omnicpp)
@(dir="$(EXPORT_TREE)/$(LIBDIR)"; file="$(omnicpp)"; \
$(ExportExecutableFileToDir))
+ $(ExportExecutable)
endif
--------------080600020801070205050807--