Unable to build pdftk from source on fedora machine - fedora

I am trying to build pdftk from source on fedora machine. I have unzip pdftk jar and trying to execute
make -f Makefile.Redhat
But i am getting following error on my console.
gcjh-4.7.2 -force --classpath="/usr/share/java/libgcj-4.7.2.jar:/home/tw1/pdftk-1.45-dist/java:." org/bouncycastle/asn1/ASN1ObjectParser
/bin/sh: gcjh-4.7.2: command not found
make[1]: [org/bouncycastle/asn1/ASN1ObjectParser.h] Error 127 (ignored)
gcj-4.7.2 -Wall -Wextra -O2 --encoding=UTF-8 --classpath="/usr/share/java/libgcj-4.7.2.jar:/home/tw1/pdftk-1.45-dist/java:." -C org/bouncycastle/asn1/IndefiniteLengthInputStream.java
/bin/sh: gcj-4.7.2: command not found
make[1]: [org/bouncycastle/asn1/IndefiniteLengthInputStream.class] Error 127 (ignored)
gcjh-4.7.2 -force --classpath="/usr/share/java/libgcj-4.7.2.jar:/home/tw1/pdftk-1.45-dist/java:." org/bouncycastle/asn1/IndefiniteLengthInputStream
/bin/sh: gcjh-4.7.2: command not found
make[1]: [org/bouncycastle/asn1/IndefiniteLengthInputStream.h] Error 127 (ignored)
fastjar-4.7.2 -cf java_lib.jar com/lowagie/*/*/*/*.class com/lowagie/*/*/*.class com/lowagie/*/*.class org/bouncycastle/*/*.class org/bouncycastle/*/*/*.class com/lowagie/text/pdf/fonts/Helvetica-Oblique.afm com/lowagie/text/pdf/fonts/Courier.afm com/lowagie/text/pdf/fonts/Helvetica-BoldOblique.afm com/lowagie/text/pdf/fonts/Courier-Bold.afm com/lowagie/text/pdf/fonts/Times-Roman.afm com/lowagie/text/pdf/fonts/Times-Bold.afm com/lowagie/text/pdf/fonts/Courier-Oblique.afm com/lowagie/text/pdf/fonts/Symbol.afm com/lowagie/text/pdf/fonts/Courier-BoldOblique.afm com/lowagie/text/pdf/fonts/Helvetica.afm com/lowagie/text/pdf/fonts/Helvetica-Bold.afm com/lowagie/text/pdf/fonts/Times-Italic.afm com/lowagie/text/pdf/fonts/ZapfDingbats.afm com/lowagie/text/pdf/fonts/Times-BoldItalic.afm
/bin/sh: fastjar-4.7.2: command not found
make[1]: [java_lib.o] Error 127 (ignored)
gcj-4.7.2 -Wall -Wextra -O2 --encoding=UTF-8 --classpath="/usr/share/java/libgcj-4.7.2.jar:/home/tw1/pdftk-1.45-dist/java:." -c java_lib.jar
/bin/sh: gcj-4.7.2: command not found
make[1]: [java_lib.o] Error 127 (ignored)
make[1]: Leaving directory `/home/tw1/pdftk-1.45-dist/java'
make: *** No rule to make target `../java/java_lib.o', needed by `pdftk.o'. Stop.
From the output i can infer that it is not able to find gcjh,gcj path. I am not able to find out what path should be given into the Makefile.
TOOLPATH=
export VERSUFF=
Additional information
gcc --version
gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
locate gcjh-4.7.2 | less
Nothing
locate gcj-4.7.2 | less
/usr/lib64/gcj-4.7.2
/usr/lib64/gcj-4.7.2/classmap.db
/usr/lib64/gcj-4.7.2/classmap.db.d
/usr/lib64/gcj-4.7.2/libgjsmalsa.so
/usr/lib64/gcj-4.7.2/libgtkpeer.so
/usr/lib64/gcj-4.7.2/libjavamath.so
/usr/lib64/gcj-4.7.2/libjawt.so
/usr/lib64/gcj-4.7.2/libjvm.so
/usr/share/java/libgcj-4.7.2.jar

Do you actually have the gcc-java package installed? That is what provides the gcj and gcjh executables (though not gcj-4.7.2 or gcjh-4.7.2).

Related

Compile mysql with CFI enabled

I want to compile mysql with CFI enabled by LLVM. The version of the softwares are as following:
clang-6.0
mysql-5.6.26
binutils-2.28.1
I can compile mysql successfully with the following configration:
CC="clang" CXX="clang++" CFLAGS="-g" cmake -DCMAKE_INSTALL_PREFIX=../mysql -DWITH_BOOST=./boost .
However, I can not compile mysql with the below configuration:
CC="clang" CXX="clang++" CFLAGS="-g -flto" CXXFLAGS="-g -flto" cmake -DCMAKE_INSTALL_PREFIX=../mysql -DWITH_BOOST=./boost .
The reported error is as following:
../mysys/libmysys.a: error adding symbols: Archive has no index; run ranlib to add one
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [extra/comp_err] Error 1
The ../mysys/libmysys.a is constructed by the following command:
cd /home/zhangjun/work/mysql/mysql-5.6.26/mysys_ssl
&& /home/zhangjun/tools/cmake/cmake-3.9.1-Linux-x86_64/bin/cmake -P
CMakeFiles/mysys_ssl.dir/cmake_clean_target.cmake
cd /home/zhangjun/work/mysql/mysql-5.6.26/mysys_ssl && /home/zhangjun/tools/cmake/cmake-3.9.1-Linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/mysys_ssl.dir/link.txt --verbose=1
/usr/bin/ar qc libmysys_ssl.a CMakeFiles/mysys_ssl.dir/crypt_genhash_impl.cc.o CMakeFiles/mysys_ssl.dir/my_default.cc.o CMakeFiles/mysys_ssl.dir/my_getopt.cc.o CMakeFiles/mysys_ssl.dir/my_aes.cc.o CMakeFiles/mysys_ssl.dir/my_sha1.cc.o CMakeFiles/mysys_ssl.dir/my_sha2.cc.o CMakeFiles/mysys_ssl.dir/my_md5.cc.o CMakeFiles/mysys_ssl.dir/my_rnd.cc.o CMakeFiles/mysys_ssl.dir/my_murmur3.cc.o CMakeFiles/mysys_ssl.dir/my_aes_yassl.cc.o
/usr/bin/ranlib libmysys_ssl.a
How can I fix this error?
To fix this error, I sent a email to Caroline Tice, the author of "Enforcing Forward-Edge Control-Flow Integrity in GCC & LLVM"
He said I should use the ar and runlib of llvm. The above error is fixed by using the following configuration:
CC="clang" CXX="clang++" CFLAGS="-g -flto -fvisibility=hidden -fsanitize=cfi" CXXFLAGS="-g -flto -fvisibility=hidden -fsanitize=cfi" cmake -DCMAKE_{EXE,SHARED,MODULE}_LINKER_FLAGS="-flto -fsanitize=cfi" -DCMAKE_AR=/home/zhangjun/work/llvm/llvm-3.7.1/bin/llvm-ar -DCMAKE_RANLIB=/home/zhangjun/work/llvm/llvm-3.7.1/bin/llvm-ranlib -DCMAKE_NM=/home/zhangjun/work/llvm/llvm-3.7.1/bin/llvm-nm -DCMAKE_INSTALL_PREFIX=../mysql -DWITH_BOOST=./boost .
Unfortunately, there is anotehr error:
ld: /home/zhangjun/work/llvm/llvm/tools/gold/gold-plugin.cpp:879: ld_plugin_status allSymbolsReadHook(): Assertion `ObjFilename.second' failed.
clang-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: linker command failed due to signal (use -v to see invocation)
make[2]: *** [extra/comp_err] Error 254
make[2]: Leaving directory `/home/zhangjun/work/mysql/mysql-5.6.26'
make[1]: *** [extra/CMakeFiles/comp_err.dir/all] Error 2
make[1]: Leaving directory `/home/zhangjun/work/mysql/mysql-5.6.26'
make: *** [all] Error 2
Can any body help me fix this error?
Try removing -flto from the flags. For some reason, with clang, I've had the link-time optimisation cause that problem.

Compiling MariaDB Connector v1.0.5 and/or Mysql Connection v 5.3.4

I am trying to compile MariaDB Connector v1.0.5 and/or Mysql Connection v 5.3.4.
I have MariaDB Server v.10.0.21 installed on a Slackware server. I just need to get a MYSQL connector working, doesn't matter which one.
Also applied the patch mentioned in Is there compatible ODBC driver with Mariadb 10 on Linux?
When I compile the MariaDB Connector I get an error saying "MariaDB not found".
When I compile the Mysql Connector I get the following error:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
MYSQL_LIB
linked by target "myodbc5a" in directory /downloads/mysql-connector-odbc-5.3.4-src/driver
linked by target "myodbc5w" in directory /downloads/mysql-connector-odbc-5.3.4-src/driver
linked by target "myodbc5S" in directory /downloads/mysql-connector-odbc-5.3.4-src/setupgui
linked by target "myodbc-installer" in directory /downloads/mysql-connector-odbc-5.3.4-src/installer
OUTOUT from Error File
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/gmake "cmTryCompileExec3523358880/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec3523358880.dir/build.make CMakeFiles/cmTryCompileExec3523358880.dir/build
gmake1: Entering directory /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec3523358880.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTryCompileExec3523358880.dir/CheckFunctionExists.c.o -c /usr/share/cmake-2.8/Modules/CheckFunct
ionExists.c
Linking C executable cmTryCompileExec3523358880
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3523358880.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTryCompileExec3523358880.dir/CheckFunctionExists.c.o -o cmTryCompileExec3523358880 -rdynamic -lpth
reads
/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../x86_64-slackware-linux/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTryCompileExec3523358880] Error 1
gmake[1]: Leaving directory/downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec3523358880/fast] Error 2
Determining if the function dlopen exists failed with the following output:
Change Dir: /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/gmake "cmTryCompileExec1888052970/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec1888052970.dir/build.make CMakeFiles/cmTryCompileExec1888052970.dir/build
gmake1: Entering directory /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec1888052970.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=dlopen -o CMakeFiles/cmTryCompileExec1888052970.dir/CheckFunctionExists.c.o -c /usr/share/cmake-2.8/Modules/CheckFunctionExist
s.c
Linking C executable cmTryCompileExec1888052970
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1888052970.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=dlopen CMakeFiles/cmTryCompileExec1888052970.dir/CheckFunctionExists.c.o -o cmTryCompileExec1888052970 -rdynamic
CMakeFiles/cmTryCompileExec1888052970.dir/CheckFunctionExists.c.o: In functionmain':
CheckFunctionExists.c:(.text+0x15): undefined reference to dlopen'
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTryCompileExec1888052970] Error 1
gmake[1]: Leaving directory/downloads/mysql-connector-odbc-5.3.4-src/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec1888052970/fast] Error 2
Blockquote
Just use the precompiled versions. Copy the libraries to the lib and include directories.

Error undefined reference to `cutCreateTimer'

I have the cuda 4.0 toolkit installed in my Ubuntu 12.04 server. When I am trying to build a cuda code present in Rodinia benchmark suite. I was getting the following error. i.e, after running the make command
ncclab#slave13:~/Downloads/rodinia_2.4$ make
cd cuda/cfd; make; cp euler3d euler3d_double pre_euler3d pre_euler3d_double /home/ncclab/Downloads/rodinia_2.4/bin/linux/cuda
make[1]: Entering directory `/home/ncclab/Downloads/rodinia_2.4/cuda/cfd'
nvcc -O2 -Xptxas -v --gpu-architecture=compute_20 --gpu-code=compute_20 euler3d.cu -o euler3d -I/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C/common/inc -L/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C/lib
euler3d.cu:35: warning: #warning "the kernels may fail too launch on some systems if the block length is too large"
euler3d.cu:35: warning: #warning "the kernels may fail too launch on some systems if the block length is too large"
By here the euler3d was built
nvcc -Xptxas -v -O3 --gpu-architecture=compute_20 --gpu-code=compute_20 euler3d_double.cu -o euler3d_double -I/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C/common/inc -L/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C/lib
/tmp/tmpxft_0000532d_00000000-12_euler3d_double.o: In function `main':
tmpxft_0000532d_00000000-1_euler3d_double.cudafe1.cpp:(.text+0x22d9): undefined reference to `cutCreateTimer'
tmpxft_0000532d_00000000-1_euler3d_double.cudafe1.cpp:(.text+0x22f7): undefined reference to `cutStartTimer'
tmpxft_0000532d_00000000-1_euler3d_double.cudafe1.cpp:(.text+0x2457): undefined reference to `cutStopTimer'
tmpxft_0000532d_00000000-1_euler3d_double.cudafe1.cpp:(.text+0x246c): undefined reference to `cutGetAverageTimerValue'
collect2: ld returned 1 exit status
make[1]: *** [euler3d_double] Error 1
make[1]: Leaving directory `/home/ncclab/Downloads/rodinia_2.4/cuda/cfd'
cp: cannot stat `euler3d_double': No such file or directory
cp: cannot stat `pre_euler3d': No such file or directory
cp: cannot stat `pre_euler3d_double': No such file or directory
make: *** [CUDA] Error 1
By searching I came to know that there may be a problem with libcutil
But I had the libcutil_x86_64.a in ~/NVIDIA_GPU_Computing_SDK/C/lib
Edit: The contents of various folders are
ncclab#slave13:~/NVIDIA_GPU_Computing_SDK/C/lib$ ls
libcutil_x86_64.a libparamgl_x86_64.a librendercheckgl_x86_64.a
~/Downloads/rodinia_2.4/cuda/cfd$ ls
euler3d euler3d_double.cu Makefile~ pre_euler3d.cu README
euler3d.cu Makefile Makefile_nvidia pre_euler3d_double.cu run
ncclab#slave13:~/NVIDIA_GPU_Computing_SDK/C/common/inc$ ls
bank_checker.h cutil_inline.h GL nvVector.h stopwatch_base.h
cmd_arg_reader.h cutil_inline_runtime.h multithreading.h nvWidgets.h stopwatch_base.inl
cuda_drvapi_dynlink.c cutil_math.h nvGlutWidgets.h paramgl.h stopwatch.h
cutil_gl_error.h dynlink nvGLWidgets.h param.h stopwatch_linux.h
cutil_gl_inline.h dynlink_d3d10.h nvMath.h rendercheck_d3d10.h
cutil.h dynlink_d3d11.h nvMatrix.h rendercheck_d3d11.h
cutil_inline_bankchecker.h error_checker.h nvQuaternion.h rendercheck_d3d9.h
cutil_inline_drvapi.h exception.h nvShaderUtils.h rendercheck_gl.h
the partial contents of the makefile are
all: euler3d euler3d_double pre_euler3d pre_euler3d_double
euler3d: euler3d.cu
nvcc -O2 -Xptxas -v --gpu-architecture=compute_20 --gpu-code=compute_20 euler3d.cu -o euler3d -I$(CUDA_SDK_PATH)/common/inc -L$(CUDA_SDK_PATH)/lib $(CUTIL_LIB)
euler3d_double: euler3d_double.cu
nvcc -Xptxas -v -O3 --gpu-architecture=compute_20 --gpu-code=compute_20 euler3d_double.cu -o euler3d_double -I$(CUDA_SDK_PATH)/common/inc -L$(CUDA_SDK_PATH)/lib $(CUTIL_LIB)
pre_euler3d: pre_euler3d.cu
nvcc -Xptxas -v -O3 --gpu-architecture=compute_20 --gpu-code=compute_20 pre_euler3d.cu -o pre_euler3d -I$(CUDA_SDK_PATH)/common/inc -L$(CUDA_SDK_PATH)/lib $(CUTIL_LIB)
pre_euler3d_double: pre_euler3d_double.cu
nvcc -Xptxas -v -O3 --gpu-architecture=compute_20 --gpu-code=compute_20 pre_euler3d_double.cu -o pre_euler3d_double -I$(CUDA_SDK_PATH)/common/inc -L$(CUDA_SDK_PATH)/lib $(CUTIL_LIB)
The euler3d has been successfully built. The errors are occurring for all the remaining three files.So I don't think there is any problems in the directories they are referring to
I really don't understand why the undefined reference to `cutCreateTimer' and others are occurring. But searching in SE I came to know that when there is any problem with cutil.h or libcutil these problems exits. I was a newbie of linux environment. So please help me
Edit 2: In a include file named make.config the following lines were present
# CUDA SDK installation path
#SDK_DIR = $(HOME)/NVIDIA_GPU_Computing_SDK/C
SDK_DIR =/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C
#SDK_DIR =/if10/kw5na/NVIDIA_CUDA_Computing_SDK4/C
Here by default the 2nd option was selected and the euler3d was built. So I thought there may be a problem because of this. But changing it does not change the problem I was facing
and about cutil library present in make file
CUDA_SDK_PATH := $(SDK_DIR)
# Determine the correct version of the cutil library
CUTIL_LIB = # -lcutil
ifeq ($(shell uname -m), x86_64)
ifeq ($(shell if test -e $(SDK_DIR)/lib/libcutil_x86_64.a; then echo T; else echo F; fi), T)
CUTIL_LIB = #-lcutil_x86_64
endif
endif
Which I think was correct
The problem is that your compile command is specifying the library path, but not the library itself that is providing the cut... functionality.
This is apparently the makefile line that is generating the nvcc compile command for euler3d_double:
euler3d_double: euler3d_double.cu
nvcc -Xptxas -v -O3 --gpu-architecture=compute_20 --gpu-code=compute_20 euler3d_double.cu -o euler3d_double -I$(CUDA_SDK_PATH)/common/inc -L$(CUDA_SDK_PATH)/lib $(CUTIL_LIB)
This is the generated compile command:
nvcc -Xptxas -v -O3 --gpu-architecture=compute_20 --gpu-code=compute_20 euler3d_double.cu -o euler3d_double -I/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C/common/inc -L/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C/lib
You'll note that the last two tokens in the makefile line are:
-L$(CUDA_SDK_PATH)/lib $(CUTIL_LIB)
The -L$... token is getting converted to the correct library path. But the $(CUTIL_LIB) token should be getting converted to something like -lcutil or perhaps -lcutil_x86_64, but that is not happening. As a result, the library that provides the cut...Timer... functions is missing, and so those appear to be undefined.
I would inspect the Makefile carefully to see if there are any end-of-line characters or other oddities that are different between the line that specifies how euler3d_double should be built and the previous lines that specify how euler3d should be built.
You should also be able to confirm this by looking at the nvcc compile command line generated for euler3d (which you don't show) and comparing it to the one for euler3d_double (which is failing).

Rails / Snow Leopard Mysql 64-bit question

Hey all, I'm trying to install 64-bit MySQL on Snow Leopard for a rails app.
I've installed it from the dmg and I can get to mysql fine from the command line. Based on various blog posts as well as the other topics here on Stack, I shut down mysql, uninstall the mysql gem, and then try to update the gem with the following:
sudo env ARCHFLAGS='-arch x86_64' gem install --verbose --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
That produces the following:
GET 200 OK: http://gems.rubyforge.org/latest_specs.4.8.gz
Installing gem mysql-2.8.1
Downloading gem mysql-2.8.1.gem
GET 302 Found: http://gems.rubyforge.org/gems/mysql-2.8.1.gem
GET 200 OK: http://s3.amazonaws.com/gemcutter_production/gems/mysql-2.8.1.gem
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/COPYING
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/COPYING.ja
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/History.txt
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/Manifest.txt
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/README.txt
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/Rakefile
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/extconf.rb
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/mysql.c
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/extra/README.html
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/extra/README_ja.html
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/extra/tommy.css
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql.rb
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/tasks/gem.rake
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/tasks/native.rake
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/tasks/vendor_mysql.rake
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/test/test_mysql.rb
Building native extensions. This could take a while...
/usr/local/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... yes
creating Makefile
make
gcc -I. -I. -I/usr/local/lib/ruby/1.8/universal-darwin8.0 -I. -DHAVE_MYSQL_H -I/usr/local/mysql/include -g -Os -arch x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -fno-common -g -O2 -fno-common -pipe -fno-common -arch i386 -c mysql.c
cc -dynamic -bundle -undefined suppress -flat_namespace -arch i386 -L"/usr/local/lib" -o mysql_api.bundle mysql.o -lruby -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lmygcc -lpthread -ldl -lobjc
ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
ld: warning: in /usr/local/mysql/lib/libmygcc.a, file is not of required architecture
make install
/usr/bin/install -c -m 0755 mysql_api.bundle /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib
Successfully installed mysql-2.8.1
1 gem installed
Those two warnings at the end seem ominous. I then go to my rails app and run
rake db:migrate
And get:
dyld: NSLinkModule() error
dyld: Symbol not found: _mysql_affected_rows
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Trace/BPT trap
And that's as far as I'm able to get. I've tried installing MySQL via the dmg and via macports and I seem to run into this error in both cases.
I'm kind of a noob when it comes to rails; any light anyone can shed would be wildly appreciated. Thanks!
--- EDIT ---
In response to John's (and khelll's) answers below:
When I do the first command that John specified, I get:
No definition for next_result
No definition for field_name
No definition for field_table
There's about 40 lines of this. I assumed this was because of the documentation. But when I do rake db:migrate I get:
dyld: NSLinkModule() error
dyld: Symbol not found: _mysql_affected_rows
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Trace/BPT trap
Using the ARCHFLAGS command produces the error I specified earlier.
--- SECOND EDIT ---
I should add that I did not install from source. After peeking at the Hivelogic instructions again, I went down this route.
When I tried to run:
./configure --prefix=/usr/local/mysql --with-extra-charsets=complex \
--enable-thread-safe-client --enable-local-infile --enable-shared \
--with-plugins=innobase
I got:
config.status: creating zlib/Makefile
dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
Referenced from: /opt/local/bin/gawk
Reason: no suitable image found. Did find:
/opt/local/lib/libintl.8.dylib: mach-o, but wrong architecture
./config.status: line 1782: 69228 Done(141) eval sed ç"ç$ac_sed_extraç" "$ac_file_inputs"
69229 Trace/BPT trap
So I did:
sudo port deactivate gettext
sudo port activate gettext #0.17_3
However, after following all the steps, reinstalling the gem, upon rake db:migrate I still get:
dyld: NSLinkModule() error
dyld: Symbol not found: _mysql_affected_rows
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Trace/BPT trap
---- THIRD EDIT ----
Okay - I believe what's happening here is that, even though I'm specifying the 64 bit gem above, it's installing the 32 bit version. I do:
file /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
And get:
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle: Mach-O bundle i386
So it would seem I keep installing the 32 bit version
I installed it from source following these instructions on Hivelogic and it works great. Then I installed the MySQL RubyGem using:
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

How do I fix "Symbol not found: _is_prefix" when compiling Perl's DBD::mysql?

First I wanted to build the DBD::mysql package. That kept failing because whatever make resulted in could not be loaded for the tests with a Symbol not found: _is_prefix. So I assumed that cpan might be a tad old. I know it's a random assumption, but cpan did tell me to install the latest Bundle::CPAN.
Who's successfully installed either DBD::mysql or Bundle::CPAN on Mac OS X 10.5? Could you recommend any thing I could be doing differently?
This is perl, v5.8.8 built for darwin-thread-multi-2level
(with 4 registered patches, see perl -V for more detail)
/usr/local/mysql/bin/mysql Ver 14.14 Distrib 5.1.36,
for apple-darwin9.5.0 (i386) using readline 5.1
Here's a log of the CPAN output for DBD::mysql:
Writing Makefile for DBD::mysql
cc -c -I/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI -I/usr/local/mysql/include -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch ppc -arch i386 -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include -O3 -DVERSION=\"4.012\" -DXS_VERSION=\"4.012\" "-I/System/Library/Perl/5.8.8/darwin-thread-multi-2level/CORE" dbdimp.c
/usr/bin/perl -p -e "s/~DRIVER~/mysql/g" /Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI/Driver.xst > mysql.xsi
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
/usr/bin/perl /System/Library/Perl/5.8.8/ExtUtils/xsubpp -typemap /System/Library/Perl/5.8.8/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs
chmod 644 blib/arch/auto/DBD/mysql/mysql.bs
Warning: duplicate function definition 'do' detected in mysql.xs, line 225
Warning: duplicate function definition 'rows' detected in mysql.xs, line 650
cc -c -I/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI -I/usr/local/mysql/include -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch ppc -arch i386 -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include -O3 -DVERSION=\"4.012\" -DXS_VERSION=\"4.012\" "-I/System/Library/Perl/5.8.8/darwin-thread-multi-2level/CORE" mysql.c
dbdimp.c: In function 'mysql_describe':
dbdimp.c:3309: warning: assignment from incompatible pointer type
dbdimp.c: In function 'mysql_describe':
dbdimp.c:3309: warning: assignment from incompatible pointer type
rm -f blib/arch/auto/DBD/mysql/mysql.bundle
LD_RUN_PATH="/usr/local/mysql/lib" /usr/bin/perl myld cc -mmacosx-version-min=10.5.7 -arch ppc -arch i386 -bundle -undefined dynamic_lookup -L/usr/local/lib dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.bundle \
-L/usr/local/mysql/lib -lmysqlclient -lz -lm \
chmod 755 blib/arch/auto/DBD/mysql/mysql.bundle
Manifying blib/man3/DBD::mysql.3pm
Manifying blib/man3/DBD::mysql::INSTALL.3pm
Manifying blib/man3/Bundle::DBD::mysql.3pm
CAPTTOFU/DBD-mysql-4.012.tar.gz
/usr/bin/make -j3 -j3 -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base.t .................. 1/6 Bailout called. Further testing stopped: Unable to load DBD::mysql
# Failed test 'use DBD::mysql;'
# at t/00base.t line 21.
# Tried to use 'DBD::mysql'.
# Error: Can't load '/Users/dlamblin/.cpan/build/DBD-mysql-4.012-4n3pv8/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/dlamblin/.cpan/build/DBD-mysql-4.012-4n3pv8/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Symbol not found: _is_prefix
# Referenced from: /Users/dlamblin/.cpan/build/DBD-mysql-4.012-4n3pv8/blib/arch/auto/DBD/mysql/mysql.bundle
# Expected in: dynamic lookup
# at (eval 7) line 2
# Compilation failed in require at (eval 7) line 2.
# BEGIN failed--compilation aborted at (eval 7) line 2.
FAILED--Further testing stopped: Unable to load DBD::mysql
make: *** [test_dynamic] Error 255
CAPTTOFU/DBD-mysql-4.012.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports CAPTTOFU/DBD-mysql-4.012.tar.gz
Running make install
make test had returned bad status, won't install without force
Failed during this command:
CAPTTOFU/DBD-mysql-4.012.tar.gz : make_test NO
Okay, if you get these errors I now know the following:
MySQL 5.1 for Mac OS X x86_64 is not compatible with DBD::mysql (yet). Install the 32-bit x86 version, and try again. You'll succeed. I wish the perl Makefile.pl would just tell you that in a banner.
Bundle::CPAN had issues because I wasn't installing as root. Why that makes it report circular references instead of installation permission issues, I'll never understand.
Please add a comment if and when this became outdated information.
Installing the (beta) 5.4.1 64 bit version of mysql, available from their developer website, fixes the issue. Tested on Snow Leopard.
Did you try installing Bundle::DBD::mysql?
I haven't dealt with this problem, but I found that MacPorts cleaned up all my UNIX incompatibility problems. You might want to try that before enduring too much pain and suffering.
Where is it complaining about a circular dependency? It looks like you are trying to link to an incompatible version of the mysql libraries. The symbol it's looking for isn't in the library you loaded. I don't think this is a problem caused by CPAN.pm or the cpan script.
Some questions:
Who compiled perl? Is this Apple's perl?
Who compiled mysql? Is that your own version since it's in /usr/local?
Did you previously compile other versions? I start with a compile to ensure everything points to the right places.
Installing latest beta 64bit version of Mysql fixed problem on my computer.