Getting "DSO missing from command line" with custom glibc - gcc

I am trying to link a program with a custom GLIBC installation. I have tried the following options, but got the same error
objs/ngx_modules.o \
-Wl,--emit-relocs -Wl,--dynamic-linker=/opt/glibc-2.23-install/lib/ld-2.23.so -ldl -Wl,-rpath-link,/opt/glibc-2.23-install/lib -lcrypt -lpcre -lz \
-Wl,-E
/usr/bin/ld: objs/src/core/ngx_shmtx.o: undefined reference to symbol 'sem_post##GLIBC_2.2.5'
/opt/glibc-2.23-install/lib/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
and
objs/ngx_modules.o \
-Wl,--emit-relocs -Wl,--dynamic-linker=/opt/glibc-2.23-install/lib/ld-2.23.so -ldl -L/opt/glibc-2.23-install/lib -lcrypt -lpcre -lz \
-Wl,-E
/usr/bin/ld: objs/src/core/ngx_shmtx.o: undefined reference to symbol 'sem_post##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
objs/Makefile:226: recipe for target 'objs/nginx' failed
and
objs/ngx_modules.o \
-Wl,--emit-relocs -Wl,--dynamic-linker=/opt/glibc-2.23-install/lib/ld-2.23.so -ldl -L/opt/glibc-2.23-install/lib/libpthread.so -lcrypt -lpcre -lz \
-Wl,-E
/usr/bin/ld: objs/src/core/ngx_shmtx.o: undefined reference to symbol 'sem_post##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
objs/Makefile:226: recipe for target 'objs/nginx' failed
Any alternative then?

-Wl,--emit-relocs -Wl,--dynamic-linker=/opt/glibc-2.23-install/lib/ld-2.23.so -ldl -L/opt/glibc-2.23-install/lib/libpthread.so -lcrypt -lpcre -lz \
-Wl,-E
Furious activity is no substitute for understanding. The command you want:
gcc objs/ngx_modules.o \
-Wl,-E -Wl,--dynamic-linker=/opt/glibc-2.23-install/lib/ld-2.23.so \
-L/opt/glibc-2.23-install/lib \
-lcrypt -lpcre -lz -lpthread

Related

Undefined reference to 'malloc' and more

