Build error: missingLinuxMain - swift

I have a bug when I try to build a swift package on linux :
> swift build -v
lsb_release -r
which clang
/opt/swift/usr/bin/swiftc --driver-mode=swift -L /opt/swift/usr/lib/swift/pm/4 -lPackageDescription -swift-version 4 -I /opt/swift/usr/lib/swift/pm/4 -sdk / /home/me/SwiftProject/Package.swift -fileno 5
/opt/swift/usr/bin/swiftc --driver-mode=swift -L /opt/swift/usr/lib/swift/pm/3 -lPackageDescription -swift-version 3 -I /opt/swift/usr/lib/swift/pm/3 -sdk / /home/me/SwiftProject/.build/checkouts/siesta-3156441904511450749/Package.swift -fileno 5
/opt/swift/usr/bin/swiftc --driver-mode=swift -L /opt/swift/usr/lib/swift/pm/3 -lPackageDescription -swift-version 3 -I /opt/swift/usr/lib/swift/pm/3 -sdk / /home/me/SwiftProject/.build/checkouts/SwiftyJSON-6376406316629445150/Package.swift -fileno 5
error: missingLinuxMain
I have no error when I run the last command:
/opt/swift/usr/bin/swiftc --driver-mode=swift -L /opt/swift/usr/lib/swift/pm/3 -lPackageDescription -swift-version 3 -I /opt/swift/usr/lib/swift/pm/3 -sdk / /home/me/SwiftProject/.build/checkouts/SwiftyJSON-6376406316629445150/Package.swift -fileno 5
I have a file LinuxMain.swift in the Test directory:
Tests
├── ProjectTests
│   ├── SomeTests.swift
└── LinuxMain.swift
LinuxMain.swift:
import XCTest
#testable import ProjectTests
XCTMain([
testCase(SomeTests.allTests),
])
I use swift 4.0 on ubuntu 17.04

