Cross-compile Autotools-based Libraries for Official iPhone SDK - iphone

Background
I am writing a program that targets several different phones, including the iPhone. The program depends on several thirdparty libraries. I am having difficulty cross-compiling these thirdparty libraries for the iPhone and iPhone simulator. The libraries include the Apache Portable Runtime and GNUTLS, as well as their dependencies. I would like the built libraries to end up in the prefixes "/opt/iphone-3.1", "/opt/iphone-3.0", "/opt/iphone-2.2.1", "/opt/iphone-simulator-3.1", and "/opt/iphone-simulator-3.0", respectively.
In order to make the cross-compilation process easily repeatable, I am creating scripts to invoke the "configure" script for each of the target platforms ("iphone3.1-configure", "iphone3.0-configure", "iphone2.2.1-configure", "iphonesim3.1-configure", and "iphonesim3.0-configure"). This is where I am having trouble.
I am using a Mac OS X 10.6 Snow Leopard computer with the official Xcode 3.2 + iPhone SDK 3.1.
Status
I currently have the following "iphone3.1-configure" script:
#! /bin/bash
#
# Program : iphone3.1-configure
# Author : Michael Aaron Safyan
# Synopsis :
# This program runs the "configure" script generated by the
# GNU Autotools in order to cross-compile thirdparty libraries
# for the iPhone 3.1 SDK. Run this script while in a directory
# containing an autotools "configure" script. Once run, this
# you can use "make" and "sudo make install" to build the library.
# An install prefix of "/opt/iphone-3.1/" is used.
#
unset CPATH
unset C_INCLUDE_PATH
unset CPLUS_INCLUDE_PATH
unset OBJC_INCLUDE_PATH
unset LIBS
unset DYLD_FALLBACK_LIBRARY_PATH
unset DYLD_FALLBACK_FRAMEWORK_PATH
export BUILD_DARWIN_VER=`uname -r`
export SDKVER="3.1"
export DEVROOT="/Developer/Platforms/iPhoneOS.platform/Developer"
export SDKROOT="$DEVROOT/SDKs/iPhoneOS$SDKVER.sdk"
export PKG_CONFIG_PATH=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$SDKVER.sdk/usr/lib/pkgconfig:/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/pkgconfig:/opt/iphone-$SDKVER/lib/pkgconfig:/usr/local/iphone-$SDKVER/lib/pkgconfig
export PREFIX="/opt/iphone-$SDKVER"
export AS="$DEVROOT/usr/bin/as"
export ASCPP="$DEVROOT/usr/bin/as"
export AR="$DEVROOT/usr/bin/ar"
export RANLIB="$DEVROOT/usr/bin/ranlib"
export CPPFLAGS="-std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='$SDKROOT' -isystem $SDKROOT/usr/include -isystem $DEVROOT/usr/include -isystem /opt/iphone-$SDKVER/include -isystem /usr/local/iphone-$SDKVER/include"
export CFLAGS="-std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='$SDKROOT' -isystem $SDKROOT/usr/include -isystem $DEVROOT/usr/include -isystem /opt/iphone-$SDKVER/include -isystem /usr/local/iphone-$SDKVER/include"
export CXXFLAGS="-std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='$SDKROOT' -isystem $SDKROOT/usr/include -isystem $DEVROOT/usr/include -isystem /opt/iphone-$SDKVER/include -isystem /usr/local/iphone-$SDKVER/include"
export LDFLAGS="-arch armv6 --sysroot='$SDKROOT' -L$SDKROOT/usr/lib -L$DEVROOT/usr/lib -L/opt/iphone-$SDKVER/lib -L/usr/local/iphone-$SDKVER/lib"
export CPP="$DEVROOT/usr/bin/cpp-4.2"
export CC="$DEVROOT/usr/bin/gcc-4.2"
export CXX="$DEVROOT/usr/bin/g++-4.2"
export LD="$DEVROOT/usr/bin/ld"
if [ ! \( -d "$DEVROOT" \) ] ; then
echo "The iPhone SDK could not be found. Folder \"$DEVROOT\" does not exist."
exit 1
fi
if [ ! \( -d "$SDKROOT" \) ] ; then
echo "The iPhone SDK could not be found. Folder \"$SDKROOT\" does not exist."
exit 1
fi
./configure --prefix="$PREFIX" --build="i386-apple-darwin$BUILD_DARWIN_VER" --host="arm-apple-darwin9" --enable-static --disable-shared $#
In the "apr-1.3.8" folder, I am running "iphone3.1-configure --disable-dso", and am getting:
checking build system type... i386-apple-darwin10.0.0
checking host system type... arm-apple-darwin9
checking target system type... arm-apple-darwin9
Configuring APR library
Platform: arm-apple-darwin9
checking for working mkdir -p... yes
APR Version: 1.3.8
checking for chosen layout... apr
checking for arm-apple-darwin9-gcc... /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 accepts -g... yes
checking for /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 option to accept ISO C89... unsupported
Applying APR hints file rules for arm-apple-darwin9
adding "-DDARWIN" to CPPFLAGS
adding "-DSIGPROCMASK_SETS_THREAD_MASK" to CPPFLAGS
setting apr_posixsem_is_global to "yes"
setting ac_cv_func_kqueue to "no"
setting ac_cv_func_poll to "no"
(Default will be unix)
checking whether make sets $(MAKE)... yes
checking how to run the C preprocessor... /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp-4.2
configure: error: in `/Users/michaelsafyan/Downloads/apr-1.3.8':
configure: error: C preprocessor "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp-4.2" fails sanity check
See `config.log' for more details.
The relevant part of "config.log" is:
configure:7710: checking how to run the C preprocessor
configure:7828: result: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp-4.2
configure:7857: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp-4.2 -std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk' -isystem /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/usr/include -isystem /Developer/Platforms/iPhoneOS.platform/Developer/usr/include -isystem /opt/iphone-3.1/include -isystem /usr/local/iphone-3.1/include -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK conftest.c
cpp-4.2: error trying to exec 'cc1': execvp: No such file or directory
configure:7864: $? = 1
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
| #ifdef __STDC__
| # include
| #else
| # include
| #endif
| Syntax error
configure:7857: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp-4.2 -std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk' -isystem /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/usr/include -isystem /Developer/Platforms/iPhoneOS.platform/Developer/usr/include -isystem /opt/iphone-3.1/include -isystem /usr/local/iphone-3.1/include -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK conftest.c
cpp-4.2: error trying to exec 'cc1': execvp: No such file or directory
configure:7864: $? = 1
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
| #ifdef __STDC__
| # include
| #else
| # include
| #endif
| Syntax error
configure:7926: error: in `/Users/michaelsafyan/Downloads/apr-1.3.8':
configure:7929: error: C preprocessor "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp-4.2" fails sanity check
See `config.log' for more details.
Question
How do I fix the "iphone3.1-configure" script? Thanks.