When I try to complile the dhrystone benchmark, it shows the following errors:
xilinx#pynq:~/dhrystone$ riscv32-unknown-elf-gcc -Os -ffreestanding -nostdlib -o out.elf -Wl,-Bstatic,-T,picorv32.ld dhry_1.o dhry_2.o init.o -lgcc -march=rv32im
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: dhry_1.o: in function `Proc_1':
dhry_1.c:(.text+0x84): undefined reference to `memcpy'
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: dhry_1.c:(.text+0x100): undefined reference to `memcpy'
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: dhry_1.o: in function `main':
dhry_1.c:(.text.startup+0x3c): undefined reference to `malloc'
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: dhry_1.c:(.text.startup+0x4c): undefined reference to `malloc'
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: dhry_1.c:(.text.startup+0x84): undefined reference to `strcpy'
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: dhry_1.c:(.text.startup+0x98): undefined reference to `strcpy'
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: dhry_1.c:(.text.startup+0xb8): undefined reference to `time'
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: dhry_1.c:(.text.startup+0xf0): undefined reference to `strcpy'
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: dhry_1.c:(.text.startup+0x184): undefined reference to `time'
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: dhry_1.c:(.text.startup+0x254): undefined reference to `strcpy'
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: dhry_2.o: in function `.L15':
dhry_2.c:(.text+0x118): undefined reference to `strcmp'
collect2: error: ld returned 1 exit status
It seems that all the missing functions are from stdih.h. But I don't know how to fix it.
heres the commands I used to compile the benchmark.
riscv32-unknown-elf-gcc -c -Qn -DSTKPTR=32768 -march=rv32im -o init.o -Os --std=c99 init.S
riscv32-unknown-elf-gcc -c -Qn -march=rv32im -o dhry_1.o -Os --std=c99 dhry_1.c
riscv32-unknown-elf-gcc -c -Qn -march=rv32im -o dhry_2.o -Os --std=c99 dhry_2.c
riscv32-unknown-elf-gcc -Os -ffreestanding -nostdlib -o out.elf -Wl,-Bstatic,-T,picorv32.ld init.o dhry_1.o dhry_2.o -lgcc -march=rv32im
riscv32-unknown-elf-objcopy -O binary out.elf out.bin
Can anyone help me pls. Thanks for any help.
With the help of #yflelion, i've changed the fifth line to the following,
riscv32-unknown-elf-gcc -Os -ffreestanding -nostdlib -o out.elf -Wl,-Bstatic,-T,picorv32.ld init.o dhry_1.o dhry_2.o -lgcc -lc -lgloss -march=rv32im
And it shows the following errors,
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: /opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/lib/libgloss.a(sys_gettimeofday.o): in function `.L5':
sys_gettimeofday.c:(.text+0x48): undefined reference to `__errno'
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: /opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/lib/libgloss.a(sys_sbrk.o): in function `.L7':
sys_sbrk.c:(.text+0x84): undefined reference to `__errno'
collect2: error: ld returned 1 exit status
with the following command,
riscv32-unknown-elf-gcc -Os -ffreestanding -nostdlib -o out.elf -Wl,-Bstatic,-T,picorv32.ld init.o dhry_1.o dhry_2.o -lgcc -lc -march=rv32im
it shows the following errors,
/opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/bin/ld: /opt/riscv32im/lib/gcc/riscv32-unknown-elf/10.1.0/../../../../riscv32-unknown-elf/lib/libc.a(lib_a-sbrkr.o): in function `_sbrk_r':
sbrkr.c:(.text+0x20): undefined reference to `_sbrk'
When you use nostdlib, the compiler not use the standard system startup files or libraries when linking.
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
The only library you are linking against by using your command line is libgcc, but you are using functions from libc. you need to add -lc and most likely -lgloss. be careful with circular dependencies ( --start-group --end-group).
You can add the -v option and compile a minimalist example with the default options to see how it is done by default.
If there is no reason why you cannot use libc and libgloss by default, it is better to remove nostdlib option.
To compile your example try:
riscv32-unknown-elf-gcc -Os -ffreestanding -nostdlib -o out.elf -Wl,-Bstatic,-T,picorv32.ld init.o dhry_1.o dhry_2.o -lgcc -lc -lgloss -lc -march=rv32im
But the best solution to avoid circular dependencies would be:
riscv32-unknown-elf-gcc -Os -ffreestanding -nostdlib -o out.elf -Wl,-Bstatic,-T,picorv32.ld init.o dhry_1.o dhry_2.o -lgcc --start-group -lc -lgloss --end-group -lgcc -march=rv32im

Duplicate symbols for architecture x86_64 under gcc-10

I'm attempting to install an open source software qml in Mac high sierra. It's an interface btw kdb+ and LAPACK,BLAS. I've got the error message:
gcc-10 -m64 -fPIC -pipe -bundle -undefined dynamic_lookup -o qml.so const.o alloc.o util.o opt.o libm.o cephes.o lapack.o conmin.o conmax.o nlopt.o \
../lib/libprob.a ../lib/libconmax.a ../lib/libnlopt.a \
\
-llapack -lblas \
-lgfortran \
-lm \
-exported_symbols_list qml.symlist
duplicate symbol _call in:
conmin.o
conmax.o
duplicate symbol _call in:
conmin.o
nlopt.o
ld: 2 duplicate symbols for architecture x86_64
collect2: error: ld returned 1 exit status
I did some research and saw people fixed this issue by removing some Flags. here is the link can anyone help to see if any FLAG should be removed? Thanks. Here are the Flags:
FLAGS := -m64 -fPIC -pipe
LD_SHARED := -bundle -undefined dynamic_lookup