SwiftPM uses a file named LinuxMain.swift (located in the root directory of your test targets, usually Tests/LinuxMain.swift) to find the unit tests on Linux. (On Apple platforms it uses the Objective-C runtime for this, but that's not available on Linux.)
It looks like your build fails because SwiftPM can't find the file.
If you haven't got a LinuxMain.swift file, you should create one. The easiest way to see how it should be formatted is probably to run swift package init in an empty directory and check out the expected directory and file structure.
The file should look something like this, but adapted for your package (I copied this one from here):
import XCTest
#testable import MarathonTests
XCTMain([
testCase(MarathonTests.allTests)
])
Each of your XCTestCase subclasses also needs an allTests property. Again, the default directory structure should give you an idea how it should look.
You might also find this article I wrote a few months ago interesting.

Related

System.DllNotFoundException in pocketsphinx swig Unity windows build

Goal:
Obtain a wrapper dll to use pocketsphinx in a Unity project in Windows.
Problem:
When running the test program, I get an annoying System.DllNotFoundException even though the .so file is in the same directory as the mono program.
Setup and attempted actions:
For starters, I am using Cygwin. I was able to build absolutely everything, sphinxbase and pocketsphinx no problem. Then I went into the swig/csharp directory and attempted make. It does make, a .so file is created. I am using the default Makefile and make in cygwin. Rules 1-3 run perfectly fine, building, linking and everything. So does the pocketsphinx_continuous test.
pocketsphinx.c: ../pocketsphinx.i
mkdir -p gen
swig -I.. -I../../../sphinxbase/swig -I../include -I../../sphinxbase/include \
-csharp \
-dllimport "libpocketsphinxwrap.so" \
-namespace "Pocketsphinx" -o sphinxbase.c \
-outdir gen ../../../sphinxbase/swig/sphinxbase.i
swig -I.. -I../../../sphinxbase/swig -I../include -I../../sphinxbase/include \
-csharp \
-dllimport "libpocketsphinxwrap.so" \
-namespace "Pocketsphinx" -o pocketsphinx.c \
-outdir gen ../pocketsphinx.i
libpocketsphinxwrap.so: pocketsphinx.c
gcc -fPIC pocketsphinx.c sphinxbase.c `pkg-config --libs --cflags pocketsphinx` -shared -o $#
test.exe: libpocketsphinxwrap.so
mcs test.cs gen/*.cs
run: test.exe
MONO_LOG_LEVEL=debug mono test.exe
clean:
rm -rf gen
rm -f libpocketsphinxwrap.so
rm -f pocketsphinx.c
rm -f sphinxbase.c
rm -f test.exe
.PHONY: run clean
When attempting mono test.exe - the following happens:
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'Pocketsphinx.PocketSphinxPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: libpocketsphinxwrap.so
The .so is in the same directory as the test.exe file and is certainly being looked at because when running mono with MONO_LOG_LEVEL=debug, the output is:
Mono: DllImport error loading library 'C:\Users\fgera\Development\Tools\CMUSphinx\pocketsphinx\swig\csharp\libpocketsphinxwrap.so.dll': 'The system cannot find the file specified.
Many times over and over.
Any help will be greatly appreciated. Again, I need a libpocketsphinx.so x86_64 for windows in Unity to interop with the C# files.
Thanks.
--- edit - added relevant snippet. test.cs just calls this method from the wrapper data structure. These files were all generated by SWIG.
[global::System.Runtime.InteropServices.DllImport("libpocketsphinxwrap.so", EntryPoint="CSharp_Pocketsphinx_Decoder_GetConfig")]
public static extern global::System.IntPtr Decoder_GetConfig(global::System.Runtime.InteropServices.HandleRef jarg1);
I doubt Cygwin DLL is compatible with Mono/Unity. You need to create DLL in Visual Studio, then it will work.
Why do you test the so file with mono, while it is actually used in Unity?
Mono: DllImport error loading library 'C:\Users\fgera\Development\Tools\CMUSphinx\pocketsphinx\swig\csharp\libpocketsphinxwrap.so.dll': 'The system cannot find the file specified.
If file libpocketsphinxwrap.so does exist in C:\Users\fgera\Development\Tools\CMUSphinx\pocketsphinx\swig\csharp\, try rename libpocketsphinxwrap.so to libpocketsphinxwrap.so.dll so mono can find it.
See also mono pinvoke: library names and DllNotfoundException.
You can try build pocketsphinx with Visual Studio since it is offically supported.
BTW, I'd rather write the C# wrapper myself instead of using SWIG since there are many traps in P/Invoke and I don't think SWIG can handle all of them.

Compiling Freetype 2.6.5 Xcode for IOS

Alright guys, I posted a similar question and took it down because it wasn't specific enough so here I go. From the zip file of Freetype 2.6.5 I have not been able to create an Xcode project that will compile the library for iOS use, only for i386_64.
I tried the commands here but I don't get past the first commands the and I am getting this
FreeType build system -- automatic system detection
The following settings are used:
platform unix compiler cc
configuration directory ./builds/unix configuration rules
./builds/unix/unix.mk
If this does not correspond to your system or settings please remove
the file `config.mk' from this directory then read the INSTALL file
for help.
Otherwise, simply type
/Applications/Xcode.app/Contents/Developer/usr/bin/make' again to
build the library, or
/Applications/Xcode.app/Contents/Developer/usr/bin/make refdoc' to
build the API reference (this needs python >= 2.6).
cd builds/unix; \
./configure 'CFLAGS=-arch i386' /bin/sh: ./configure: No such file or directory make: *** [setup] Error 127
I also followed the instructions inside the cmakelists.txt that it comes inside the project but still nothing, I still get an xcode project for osx and not for IOS which is giving me a plethora of linking errors. Here is the instructions for your reference.
For an iOS static library, use
#
cmake -D IOS_PLATFORM=OS -G Xcode
#
or
#
cmake -D IOS_PLATFORM=SIMULATOR -G Xcode
I am not sure what else to do. Any help?
Here's an outline of the basic build process to compile the FreeType libaries for iOS:
Download the latest FreeType source code
Extract the archive and cd into the unarchived directory
Setup toolchain and export variables for the architectures desired (arm64, arm7, i386, x86_64)
Compile the source code and build the libraries
For example, the build commands for arm64 might look something like this:
$ export CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
$ iphoneos="7.0" # target version of iOS
$ ARCH="arm64" # architecture (arm64, arm7, i386, x86_64)
$ export CFLAGS="-arch ${ARCH} -pipe -mdynamic-no-pic -Wno-trigraphs -fpascal-strings \
-O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden \
-miphoneos-version-min=$iphoneos -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
$ export AR="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar"
$ export LDFLAGS="-arch ${ARCH} -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
-miphoneos-version-min=7.0"
$ ./configure --host="aarch64-apple-darwin" --enable-static=yes --enable-shared=no
$ make
$ clean
It's a bit of work to construct the commands for each arch, but
fortunately there's a build
script
— which automatically downloads, extracts, and builds the latest FreeType (2.6.5 currently).
To run the script just use the following command in Terminal:
./build_freetype.sh
The resulting iOS libraries can be found in ~/Desktop/FreeType_iOS_Release when it completes.

command-line library build fails with linker error

I am getting a library not found error building GraphViz current release (June 7 2012) with Xcode 4.3 using a script. I may have made mistakes updating build scripts from other people's successful recipes for the new location of Xcode4.3 and the developer tools in the Applications folder.
ld: library not found for -lcrt1.10.6.o
(doing this from memory so exact number on the CRT lib may be wrong)
Am also a little lost also how I would incorporate this into an Xcode build in the IDE. I am a very experienced programmer but having trouble finding my way around Xcode 4 at times. (Decades of Visual Studio et al).
I have copied the instructions from this earlier question and adapted
#!/bin/sh
# For iPhoneOS, see http://clang.llvm.org/ for options
export DEV_iOS=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
# was /Developer/Platforms/iPhoneOS.platform/Developer
export SDK_iOS=${DEV_iOS}/SDKs/iPhoneOS5.1.sdk
export COMPILER_iOS=${DEV_iOS}/usr/bin
export CC=${COMPILER_iOS}/clang
export CXX=${COMPILER_iOS}/clang++
export LDFLAGS="-arch armv7 -pipe -Os -gdwarf-2 -mthumb -isysroot ${SDK_iOS}"
export CFLAGS="${LDFLAGS}"
export OBJCFLAGS="${LDFLAGS}"
export CXXFLAGS="${LDFLAGS} -fvisibility-inlines-hidden"
export LD=${COMPILER_iOS}/ld
export CPP=${COMPILER_iOS}/clang
export AR=${COMPILER_iOS}/ar
export AS=${COMPILER_iOS}/as
export NM=${COMPILER_iOS}/nm
export CXXCPP="${COMPILER_iOS}/clang++"
export OBJC=${COMPILER_iOS}/clang
export RANLIB=${COMPILER_iOS}/ranlib
./configure \
--build=arm-apple-darwin11 \
--host=arm-apple-darwin11 \
--disable-dependency-tracking \
--enable-shared=no \
--enable-static=yes \
--enable-ltdl=no \
--enable-swig=no \
--enable-tcl=no \
--srcdir=${GVROOT} \
--with-codegens=no \
--with-cgraph=no \
--with-graph=yes \
--with-expat=no \
--with-fontconfig=no \
--with-freetype2=no \
--with-ipsepcola=yes \
--with-libgd=no \
--with-quartz=yes \
--with-visio=yes \
--with-x=no
The compiler normally uses crt1.o combined with crt[i/n].o and crt[begin/end].o to support the constructors and destructors (functions called before and after main and exit).
This error could be caused by this missing library file for the specific deployment target.
First, do some investigation, like:
list all your deployment targets:
ls -la /Developer/SDKs
and find which crt1 libraries do you have for which environment
find /Developer/SDKs -name crt1\*
You could see something like:
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/crt1.10.5.o
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/crt1.o
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/crt1.10.5.o
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/crt1.10.6.o
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/crt1.o
So as you can see, crt1.10.6.o is missing for MacOSX10.5.
Solution 1:
You can solve that by creating the link to the missing file pointed to the other environment, or you could change your deployment target.
E.g.
ln -s /Developer/SDKs/MacOSX10.6.sdk/usr/lib/crt1.10.6.o /Developer/SDKs/MacOSX10.5.sdk/usr/lib/
Also this could be caused, that you have different gcc installed in your system. See:
which gcc;
xcrun -find gcc;
brew list | grep gcc; brew list gcc47
Solution 2
So when you're compiling using make, you can actually specify the right compiler by CC variable. E.g.
CC=/path/to/gcc-3.4 make
Solution 3
What you can also try is specifying the right target deployment environment variable for gcc, by executing the following lines:
export MACOSX_DEPLOYMENT_TARGET=10.5
export C_INCLUDE_PATH=/Developer/SDKs/MacOSX10.5.sdk/usr/include
export LIBRARY_PATH=/Developer/SDKs/MacOSX10.5.sdk/usr/lib
If this works, then you can add above lines to your shell profile (~/.profile) to make the change permanent.
How to test
Create the example conftest.c file with the following code:
#ifdef __GNUC__
yes;
#endif
And try to compile it via:
gcc conftest.c
cc conftest.c
cc conftest.cc conftest.c
Troubleshooting
To see which exactly what file is missing, try to debug it using dtruss, e.g.:
sudo dtruss -f gcc conftest.c 2>/dev/stdout | grep crt
You should see something like:
12426/0xb4e3b: stat64("/Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/crt1.10.6.o\0", 0x7FFF5FBFE780, 0xB) = -1 Err#2
So once you found the missing file, then you can follow by the first solution by linking the missing file from existing location (e.g. locate crt1.10.6.o). If you will have other missing symbols, then try another file (check the architecture before by: file `locate crt1.10.6.o`).
E.g.
sudo ln -s /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/crt1.10.6.o /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/crt1.10.6.o
sudo ln -s /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/crt1.10.6.o /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64/crt1.10.6.o
Related
Error in xcode project: ld: library not found for -lcrt1.10.6.o
If I remember correctly this is what fixed the library not found problem.
CFLAGS="$(OTHER_CFLAGS) -miphoneos-version-min=5.0"
LDFLAGS="$(OTHER_LDFLAGS) --miphoneos-version-min=5.0"
To link this to Xcode, under Build Settings then Header and Library search paths you need to add the paths to the built versions of the library and the header.
You can add the build script as part of your Xcode project, but I haven't had success with this, plus you should only need to build it once per version, so putting the time into anything other than a build script doesn't have much return.
If you decide to put the script in your project anyway (good luck!), then go to the build phases tab, add a build phase of type "Run Script" and paste your script there.

Creating a framework for iOS in XCode 4.2

I am trying to create a framework in XCode 4.2 for iOS applications.
I was developing my own Game framework. I was usually distributing only in source codes and resources but, due to using ARC in my framework, I had to distribute in static library and framework.
I haven't decided which shall I use yet.
Although developing framework for iOS is not a supported way, It's better that distributing resources and headers and Mach-O file in one directory(same as framework).
So I want to use framework to distribute my Game framework.
I used this script to create a Framework.
It seems that I have success creating a framework and copy mach-O and headers and resources.
But this framework's resources couldn't be added to the application which I added this framework.
#!/bin/bash
set -o errexit
set -o nounset
# Environment Variables
PANKIA_DIR="${SRCROOT}/Pankia"
PANKIA_CORE_DIR="${PANKIA_DIR}/Core"
PANKIA_PLATFORM_DIR="${PANKIA_DIR}/Platform"
FRAMEWORK_NAME="Pankia"
FRAMEWORK_VERSION=A
FRAMEWORK_VERSION_NUMBER=1.0
FRAMEWORK_BUILD_PATH="${SRCROOT}/build/${CONFIGURATION}-framework"
FRAMEWORK_DIR="${FRAMEWORK_BUILD_PATH}/${FRAMEWORK_NAME}.framework"
FRAMEWORK_PACKAGE_NAME="${FRAMEWORK_NAME}.${FRAMEWORK_VERSION_NUMBER}.zip"
FRAMEWORK_TARGET_NAME="libPankia"
# Clean directories
rm -rf "${FRAMEWORK_BUILD_PATH}"
# Build simulator and device binaries.
xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphonesimulator${IPHONEOS_DEPLOYMENT_TARGET} -target ${FRAMEWORK_TARGET_NAME} -configuration ${CONFIGURATION} clean build
xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphoneos${IPHONEOS_DEPLOYMENT_TARGET} -target ${FRAMEWORK_TARGET_NAME} -configuration ${CONFIGURATION} clean build
# create framework directories.
mkdir -p ${FRAMEWORK_DIR}
mkdir -p ${FRAMEWORK_DIR}/Versions
mkdir -p ${FRAMEWORK_DIR}/Versions/${FRAMEWORK_VERSION}
mkdir -p ${FRAMEWORK_DIR}/Versions/${FRAMEWORK_VERSION}/Resources
mkdir -p ${FRAMEWORK_DIR}/Versions/${FRAMEWORK_VERSION}/Headers
# create symlinks
ln -s ${FRAMEWORK_DIR}/Versions/${FRAMEWORK_VERSION} ${FRAMEWORK_DIR}/Versions/Current
ln -s ${FRAMEWORK_DIR}/Versions/Current/Headers ${FRAMEWORK_DIR}/Headers
ln -s ${FRAMEWORK_DIR}/Versions/Current/Resources ${FRAMEWORK_DIR}/Resources
ln -s ${FRAMEWORK_DIR}/Versions/Current/${FRAMEWORK_NAME} ${FRAMEWORK_DIR}/${FRAMEWORK_NAME}
# create the universal library
lipo ${SRCROOT}/build/${CONFIGURATION}-iphoneos/lib${FRAMEWORK_TARGET_NAME}.a ${SRCROOT}/build/${CONFIGURATION}-iphonesimulator/lib${FRAMEWORK_TARGET_NAME}.a -create -output "${FRAMEWORK_DIR}/Versions/Current/${FRAMEWORK_NAME}"
# copy files
cp ${PANKIA_PLATFORM_DIR}/GameInterface/Pankia.h ${FRAMEWORK_DIR}/Headers/
cp ${PANKIA_PLATFORM_DIR}/Models/Native/*.h ${FRAMEWORK_DIR}/Headers/
cp ${PANKIA_CORE_DIR}/Models/Native/*.h ${FRAMEWORK_DIR}/Headers/
cp -r ${PANKIA_PLATFORM_DIR}/Resources ${FRAMEWORK_DIR}/Resources/
cp -r ${PANKIA_PLATFORM_DIR}/RetinaResources ${FRAMEWORK_DIR}/Resources/
cp ${SRCROOT}/libPankia/Info.plist ${FRAMEWORK_DIR}/Resources/
# cp ${SRCROOT}/build/${CONFIGURATION}-iphoneos/usr/local/include/*.h ${FRAMEWORK_DIR}/Headers/
# cp Info.plist ${FRAMEWORK_DIR}/Resources
# zip (配布用に TestFramework.framework ディレクトリをZIP圧縮するだけなので、配布しないなら以下はコメントアウトしてもよい)
# cd ${FRAMEWORK_BUILD_PATH}
# zip -ry ${FRAMEWORK_PACKAGE_NAME} $(basename $FRAMEWORK_DIR)
Do you know why?
And is there any better way to distribute my framework?
Here is a helpful tutorial on creating frameworks. I have used it and have been able to package resources with the framework.
http://codefriend.blogspot.com/2011/09/creating-ios-framework-with-xcode4.html

How do you install perl DBD::Oracle on OSX Snow Leopard 10.6

I'm trying to connect to Oracle 10.2.0.4 on a remote system from my intel mac running OSX 10.6 snow leopard. I've tried using perl CPAN to install DBD::Oracle (DBI worked ok) but get compilation errors. Could someone provide an easy to follow guide?
Getting a mac install of perl to play nicely with oracle is a bit of a pain - once it's running it is fantastic, getting it running is a little frustrating..
The below has worked for me on a few different intel macs, there could well be superfluous steps in there and it is likely not going to be the same for other platforms.
This will require use of shell, the root user and a bit of CPANing - nothing too onerous
First off create a directory for the oracle pap - libraries, instant client etc
sudo mkdir /usr/oracle_instantClient64
Download and extract all 64 bit instant client packages from oracle to the above directory
Create a symlink within that directory for one of the files in there
sudo cd /usr/oracle_instantClient64
sudo ln -s /usr/oracle_instantClient64/libclntsh.dylib.10.1 libclntsh.dylib
The following dir is hardcoded into the oracle instant client - god knows why - so need to create and symlink it
sudo mkdir -p /b/227/rdbms/
sudo cd /b/227/rdbms/
sudo ln -s /usr/oracle_instantClient64/ lib
Need to add a couple of environment variables, so edit /etc/profile and add them so they exist for all users:
export ORACLE_HOME=/usr/oracle_instantClient64
export DYLD_LIBRARY_PATH=/usr/oracle_instantClient64
Now try and install DBD::Oracle through CPAN - this will fail, but it means any dependencies will be downloaded and it retrieves the module for us
sudo perl -MCPAN -e shell
install DBD::Oracle
When this fails exit CPAN and head to your .cpan/build dir - if you used automatic config of CPAN it'll be
cd ~/.cpan/build
if you didn't auto configure you can find your build directory with the following command in CPAN
o conf build_dir
Once in the build dir look for the DBD::Oracle dir which has just been created (it'll be called something like DBD-Oracle-1.28-?) and cd into it.
Now we need to switch to the root user. Root isn't enabled as default in osx - for details on enabling see this post on the apple website
Once logged in as root we need to set the above environment variables for root:
export ORACLE_HOME=/usr/oracle_instantClient64
export DYLD_LIBRARY_PATH=/usr/oracle_instantClient64
Now while still logged in as root we need to run the makefile for the module, then make, then install
perl Makefile.pl
make
make install
Assuming that all worked without error log out of root: we're DBD'd up! If this didn't work it's time to bust out google on whatever errors you're seeing
Now just to install the DBI module
sudo perl -MCPAN -e shell
install DBI
Now you're all set - enjoy your perly oracley new life
Additional info from user852637:
Correction to this step
perl Makefile.pl
make
install
The last step should be make install
During make, you may encounter an error that looks like :
lipo: can't open input file: /var/tmp//ccIevTzM.out (No such file or directory)
To correct this you must edit the file "Makefile" created after the "perl Makefile.pl" step and remove all occurrences of the following text :
-arch ppc
This will eliminate the error.
The same error described in (2.) will occur during the installation of the DBI module. You must edit the Makefile created after the perl Makefile.pl step and remove all occurrences of the following text :
-arch ppc
It looks with the XCode4 change (removal of PPC arch support) the Perl installation was not updated in any of the 10.6.X updates to also remove PPC binaries (probably because Rosetta is still present).
Because of this, the configuration files retain "-arch ppc" causing all CPAN module compiles with C libraries to fail because MakeMaker's output Makefile contains -arch ppc.
To fix this one can edit the following file:
/System/Library/Perl/5.10.0/darwin-thread-multi-2level/Config_heavy.pl
at line 1219 you'll see:
$archflags = exists($ENV{ARCHFLAGS}) ? $ENV{ARCHFLAGS} : '-arch x86_64 -arch i386 -arch ppc';
change that to:
$archflags = exists($ENV{ARCHFLAGS}) ? $ENV{ARCHFLAGS} : '-arch x86_64 -arch i386';
Once you do this the generated Makefile will be correct.
These are a great set of instructions. I have a few other comments about potential "gotchas".
Correction to this step
perl Makefile.pl
make
install
The last step should be make install
During make, you may encounter an error that looks like :
lipo: can't open input file: /var/tmp//ccIevTzM.out (No such file or directory)
To correct this you must edit the file "Makefile" created after the "perl Makefile.pl" step and remove all occurrences of the following text :
-arch ppc
This will eliminate the error.
The same error described in (2.) will occur during the installation of the DBI module. You must edit the Makefile created after the perl Makefile.pl step and remove all occurrences of the following text :
-arch ppc
It seems as though the "Perl MakeFile.pl" command is not finding the version of Perl correctly and I get this error message:
bash-3.2# perl Makefile.PL
Multiple copies of Driver.xst found in: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/ /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level/auto/DBI/ at Makefile.PL line 37
Using DBI 1.616 (for perl 5.010000 on darwin-thread-multi-2level) installed in /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/
Configuring DBD::Oracle for perl 5.010000 on darwin (darwin-thread-multi-2level)
Remember to actually *READ* the README file! Especially if you have any problems.
Installing on a darwin, Ver#10.0
Using Oracle in /usr/oracle_instantClient64
Can't find sqlplus. Pity, it would have helped.
I'm having trouble finding your Oracle version number... trying harder
WARNING: I could not determine Oracle client version so I'll just
default to version 8.0.0.0. Some features of DBD::Oracle may not work.
Oracle version based logic in Makefile.PL may produce erroneous results.
You can use "perl Makefile.PL -V X.Y.Z" to specify a your client version.
Oracle version 8.0.0.0 (8.0)
DBD::Oracle no longer supports Oracle client versions before 9.2
Try a version before 1.25 for 9 and 1.18 for 8! at Makefile.PL line 175.
I've triple checked that I've downloaded and installed the proper 64-bit drivers from Oracle. I also checked to make sure that I'm running 64-bit Perl.
If I force the version number like this:
perl MakeFile.pl -V 10.2.0.4
It completes, but I receive the error message when running "make":
Oracle.c:2267: error: ‘SQLT_BIN’ undeclared (first use in this function)
Oracle.c:2277: error: ‘SQLCS_NCHAR’ undeclared (first use in this function)
Oracle.c:2281: error: ‘SQLT_INT’ undeclared (first use in this function)
Oracle.c:2283: error: ‘OCI_FETCH_PRIOR’ undeclared (first use in this function)
Oracle.c:2287: error: ‘OCI_FETCH_NEXT’ undeclared (first use in this function)
lipo: can't open input file: /var/tmp//ccyIFLPN.out (No such file or directory)
make: *** [Oracle.o] Error 1
I realize this is because of the "-arch ppc" argument that needs to be removed from Makefile, but even after removal the removal of all 32-bit references, I still saw the error message.
Running 10.6.8 Snow Leopard with Oracle Driver version 10.2.0.4
I found that the key to this issue was making sure that MakeFile.pl could find the Oracle version.
The problem I ran into was that Safari was downloading the zip files from Oracle.com, but unzipping them and somehow corrupting the library.
Instead, I used a different browser and downloaded all the zip files into one directory. Then I ran the following tar commands:
tar -xf instantclient-basic-10.2.0.4.0-macosx-x64.zip
tar -xf instantclient-sdk-10.2.0.4.0-macosx-x64.zip
tar -xf instantclient-sqlplus-10.2.0.4.0-macosx-x64.zip
The copy all the contents in the folder "instantclient_10_2" to $ORACLE_HOME (set previously)
sudo cp -R instantclient_10_2/* $ORACLE_HOME
Also, I did not need to edit the Makefile generated by the MakeFile.pl script to remove the "-arch ppc" references.
You should not recreate on your machine the same directory structure as of the client libraries packager.
Don't do mkdir -p /b/227/rdbms/
Use MacOSX library header management tools: otool and install_name_tool
For instance, I have updated the library headers to my deployment architecture:
otool -L /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1:
/ade/b/2649109290/oracle/rdbms/lib/libclntsh.dylib.11.1 (compatibility version 0.0.0, current version 0.0.0)
/ade/b/2649109290/oracle/ldap/lib/libnnz11.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
install_name_tool -id /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 \
-change /ade/b/2649109290/oracle/ldap/lib/libnnz11.dylib /usr/oracle_instantclient/11.2.0.3.0-64-bit/libnnz11.dylib /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1
otool -L /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1:
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 (compatibility version 0.0.0, current version 0.0.0)
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libnnz11.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
Check all files that come with the Oracle instantclient libraries and fix the path of all dependent libs
otool -L adrci
otool -L genezi
otool -L libclntsh.dylib.11.1
otool -L libheteroxa11.dylib
otool -L libnnz11.dylib
otool -L libocci.dylib.11.1
otool -L libociei.dylib
otool -L libocijdbc11.dylib
otool -L libsqlplus.dylib
otool -L libsqlplusic.dylib
otool -L sqlplus
otool -L uidrvci
Then, you link your dynamic libraries to the place they're supposed to be.
And you can avoid using that export DYLD_LIBRARY_PATH because you know how to setup your system
cd /usr/lib
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 libclntsh.dylib
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libheteroxa11.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libnnz11.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libocci.dylib.11.1 .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libocci.dylib.11.1 libocci.dylib
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libociei.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libocijdbc11.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libsqlplus.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libsqlplusic.dylib .