Ok. This still doesn't build, but it gets much further...
The C preprocessor cannot take an architecture.
The C preprocessor does not accept --sysroot or -isystem (just use '-I').
Use "cpp" instead of "cpp-4.2" (the 4.2 version is defective, and since it is the preprocessor, it doesn't matter which version you use, anyway, so you might as well use the one that works.)
The updated version of the iphone3.1-configure script is:
#! /bin/bash
#
# Program : iphone3.1-configure
# Authors : Michael Aaron Safyan (michaelsafyan#gmail.com)
# Synopsis :
# This program runs the "configure" script generated by the
# GNU Autotools in order to cross-compile thirdparty libraries
# for the iPhone 3.1 SDK. Run this script while in a directory
# containing an autotools "configure" script. Once you run this,
# you can use "make" and "sudo make install" to build the library.
# An install prefix of "/opt/iphone-3.1/" is used.
#
unset CPATH
unset C_INCLUDE_PATH
unset CPLUS_INCLUDE_PATH
unset OBJC_INCLUDE_PATH
unset LIBS
unset DYLD_FALLBACK_LIBRARY_PATH
unset DYLD_FALLBACK_FRAMEWORK_PATH
export BUILD_DARWIN_VER=`uname -r`
export SDKVER="3.1"
export DEVROOT="/Developer/Platforms/iPhoneOS.platform/Developer"
export SDKROOT="$DEVROOT/SDKs/iPhoneOS$SDKVER.sdk"
export PKG_CONFIG_PATH=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$SDKVER.sdk/usr/lib/pkgconfig:/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/pkgconfig:/opt/iphone-$SDKVER/lib/pkgconfig:/usr/local/iphone-$SDKVER/lib/pkgconfig
export PREFIX="/opt/iphone-$SDKVER"
export AS="$DEVROOT/usr/bin/as"
export ASCPP="$DEVROOT/usr/bin/as"
export AR="$DEVROOT/usr/bin/ar"
export RANLIB="$DEVROOT/usr/bin/ranlib"
export CPPFLAGS="-pipe -no-cpp-precomp -I$SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.2.1/include/ -I$SDKROOT/usr/include -I$DEVROOT/usr/include -I/opt/iphone-$SDKVER/include -I/usr/local/iphone-$SDKVER/include"
export CFLAGS="-std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='$SDKROOT' -isystem $SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.2.1/include/ -isystem $SDKROOT/usr/include -isystem $DEVROOT/usr/include -isystem /opt/iphone-$SDKVER/include -isystem /usr/local/iphone-$SDKVER/include"
export CXXFLAGS="-std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='$SDKROOT' -isystem $SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.2.1/include/ -isystem $SDKROOT/usr/include -isystem $DEVROOT/usr/include -isystem /opt/iphone-$SDKVER/include -isystem /usr/local/iphone-$SDKVER/include"
export LDFLAGS="-arch armv6 --sysroot='$SDKROOT' -L$SDKROOT/usr/lib -L$DEVROOT/usr/lib -L/opt/iphone-$SDKVER/lib -L/usr/local/iphone-$SDKVER/lib"
export CPP="$DEVROOT/usr/bin/cpp"
export CXXCPP="$DEVROOT/usr/bin/cpp"
export CC="$DEVROOT/usr/bin/gcc-4.2"
export CXX="$DEVROOT/usr/bin/g++-4.2"
export LD="$DEVROOT/usr/bin/ld"
export STRIP="$DEVROOT/usr/bin/strip"
if [ ! \( -d "$DEVROOT" \) ] ; then
echo "The iPhone SDK could not be found. Folder \"$DEVROOT\" does not exist."
exit 1
fi
if [ ! \( -d "$SDKROOT" \) ] ; then
echo "The iPhone SDK could not be found. Folder \"$SDKROOT\" does not exist."
exit 1
fi
./configure --prefix="$PREFIX" --build="i386-apple-darwin$BUILD_DARWIN_VER" --host="arm-apple-darwin9" --enable-static --disable-shared ac_cv_file__dev_zero=no ac_cv_func_setpgrp_void=yes $#
Also, I am invoking with "--enable-threads --disable-dso", not just "--disable-dso". This still doesn't work... it is failing with:
checking for PTHREAD_PROCESS_SHARED in pthread.h... yes
checking for pthread_mutexattr_setpshared... yes
checking for working PROCESS_SHARED locks... configure: error: in `/Users/michaelsafyan/Downloads/apr-1.3.8':
configure: error: cannot run test program while cross compiling
See `config.log' for more details.
However, this may be a problem with APR's specific tests. I am posting a followup question at the link.
Edit
I have provided a more complete solution at Cross-compiling the Apache Portable Runtime for the iPhone.

Thank you for your script. It did help me a lot. Though I had to make few changes so that the architecture of my built lib is arm and not i386.
First, I had to change the compiler:
# export CC="$DEVROOT/usr/bin/gcc-4.2"
export CC="$DEVROOT/usr/bin/arm-apple-darwin10-gcc-4.2.1"
Then I removed the -arch armv6 option, as this compiler doesn't understand it, from CFLAGS, CXXFLAGS, LDFLAGS
Updated the SDKVER and gcc version and it worked!

Related

How to make a Linux Makefile work on Windows?

(Disclaimer: I am not at all a computer science genius, far from that. I may use bad terminology and I appologize.)
I need to run some tests using the google test library and I was provided with a Makefile to handle the execution but it won't run on my Windows machine (I use Visual Studio). It was made for a Linux environment so I'm not sure what i would need to modify in order to run it. I have used MinGW to run Makefiles of my own making in the past.
Here's how the Makefile looks like:
CC=g++
CFLAGS=-c -Wall -ggdb -I.
LDFLAGS=
SOURCES=main.c singlelinklist.c
TESTS=single_test.cpp
#TODO: Need a more elegant way of specifying objects and tests
GTESTDIR=~/environment/googletest
OBJECTS=$(SOURCES:.cpp=.o)
FLAGS = -Iinclude
#all: $(SOURCES) $(EXECUTABLE)
# These next lines do a bit of magic found from http://stackoverflow.com/questions/2394609/makefile-header-dependencies
# Essentially it asks the compiler to read the .cpp files and generate the needed .h dependencies.
# This way if any .h file changes the correct .cpp files will be recompiled
depend: .depend
.depend: $(SOURCES)
rm -f ./.depend
$(CC) $(CFLAGS) -MM $^ >> ./.depend;
include .depend
# End .h file magic
#$(EXECUTABLE): $(OBJECTS)
# $(CC) $(LDFLAGS) $(OBJECTS) -o $#
#.cpp.o:
# $(CC) $(CFLAGS) $< -o $#
clean:
# rm -rf *o $(EXECUTABLE) test_executable
rm -f ./.depend
rm $(GTESTDIR)/libgtest.a
rm $(GTESTDIR)/gtest-all.o
# Google test section
$(GTESTDIR)/libgtest.a:
$(CC) -isystem $(GTESTDIR) -I $(GTESTDIR) -pthread -c $(GTESTDIR)/gtest/gtest-all.cc -o $(GTESTDIR)/gtest-all.o
ar -rv $(GTESTDIR)/libgtest.a $(GTESTDIR)/gtest-all.o
# This will also recompile if any source file is changed.
test_executable: $(GTESTDIR)/libgtest.a $(TESTS) depend
$(CC) -isystem $(GTESTDIR) -pthread -ggdb $(TESTS) $(GTESTDIR)/gtest/gtest_main.cc $(GTESTDIR)/libgtest.a -o test_executable
test: test_executable
./test_executable --gtest_print_time=0
And here's how my workspace is structured.
(Seems like I can't embed pictures).

Can't install ImageMagick on CentOS 7 [magick/magick_libMagickCore_6_Q16_la-distribute-cache.lo]

I am having some issues installing ImageMagick on my CentOS 7 server.
Here is the commands I used:
./configure --without-threads
Everything looks ok.
Option Value
-------------------------------------------------------------------------------
Shared libraries --enable-shared=yesyes
Static libraries --enable-static=yesyes
Module support --with-modules=nono
GNU ld --with-gnu-ld=yesyes
Quantum depth --with-quantum-depth=1616
High Dynamic Range Imagery
--enable-hdri=nono
Install documentation:yes
Delegate Library Configuration:
BZLIB --with-bzlib=yesyes
Autotrace --with-autotrace=nono
DJVU --with-djvu=yesyes
DPS --with-dps=yesno
FFTW --with-fftw=yesno
FlashPIX --with-fpx=yesno
FontConfig --with-fontconfig=yesyes
FreeType --with-freetype=yesyes
Ghostscript lib --with-gslib=nono
Graphviz --with-gvc=no
JBIG --with-jbig=yesno
JPEG v1 --with-jpeg=yesyes
JPEG-2000 --with-jp2=
LCMS v1 --with-lcms=yesno
LCMS v2 --with-lcms2=yesno
LQR --with-lqr=yesno
LTDL --with-ltdl=yesno
LZMA --with-lzma=yesyes
Magick++ --with-magick-plus-plus=yesno (failed tests)
OpenEXR --with-openexr=yesyes
OpenJP2 --with-openjp2=yesno
PANGO --with-pango=yesyes
PERL --with-perl=nono
PNG --with-png=yesyes
RSVG --with-rsvg=nono
TIFF --with-tiff=yesyes
WEBP --with-webp=yesno
WMF --with-wmf=nono
X11 --with-x=yes
XML --with-xml=yesyes
ZLIB --with-zlib=yesyes
Delegate Program Configuration:
GhostPCL Nonepcl6 (unknown)
GhostXPS Nonegxps (unknown)
Ghostscript Nonegs (9.07)
Font Configuration:
Apple fonts --with-apple-font-dir=defaultnone
Dejavu fonts --with-dejavu-font-dir=defaultnone
Ghostscript fonts --with-gs-font-dir=default/usr/share/fonts/default/Type1/
Windows fonts --with-windows-font-dir=defaultnone
X11 Configuration:
X_CFLAGS =
X_PRE_LIBS = -lSM -lICE
X_LIBS =
X_EXTRA_LIBS =
Options used to compile and link:
PREFIX = /usr/local
EXEC-PREFIX = /usr/local
VERSION = 6.9.0
CC = gcc -std=gnu99 -std=gnu99
CFLAGS = -pthread -I/usr/include/OpenEXR -I/usr/include/libdrm -I/usr/include/freetype2 -g -O2 -Wall -march=corei7-avx -fexceptions -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
CPPFLAGS = -pthread -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/libdrm -I/usr/include/freetype2 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libxml2
PCFLAGS =
DEFS = -DHAVE_CONFIG_H
LDFLAGS =
LIBS =
CXX = g++
CXXFLAGS =
FEATURES = DPC
DELEGATES = bzlib djvu mpeg fontconfig freetype jng jpeg lzma openexr pango png ps tiff x xml zlib
Then I do:
make -j16
And I get this:
magick/distribute-cache.c:751:28: warning: 'DistributePixelCacheClient' defined but not used [-Wunused-function]
static HANDLER_RETURN_TYPE DistributePixelCacheClient(void *socket)
^
make[1]: *** [magick/magick_libMagickCore_6_Q16_la-distribute-cache.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from magick/magick.c:72:0:
./magick/semaphore-private.h:36:3: warning: 'semaphore_mutex' defined but not used [-Wunused-variable]
semaphore_mutex = 0;
^
make[1]: Leaving directory `/usr/local/src/ImageMagick-6.9.0-2'
make: *** [all] Error 2
What am I doing wrong? What am I missing?

perl-DBI / perl-DBD-oracle installation

What I want to do is connecting and retrieving data from oracle database through perl.
What i did(as oracle account) is like below.....
$ rpm -qa|grep DBI
perl-DBI-1.52-2.el5
$ wget http://search.cpan.org/CPAN/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.17.tar.gz
$ tar -zxf DBD-Oracle-1.17.tar.gz
$ cd DBD-Oracle-1.17
$ perl Makefile.PL
Using DBI 1.52 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
Configuring DBD::Oracle for perl 5.008008 on linux (x86_64-linux-thread-multi)
Remember to actually *READ* the README file! Especially if you have any problems.
Using Oracle in /sw/oracle/app/oracle/product/102
DEFINE _SQLPLUS_RELEASE = "1002000500" (CHAR)
Oracle version 10.2.0.5 (10.2)
Found /sw/oracle/app/oracle/product/102/rdbms/demo/demo_rdbms.mk
Using /sw/oracle/app/oracle/product/102/rdbms/demo/demo_rdbms.mk
Your LD_LIBRARY_PATH env var is set to '/sw/oracle/app/oracle/product/102/lib:/usr/lib:/sw/oracle/app/oracle/product/102/lib32:.'
Reading /sw/oracle/app/oracle/product/102/rdbms/demo/demo_rdbms.mk
Reading /sw/oracle/app/oracle/product/102/rdbms/lib/env_rdbms.mk
Attempting to discover Oracle OCI build rules
gcc -c -o DBD_ORA_OBJ.o DBD_ORA_OBJ.c
by executing: [make -f /sw/oracle/app/oracle/product/102/rdbms/demo/demo_rdbms.mk build ECHODO=echo ECHO=echo GENCLNTSH='echo genclntsh' CC=true OPTIMIZE= CCFLAGS= EXE=DBD_ORA_EXE OBJS=DBD_ORA_OBJ.o]
Oracle oci build command:
[true -L/sw/oracle/app/oracle/product/102/lib/ -L/sw/oracle/app/oracle/product/102/rdbms/lib/ -o DBD_ORA_EXE DBD_ORA_OBJ.o -lclntsh `cat /sw/oracle/app/oracle/product/102/lib/sysliblist` -ldl -lm -lpthread]
Found header files in /sw/oracle/app/oracle/product/102/rdbms/public.
Checking for functioning wait.ph
Constant subroutine __USE_POSIX undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 8.
Constant subroutine __USE_POSIX2 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 9.
Constant subroutine __USE_POSIX199309 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 10.
Constant subroutine __USE_POSIX199506 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 11.
Constant subroutine __USE_XOPEN undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 12.
Constant subroutine __USE_XOPEN_EXTENDED undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 13.
Constant subroutine __USE_UNIX98 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 14.
Constant subroutine __USE_LARGEFILE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 16.
Constant subroutine __USE_LARGEFILE64 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 17.
Constant subroutine __USE_FILE_OFFSET64 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 18.
Constant subroutine __USE_BSD undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 19.
Constant subroutine __USE_SVID undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 20.
Constant subroutine __USE_MISC undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 21.
Constant subroutine __USE_GNU undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 23.
Constant subroutine __USE_REENTRANT undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 24.
Constant subroutine _POSIX_SOURCE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 49.
Constant subroutine _POSIX_C_SOURCE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 51.
Constant subroutine _XOPEN_SOURCE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 53.
Constant subroutine _XOPEN_SOURCE_EXTENDED undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 55.
Constant subroutine _LARGEFILE64_SOURCE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 57.
Constant subroutine _LARGEFILE_SOURCE undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 104.
Constant subroutine __USE_ISOC99 undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 108.
Constant subroutine __GNU_LIBRARY__ undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/features.ph line 156.
Operator or semicolon missing before &__inline at (eval 167) line 1.
Ambiguous use of & resolved as operator & at (eval 167) line 1.
Constant subroutine __need_size_t undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/stddef.ph line 148.
Scalar found where operator expected at (eval 241) line 1, near "'int' $__val"
(Missing operator before $__val?)
Number found where operator expected at (eval 245) line 1, near ") 0"
(Missing operator before 0?)
Number found where operator expected at (eval 246) line 1, near ") 1"
(Missing operator before 1?)
Number found where operator expected at (eval 247) line 1, near ") 2"
(Missing operator before 2?)
Constant subroutine __need_timespec undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/time.ph line 49.
Hexadecimal number > 0xffffffff non-portable at (eval 447) line 1.
Hexadecimal number > 0xffffffff non-portable at (eval 448) line 1.
Constant subroutine __need_timeval undefined at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/bits/time.ph line 23.
System: perl5.008008 linux builder10.centos.org 2.6.18-53.el5 #1 smp mon nov 12 02:14:55 est 2007 x86_64 x86_64 x86_64 gnulinux
Compiler: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm
Linker: /usr/bin/ld
Sysliblist: -ldl -lm -lpthread -lnsl -lirc
Oracle makefiles would have used these definitions but we override them:
CC: $(COMPDIR)/bin/gcc
CFLAGS: $(GFLAG) $(OPTIMIZE) $(CDEBUG) $(CCFLAGS) $(PFLAGS)\
$(SHARED_CFLAG) $(USRFLAGS)
[$(GFLAG) -O3 $(CDEBUG) -m32 -trigraphs -fPIC -I/sw/oracle/app/oracle/product/102/rdbms/demo -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/plsql/public -I/sw/oracle/app/oracle/product/102/network/public -DLINUX -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -fno-strict-aliasing $(LPFLAGS) $(USRFLAGS)]
LDFLAGS: $(LDFLAGS32)
[-m32 -o $# -L/sw/oracle/app/oracle/product/102/rdbms//lib32/ -L/sw/oracle/app/oracle/product/102/lib32/ -L/sw/oracle/app/oracle/product/102/lib32/stubs/]
Linking with OTHERLDFLAGS = -L/sw/oracle/app/oracle/product/102/lib/ -L/sw/oracle/app/oracle/product/102/rdbms/lib/ -lclntsh `cat /sw/oracle/app/oracle/product/102/lib/sysliblist` -ldl -lm -lpthread [from 'build' rule]
Checking if your kit is complete...
Looks good
LD_RUN_PATH=/sw/oracle/app/oracle/product/102/lib:/sw/oracle/app/oracle/product/102/rdbms/lib
Using DBD::Oracle 1.17.
Using DBD::Oracle 1.17.
Using DBI 1.52 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
Writing Makefile for DBD::Oracle
*** If you have problems...
read all the log printed above, and the README and README.help.txt files.
(Of course, you have read README by now anyway, haven't you?)
$ make
cp Oracle.pm blib/lib/DBD/Oracle.pm
cp oraperl.ph blib/lib/oraperl.ph
cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h
cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h
cp Oraperl.pm blib/lib/Oraperl.pm
cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h
cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm
cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm
/usr/bin/perl -p -e "s/~DRIVER~/Oracle/g" /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/Driver.xst > Oracle.xsi
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap -typemap typemap Oracle.xs > Oracle.xsc && mv Oracle.xsc Oracle.c
gcc -c -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/rdbms/demo -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/plsql/public -I/sw/oracle/app/oracle/product/102/network/public -I/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"1.17\" -DXS_VERSION=\"1.17\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DNEW_OCI_INIT -DORA_OCI_VERSION=\"10.2.0.5\" Oracle.c
Oracle.c: In function 'XS_DBD__Oracle__db_ora_lob_append':
Oracle.xs:201: warning: unused variable 'startp'
gcc -c -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/rdbms/demo -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/plsql/public -I/sw/oracle/app/oracle/product/102/network/public -I/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"1.17\" -DXS_VERSION=\"1.17\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DNEW_OCI_INIT -DORA_OCI_VERSION=\"10.2.0.5\" dbdimp.c
dbdimp.c: In function 'ora_db_login6':
dbdimp.c:652: warning: value computed is not used
dbdimp.c: In function 'dbd_rebind_ph_char':
dbdimp.c:1052: warning: value computed is not used
gcc -c -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/rdbms/demo -I/sw/oracle/app/oracle/product/102/rdbms/public -I/sw/oracle/app/oracle/product/102/plsql/public -I/sw/oracle/app/oracle/product/102/network/public -I/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"1.17\" -DXS_VERSION=\"1.17\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DNEW_OCI_INIT -DORA_OCI_VERSION=\"10.2.0.5\" oci8.c
oci8.c: In function 'fetch_func_rset':
oci8.c:626: warning: value computed is not used
oci8.c: In function 'dbd_rebind_ph_lob':
oci8.c:711: warning: value computed is not used
oci8.c: In function 'ora_blob_read_mb_piece':
oci8.c:778: warning: comparison is always false due to limited range of data type
oci8.c: In function 'ora_describe':
oci8.c:1267: warning: comparison is always false due to limited range of data type
oci8.c: In function 'post_execute_lobs':
oci8.c:2118: warning: value computed is not used
oci8.c: At top level:
oci8.c:563: warning: 'fetch_func_nty' defined but not used
Running Mkbootstrap for DBD::Oracle ()
chmod 644 Oracle.bs
rm -f blib/arch/auto/DBD/Oracle/Oracle.so
gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic Oracle.o dbdimp.o oci8.o -L/sw/oracle/app/oracle/product/102/lib/ -L/sw/oracle/app/oracle/product/102/rdbms/lib/ -lclntsh `cat /sw/oracle/app/oracle/product/102/lib/sysliblist` -ldl -lm -lpthread -o blib/arch/auto/DBD/Oracle/Oracle.so \
\
chmod 755 blib/arch/auto/DBD/Oracle/Oracle.so
cp Oracle.bs blib/arch/auto/DBD/Oracle/Oracle.bs
chmod 644 blib/arch/auto/DBD/Oracle/Oracle.bs
/usr/bin/perl "-Iblib/arch" "-Iblib/lib" ora_explain.PL ora_explain
Extracted ora_explain from ora_explain.PL with variable substitutions.
cp ora_explain blib/script/ora_explain
/usr/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/ora_explain
Manifying blib/man1/ora_explain.1
Manifying blib/man3/DBD::Oracle.3pm
Manifying blib/man3/DBD::Oraperl.3pm
$ make install
Warning: You do not have permissions to install into /usr/share/man/man1 at /usr/lib/perl5/5.8.8/ExtUtils/Install.pm line 114.
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
$ sudo - chmod 777 /usr/share/man
Warning: You do not have permissions to install into /usr/bin at /usr/lib/perl5/5.8.8/ExtUtils/Install.pm line 114.
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
$ sudo - chmod 777 /usr/bin
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
$ perl -e 'use DBD::Oracle'
install_driver(Oracle) failed: Can't load '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: /sw/oracle/app/oracle/product/102/lib/libnnz10.so: cannot restore segment prot after reloc: Permission denied at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230.
at (eval 3) line 3
Compilation failed in require at (eval 3) line 3.
Perhaps a required shared library or dll isn't installed where expected
at ./ora_dump.pl line 7
I've checked permission of /sw/oracle/app/oracle/product/102/lib/libnnz10.so.
My machine is on CentOS release 5.5 and 10g Enterprise Edition Release 10.2.0.5.0...
What am I missing?
Sounds like an issue with SELinux. Try disabling it and see if this resolves your problem:
http://www.crypt.gen.nz/selinux/disable_selinux.html
I do not know what you are missing and where you are going wrong. But I always follow below method and it has worked 100% times for me. Try this method and if it does not work, then I can definitely make it work for you....
One thing I notice in your post is that you are getting permissions issues. Try running these steps as root.
My environment: Oracle 11G running on remote box
My desktop: ubunt/fedora/RHEL/CenOS
I have implemented this on all above 4 flavors of Linux and they all work perfectly.
Here are the steps (Follow 'em the sequence given):
Install Perl DBI module
install below 3 rpm for oracle instant client from http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
oracle-instantclient11.2-basic-11.2.0.3.0-1
oracle-instantclient11.2-devel-11.2.0.3.0-1
oracle-instantclient11.2-sqlplus-11.2.0.3.0-1
I am using 64 bit linux box, so choose your RPM accordingly.
set below variables:
LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
ORACLE_HOME=/usr/lib/oracle/11.2/client64
also add ORACLE_HOME to your PATH variable
download DBD::Oracle ver 1.44 from CPAN.
untar the module and run below commands in given sequence:
perl Makefile.PL
make make
install
DONE !!!

OpenSSL build script fails when run as a 'run script' phase within Xcode (succeeds outside of Xcode)

I'm attempting to run a script to build OpenSSL for iOS (armv6, armv7 and i386) as a 'run script' phase in Xcode.
The script builds successfully when run from the command line as a stand alone script. The result is a compiled libcrypto.a, libssl.a and include directory with the headers.
However, when I run the script as a run script phase in Xcode, it gets towards the end of make and errors out stating that it couldn't find any symbols referenced from libcrypto.
shlib_target=; if [ -n "" ]; then \
shlib_target="bsd-gcc-shared"; \
fi; \
LIBRARIES="-L.. -lssl -L.. -lcrypto" ; \
make -f ../Makefile.shared -e \
APPNAME=openssl OBJECTS="openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o" \
LIBDEPS=" $LIBRARIES " \
link_app.${shlib_target}
( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto }"; LDCMD="${LDCMD:-/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386}"; LDFLAGS="${LDFLAGS:--isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall}"; LIBPATH=`for x in $LIBDEPS; do echo $x; done | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo $LIBPATH | sed -e 's/ /:/g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o ${APPNAME:=openssl} openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o ${LIBDEPS} )
Undefined symbols for architecture i386:
"_ENGINE_load_gost", referenced from:
_ENGINE_load_builtin_engines in libcrypto.a(eng_all.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make[2]: *** [link_app.] Error 1
make[1]: *** [openssl] Error 2
make: *** [build_apps] Error 1
I'm almost certain that this is a paths issue, but I can't figure out how to tell Xcode (or the script) which paths to use.
The script, available here, needed to be modified to account for the recent changes to the location of the developer tools with Xcode 4.3 (namely the fact that Developer/ is no longer at the root, but actually inside Xcode.app).
Here's the script for question completeness:
#!/bin/sh
# Automatic build script for libssl and libcrypto
# for iPhoneOS and iPhoneSimulator
#
# Created by Felix Schulze on 16.12.10.
# Copyright 2010 Felix Schulze. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###########################################################################
# Change values here #
# #
VERSION="1.0.0c" #
SDKVERSION="5.0" #
# #
###########################################################################
# #
# Don't change anything under this line! #
# #
###########################################################################
CURRENTPATH=`pwd`
CURRENTPATH="${CURRENTPATH}/openssl"
set -e
if [ ! -e openssl-${VERSION}.tar.gz ]; then
echo "Downloading openssl-${VERSION}.tar.gz"
curl -O http://www.openssl.org/source/openssl-${VERSION}.tar.gz
else
echo "Using openssl-${VERSION}.tar.gz"
fi
mkdir -p "${CURRENTPATH}/src"
tar zxf openssl-${VERSION}.tar.gz -C "${CURRENTPATH}/src"
rm openssl-${VERSION}.tar.gz
cd "${CURRENTPATH}/src/openssl-${VERSION}"
############
# iPhone Simulator
echo "Building openssl for iPhoneSimulator ${SDKVERSION} i386"
echo "Please stand by..."
export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386"
mkdir -p "${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk"
LOG="${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/build-openssl-${VERSION}.log"
./configure BSD-generic32 --openssldir="${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk" > "${LOG}" 2>&1
# add -isysroot to CC=
sed -ie "s!^CFLAG=!CFLAG=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDKVERSION}.sdk !" "Makefile"
make >> "${LOG}" 2>&1
make install >> "${LOG}" 2>&1
make clean >> "${LOG}" 2>&1
#############
#############
# iPhoneOS armv6
echo "Building openssl for iPhoneOS ${SDKVERSION} armv6"
echo "Please stand by..."
export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv6"
mkdir -p "${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk"
LOG="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk/build-openssl-${VERSION}.log"
./configure BSD-generic32 --openssldir="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk" > "${LOG}" 2>&1
sed -ie "s!^CFLAG=!CFLAG=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVERSION}.sdk !" "Makefile"
# remove sig_atomic for iPhoneOS
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
make >> "${LOG}" 2>&1
make install >> "${LOG}" 2>&1
make clean >> "${LOG}" 2>&1
#############
#############
# iPhoneOS armv7
echo "Building openssl for iPhoneOS ${SDKVERSION} armv7"
echo "Please stand by..."
export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7"
mkdir -p "${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk"
LOG="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/build-openssl-${VERSION}.log"
./configure BSD-generic32 --openssldir="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk" >> "${LOG}" 2>&1
sed -ie "s!^CFLAG=!CFLAG=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVERSION}.sdk !" "Makefile"
# remove sig_atomic for iPhoneOS
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
make >> "${LOG}" 2>&1
make install >> "${LOG}" 2>&1
make clean >> "${LOG}" 2>&1
#############
echo "Build library..."
lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libssl.a -output ${CURRENTPATH}/libssl.a
lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libcrypto.a -output ${CURRENTPATH}/libcrypto.a
mkdir -p ${CURRENTPATH}/include
cp -R ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/include/openssl ${CURRENTPATH}/include/
echo "Building done."
Even though this is an older post, I think the problem still persist. But I think I found a very simple solution. Just add the following line to the Build-Script, before "Configure" or "make" is called:
export COMMAND_MODE=unix2003
This should do the trick.
It's been logged as an issue on openssl.
Adjust your configure line:
./Configure darwin64-x86_64-cc zlib no-asm no-krb5 shared

SCons: GCC Ignoring -c

I'm using a MinGW-based GCC cross-compiler to compile a project which uses SCons as its build system.
The Python is a native 2.6.2 version, not specifically compiled for MinGW (or Cygwin).
However, I am running into a problem with the build:
F:/pedigree/compilers/bin/i686-elf-gcc -o build\src\user\applications\apptest\ma
in.obj -c -std=gnu99 -march=i486 -fno-builtin -m32 -g0 -O3 -Wno-long-long -Wnest
ed-externs -Wall -Wextra -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-long-
long -Wno-variadic-macros -Wno-unused -Wno-unused-variable -Wno-conversion -Wno-
format -Wno-empty-body -fno-stack-protector -DTHREADS -DDEBUGGER -DDEBUGGER_QWER
TY -DSERIAL_IS_FILE -DECHO_CONSOLE_TO_SERIAL -DKERNEL_NEEDS_ADDRESS_SPACE_SWITCH
-DADDITIONAL_CHECKS -DBITS_32 -DKERNEL_STANDALONE -DVERBOSE_LINKER -DX86 -DX86_
COMMON -DLITTLE_ENDIAN -D__UD_STANDALONE__ -DINSTALLER -Isrc\subsys\posix\includ
e -Ibuild\src\user\applications\apptest -Isrc\user\applications\apptest src\user
\applications\apptest\main.c
f:/pedigree/compilers/bin/../lib/gcc/i686-elf/4.4.1/../../../../i686-elf/bin/ld.
exe: crt0.o: No such file: No such file or directory
If I add -c to the CFLAGS, I get a compiled object called "main.obj -c" (there's a space between obj and -c there).
Does anyone have any idea what's happening? Is there anything I can do to solve this?
The project uses the POSIX platform to enforce progarm and object file extensions, however the POSIX platform in SCons defines a function "escape":
def escape(arg):
"escape shell special characters"
slash = '\\'
special = '"$()'
arg = string.replace(arg, slash, slash+slash)
for c in special:
arg = string.replace(arg, c, slash+c)
return '"' + arg + '"'
When it escapes the backslashes, it wreaks havoc in the Windows environment. Changing to a neutral platform, and specifying the extensions explicitly, fixes the problem.