Is there a way to get a more descriptive error message from GCC?

so instead of printing for example:
cannot find -lGL
print:
cannot find -lGL, expected location: [ /foo/lib , /bar/lib ]
(and likewise with header files)
If you add the -v (verbose) option to the command-line, you will get ample information. Here is an example:
GNU assembler version 2.22 (x86_64-linux-gnu) using BFD version (GNU Binutils for Debian) 2.22
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'foo' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/4.7/collect2 --sysroot=/ --build-id --no-add-needed --eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o foo /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.7/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.7 -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../.. /var/tmp/ccKveaGH.o -lNoSuchGL -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/4.7/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: cannot find -lNoSuchGL
collect2: error: ld returned 1 exit status
The LIBRARY_PATH lists the directories which are searched, and the linker command collect2 shows the actual command-line.

/usr/bin/ld: cannot find -lsqlite3

while installing nix I am getting this error.when I doing make.
LD src/libstore/libnixstore.so
/usr/bin/ld: cannot find -lsqlite3
/usr/bin/ld: cannot find -lbz2
collect2: error: ld returned 1 exit status
make: *** [src/libstore/libnixstore.so] Error 1
I already set LDFLAGS to the directory containing libsqlite3.* and libbz2.*
update:
here is output of make V=1
Makefile:28: Makefile.config: No such file or directory
rm -f Makefile.config && ./config.status --quiet --file=Makefile.config
g++ -o /home/kapil/nix/src/nix-1.8/src/libstore/libnixstore.so -shared -Wl,--no-copy-dt-needed-entries src/libstore/build.o src/libstore/derivations.o src/libstore/gc.o src/libstore/globals.o src/libstore/local-store.o src/libstore/misc.o src/libstore/optimise-store.o src/libstore/pathlocks.o src/libstore/references.o src/libstore/remote-store.o src/libstore/store-api.o -lsqlite3 -lbz2 -Wl,-z,defs -Wl,-soname=libnixstore.so -Wl,-rpath,/home/kapil/nix/src/nix-1.8/src/libutil -Lsrc/libutil -lnixutil -Wl,-rpath,/home/kapil/nix/src/nix-1.8/src/boost/format -Lsrc/boost/format -lnixformat
/usr/bin/ld: cannot find -lsqlite3
/usr/bin/ld: cannot find -lbz2
collect2: error: ld returned 1 exit status
make: *** [src/libstore/libnixstore.so] Error 1

can not install ruby-1.8.7-p249 on rvm

$ rvm install ruby-1.8.7-p249
Installing Ruby from source to: /home/sayuj/.rvm/rubies/ruby-1.8.7-p249, this may take a while depending on your cpu(s)...
ruby-1.8.7-p249 - #fetching
ruby-1.8.7-p249 - #extracted to /home/sayuj/.rvm/src/ruby-1.8.7-p249 (already extracted)
ruby-1.8.7-p249 - #configuring
ruby-1.8.7-p249 - #compiling
ERROR: Error running 'make ', please read /home/sayuj/.rvm/log/ruby-1.8.7-p249/make.log
ERROR: There has been an error while running make. Halting the installation.
EDIT
I use Ubuntu 11.10
$ cat /home/sayuj/.rvm/log/ruby-1.8.7-p249/make.log
[2011-10-17 15:34:49] make
gcc -g -O2 -fPIC -DRUBY_EXPORT -D_GNU_SOURCE=1 -L. -rdynamic -Wl,-export-dynamic main.o libruby-static.a -lrt -ldl -lcrypt -lm -o miniruby
rbconfig.rb updated
gcc -shared -Wl,-soname,libruby.so.1.8 array.o bignum.o class.o compar.o dir.o dln.o enum.o enumerator.o error.o eval.o file.o gc.o hash.o inits.o io.o marshal.o math.o numeric.o object.o pack.o parse.o process.o prec.o random.o range.o re.o regex.o ruby.o signal.o sprintf.o st.o string.o struct.o time.o util.o variable.o version.o dmyext.o -lrt -ldl -lcrypt -lm -o libruby.so.1.8.7
compiling Win32API
compiling bigdecimal
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/bigdecimal'
gcc -shared -o ../../.ext/x86_64-linux/bigdecimal.so bigdecimal.o -L. -L../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/bigdecimal'
compiling curses
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/curses'
gcc -shared -o ../../.ext/x86_64-linux/curses.so curses.o -L. -L../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lncurses -ltinfo -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/curses'
compiling dbm
compiling digest
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest'
gcc -shared -o ../../.ext/x86_64-linux/digest.so digest.o -L. -L../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lrt -ldl -lcrypt -lm -lc
cp ../.././ext/digest/digest.h ../../.ext/x86_64-linux
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest'
compiling digest/bubblebabble
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest/bubblebabble'
gcc -shared -o ../../../.ext/x86_64-linux/digest/bubblebabble.so bubblebabble.o -L. -L../../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest/bubblebabble'
compiling digest/md5
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest/md5'
gcc -shared -o ../../../.ext/x86_64-linux/digest/md5.so md5init.o md5ossl.o -L. -L../../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lcrypto -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest/md5'
compiling digest/rmd160
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest/rmd160'
gcc -shared -o ../../../.ext/x86_64-linux/digest/rmd160.so rmd160init.o rmd160ossl.o -L. -L../../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lcrypto -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest/rmd160'
compiling digest/sha1
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest/sha1'
gcc -shared -o ../../../.ext/x86_64-linux/digest/sha1.so sha1init.o sha1ossl.o -L. -L../../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lcrypto -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest/sha1'
compiling digest/sha2
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest/sha2'
gcc -shared -o ../../../.ext/x86_64-linux/digest/sha2.so sha2.o sha2init.o -L. -L../../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/digest/sha2'
compiling dl
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/dl'
gcc -shared -o ../../.ext/x86_64-linux/dl.so handle.o ptr.o dl.o sym.o -L. -L../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -ldl -lrt -ldl -lcrypt -lm -lc
cp dlconfig.h ../../.ext/x86_64-linux
cp ../.././ext/dl/dl.h ../../.ext/x86_64-linux
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/dl'
compiling etc
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/etc'
gcc -shared -o ../../.ext/x86_64-linux/etc.so etc.o -L. -L../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/etc'
compiling fcntl
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/fcntl'
gcc -shared -o ../../.ext/x86_64-linux/fcntl.so fcntl.o -L. -L../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/fcntl'
compiling gdbm
compiling iconv
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/iconv'
gcc -shared -o ../../.ext/x86_64-linux/iconv.so iconv.o -L. -L../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/iconv'
compiling io/wait
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/io/wait'
gcc -shared -o ../../../.ext/x86_64-linux/io/wait.so wait.o -L. -L../../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/io/wait'
compiling nkf
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/nkf'
gcc -shared -o ../../.ext/x86_64-linux/nkf.so nkf.o -L. -L../.. -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -L/home/sayuj/.rvm/rubies/ruby-1.8.7-p249/lib -lruby -lrt -ldl -lcrypt -lm -lc
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/nkf'
compiling openssl
make[1]: Entering directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/openssl'
gcc -I. -I../.. -I../../. -I../.././ext/openssl -DRUBY_EXTCONF_H=\"extconf.h\" -fPIC -g -O2 -fPIC -c ossl_pkcs7.c
ossl_pkcs7.c: In function ‘ossl_pkcs7si_new’:
ossl_pkcs7.c:89:5: warning: passing argument 2 of ‘ASN1_dup’ from incompatible pointer type [enabled by default]
/usr/include/openssl/asn1.h:955:7: note: expected ‘void * (*)(void **, const unsigned char **, long int)’ but argument is of type ‘char * (*)()’
ossl_pkcs7.c: In function ‘DupPKCS7SignerPtr’:
ossl_pkcs7.c:102:5: warning: passing argument 2 of ‘ASN1_dup’ from incompatible pointer type [enabled by default]
/usr/include/openssl/asn1.h:955:7: note: expected ‘void * (*)(void **, const unsigned char **, long int)’ but argument is of type ‘char * (*)()’
ossl_pkcs7.c: In function ‘ossl_pkcs7ri_new’:
ossl_pkcs7.c:115:5: warning: passing argument 2 of ‘ASN1_dup’ from incompatible pointer type [enabled by default]
/usr/include/openssl/asn1.h:955:7: note: expected ‘void * (*)(void **, const unsigned char **, long int)’ but argument is of type ‘char * (*)()’
ossl_pkcs7.c: In function ‘DupPKCS7RecipientPtr’:
ossl_pkcs7.c:128:5: warning: passing argument 2 of ‘ASN1_dup’ from incompatible pointer type [enabled by default]
/usr/include/openssl/asn1.h:955:7: note: expected ‘void * (*)(void **, const unsigned char **, long int)’ but argument is of type ‘char * (*)()’
ossl_pkcs7.c: At top level:
ossl_pkcs7.c:573:1: error: unknown type name ‘STACK’
ossl_pkcs7.c: In function ‘pkcs7_get_certs_or_crls’:
ossl_pkcs7.c:593:15: warning: assignment from incompatible pointer type [enabled by default]
ossl_pkcs7.c:596:31: warning: pointer type mismatch in conditional expression [enabled by default]
ossl_pkcs7.c: In function ‘ossl_pkcs7_set_certificates’:
ossl_pkcs7.c:611:11: warning: assignment from incompatible pointer type [enabled by default]
ossl_pkcs7.c: In function ‘ossl_pkcs7_get_certificates’:
ossl_pkcs7.c:621:5: warning: passing argument 1 of ‘ossl_x509_sk2ary’ from incompatible pointer type [enabled by default]
ossl.h:121:7: note: expected ‘struct stack_st_X509 *’ but argument is of type ‘int *’
ossl_pkcs7.c: In function ‘ossl_pkcs7_set_crls’:
ossl_pkcs7.c:651:10: warning: assignment from incompatible pointer type [enabled by default]
ossl_pkcs7.c: In function ‘ossl_pkcs7_get_crls’:
ossl_pkcs7.c:661:5: warning: passing argument 1 of ‘ossl_x509crl_sk2ary’ from incompatible pointer type [enabled by default]
ossl.h:122:7: note: expected ‘struct stack_st_X509_CRL *’ but argument is of type ‘int *’
make[1]: *** [ossl_pkcs7.o] Error 1
make[1]: Leaving directory `/home/sayuj/.rvm/src/ruby-1.8.7-p249/ext/openssl'
make: *** [all] Error 1
How can I fix this?
From here : http://ahmy.yulrizka.com/2011/10/ruby-ree-1-8-7-openssl-error/
rvm pkg install openssl
And from one of the answers here: https://stackoverflow.com/a/8544958/178975
rvm install ruby-1.8.7 --with-openssl-dir=<rvm_dir>/usr
where rvm_dir could be $HOME/.rvm or /usr/local/rvm or wherever you have installed rvm
Looks like the problem is:
ossl_pkcs7.c:573:1: error: unknown type name ‘STACK’
My guess is its a dependancy issue.
Look at the output of:
rvm notes
And ensure you have followed all the steps for Ubuntu.
One obvious thing is that Ubuntu 11.10 is only just out - might be worth searching/posting on the Ubuntu forums to see if anyone there has had any issues with it and rvm.
Be sure to install ruby with rvm and giving the open-ssl-dir explicitly like this:
rvm cleanup
rvm install ruby-1.8.7 --with-openssl-dir=$HOME/.rvm/usr

Resources