freebsd php 7.2 mcrypt

ReN

Verified User
Joined
Jul 2, 2005
Messages
185
hey guys,

need a way to install mcrypt on freebsd 11.2 for php 7.2

tried all the guides

https://help.poralix.com/articles/install-mcrypt-for-php-72-on-directadmin-server

get

/bin/sh /usr/local/mcrypt-1.0.1/libtool --mode=link cc -DPHP_ATOM_INC -I/usr/local/mcrypt-1.0.1/include -I/usr/local/mcrypt-1.0.1/main -I/usr/local/mcrypt-1.0.1 -I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -o ./mcrypt.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/local/mcrypt-1.0.1/modules mcrypt.lo mcrypt_filter.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lmcrypt -lltdl
cc -shared .libs/mcrypt.o .libs/mcrypt_filter.o -L/usr/local/lib /usr/local/lib/libmcrypt.a /usr/local/lib/libltdl.a -Wl,-rpath -Wl,/usr/local/lib -Wl,-soname -Wl,mcrypt.so -o ./.libs/mcrypt.so
/usr/bin/ld: /usr/local/lib/libmcrypt.a(mcrypt_extra.o): relocation R_X86_64_32 against `mps' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libmcrypt.a: could not read symbols: Bad value
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

any ideas??
 
Please try the following before ./configure:
Code:
export CC=clang
export CPP=clang-cpp
export CXX=clang++
export WITH_LIBCPLUSPLUS=yes

If it doesn't help, please try using the following instead of just "make":
Code:
make CFLAGS=-fpic
 
Thank you for the response smtalk

didn't seem to help

[root@server /usr/local/mcrypt-1.0.1]# make && make install
/bin/sh /usr/local/mcrypt-1.0.1/libtool --mode=link clang -DPHP_ATOM_INC -I/usr/local/mcrypt-1.0.1/include -I/usr/local/mcrypt-1.0.1/main -I/usr/local/mcrypt-1.0.1 -I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -o ./mcrypt.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/local/mcrypt-1.0.1/modules mcrypt.lo mcrypt_filter.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lmcrypt -lltdl
clang -shared .libs/mcrypt.o .libs/mcrypt_filter.o -L/usr/local/lib /usr/local/lib/libmcrypt.a /usr/local/lib/libltdl.a -Wl,-rpath -Wl,/usr/local/lib -Wl,-soname -Wl,mcrypt.so -o ./.libs/mcrypt.so
/usr/bin/ld: /usr/local/lib/libmcrypt.a(mcrypt_extra.o): relocation R_X86_64_32 against `mps' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libmcrypt.a: could not read symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make: stopped in /usr/local/mcrypt-1.0.1
[root@server /usr/local/mcrypt-1.0.1]# make CFLAGS=-fpic
/bin/sh /usr/local/mcrypt-1.0.1/libtool --mode=link clang -DPHP_ATOM_INC -I/usr/local/mcrypt-1.0.1/include -I/usr/local/mcrypt-1.0.1/main -I/usr/local/mcrypt-1.0.1 -I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -fpic -o ./mcrypt.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/local/mcrypt-1.0.1/modules mcrypt.lo mcrypt_filter.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lmcrypt -lltdl
clang -shared .libs/mcrypt.o .libs/mcrypt_filter.o -L/usr/local/lib /usr/local/lib/libmcrypt.a /usr/local/lib/libltdl.a -Wl,-rpath -Wl,/usr/local/lib -Wl,-soname -Wl,mcrypt.so -o ./.libs/mcrypt.so
/usr/bin/ld: /usr/local/lib/libmcrypt.a(mcrypt_extra.o): relocation R_X86_64_32 against `mps' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libmcrypt.a: could not read symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make: stopped in /usr/local/mcrypt-1.0.1
[root@server /usr/local/mcrypt-1.0.1]#
 
Please execute "make clean" before another try to install it :) I thought you were going to execute all the commands again (including "rm -rf" of the folder, so I did not mention it in my initial reply).
 
hey smtalk , yeah i did that , just didn't want to bore you with all the output :)
 
[root@server /usr/local]# rm -rf mcrypt-1.0.1
[root@server /usr/local]# tar -zxvf mcrypt-*.tgz && cd mcrypt-*/
x package.xml
x mcrypt-1.0.1/tests/blowfish.phpt
x mcrypt-1.0.1/tests/bug35496.phpt
x mcrypt-1.0.1/tests/bug37595.phpt
x mcrypt-1.0.1/tests/bug41252.phpt
x mcrypt-1.0.1/tests/bug43143.phpt
x mcrypt-1.0.1/tests/bug46010.phpt
x mcrypt-1.0.1/tests/bug49738.phpt
x mcrypt-1.0.1/tests/bug55169.phpt
x mcrypt-1.0.1/tests/bug70625.phpt
x mcrypt-1.0.1/tests/bug8040.phpt
x mcrypt-1.0.1/tests/mcrypt_cbc_3des_decrypt.phpt
x mcrypt-1.0.1/tests/mcrypt_cbc_3des_encrypt.phpt
x mcrypt-1.0.1/tests/mcrypt_cbc.phpt
x mcrypt-1.0.1/tests/mcrypt_cfb.phpt
x mcrypt-1.0.1/tests/mcrypt_create_iv.phpt
x mcrypt-1.0.1/tests/mcrypt_decrypt_3des_cbc.phpt
x mcrypt-1.0.1/tests/mcrypt_decrypt_3des_ecb.phpt
x mcrypt-1.0.1/tests/mcrypt_decrypt_error.phpt
x mcrypt-1.0.1/tests/mcrypt_decrypt.phpt
x mcrypt-1.0.1/tests/mcrypt_decrypt_variation1.phpt
x mcrypt-1.0.1/tests/mcrypt_decrypt_variation2.phpt
x mcrypt-1.0.1/tests/mcrypt_decrypt_variation3.phpt
x mcrypt-1.0.1/tests/mcrypt_decrypt_variation4.phpt
x mcrypt-1.0.1/tests/mcrypt_decrypt_variation5.phpt
x mcrypt-1.0.1/tests/mcrypt_ecb_3des_decrypt.phpt
x mcrypt-1.0.1/tests/mcrypt_ecb_3des_encrypt.phpt
x mcrypt-1.0.1/tests/mcrypt_ecb.phpt
x mcrypt-1.0.1/tests/mcrypt_enc_get_algorithms_name.phpt
x mcrypt-1.0.1/tests/mcrypt_enc_get_block_size.phpt
x mcrypt-1.0.1/tests/mcrypt_enc_get_iv_size.phpt
x mcrypt-1.0.1/tests/mcrypt_enc_get_key_size.phpt
x mcrypt-1.0.1/tests/mcrypt_enc_get_mode_name.phpt
x mcrypt-1.0.1/tests/mcrypt_enc_get_supported_key_sizes.phpt
x mcrypt-1.0.1/tests/mcrypt_enc_is_block_algorithm_mode.phpt
x mcrypt-1.0.1/tests/mcrypt_enc_is_block_algorithm.phpt
x mcrypt-1.0.1/tests/mcrypt_enc_is_block_mode.phpt
x mcrypt-1.0.1/tests/mcrypt_encrypt_3des_cbc.phpt
x mcrypt-1.0.1/tests/mcrypt_encrypt_3des_ecb.phpt
x mcrypt-1.0.1/tests/mcrypt_encrypt_error.phpt
x mcrypt-1.0.1/tests/mcrypt_encrypt_variation1.phpt
x mcrypt-1.0.1/tests/mcrypt_encrypt_variation2.phpt
x mcrypt-1.0.1/tests/mcrypt_encrypt_variation3.phpt
x mcrypt-1.0.1/tests/mcrypt_encrypt_variation4.phpt
x mcrypt-1.0.1/tests/mcrypt_encrypt_variation5.phpt
x mcrypt-1.0.1/tests/mcrypt_enc_self_test.phpt
x mcrypt-1.0.1/tests/mcrypt_filters.phpt
x mcrypt-1.0.1/tests/mcrypt_get_block_size.phpt
x mcrypt-1.0.1/tests/mcrypt_get_cipher_name.phpt
x mcrypt-1.0.1/tests/mcrypt_get_iv_size.phpt
x mcrypt-1.0.1/tests/mcrypt_get_key_size.phpt
x mcrypt-1.0.1/tests/mcrypt_list_algorithms.phpt
x mcrypt-1.0.1/tests/mcrypt_list_modes.phpt
x mcrypt-1.0.1/tests/mcrypt_module_get_algo_block_size.phpt
x mcrypt-1.0.1/tests/mcrypt_module_get_algo_key_size.phpt
x mcrypt-1.0.1/tests/mcrypt_module_get_supported_key_sizes.phpt
x mcrypt-1.0.1/tests/mcrypt_module_is_block_algorithm_mode.phpt
x mcrypt-1.0.1/tests/mcrypt_module_is_block_algorithm.phpt
x mcrypt-1.0.1/tests/mcrypt_module_is_block_mode.phpt
x mcrypt-1.0.1/tests/mcrypt_module_open.phpt
x mcrypt-1.0.1/tests/mcrypt_module_self_test.phpt
x mcrypt-1.0.1/tests/mcrypt_ofb.phpt
x mcrypt-1.0.1/tests/mcrypt_rijndael128_128BitKey.phpt
x mcrypt-1.0.1/tests/mcrypt_rijndael128_256BitKey.phpt
x mcrypt-1.0.1/tests/vectors.txt
x mcrypt-1.0.1/config.m4
x mcrypt-1.0.1/config.w32
x mcrypt-1.0.1/mcrypt.c
x mcrypt-1.0.1/mcrypt_filter.c
x mcrypt-1.0.1/php_mcrypt.h
x mcrypt-1.0.1/php_mcrypt_filter.h
x mcrypt-1.0.1/LICENSE
[root@server /usr/local/mcrypt-1.0.1]# /usr/local/php72/bin/phpize
Configuring for:
PHP Api Version: 20170718
Zend Module Api No: 20170718
Zend Extension Api No: 320170718
[root@server /usr/local/mcrypt-1.0.1]# ./configure --with-php-config=/usr/local/php72/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang-cpp
checking for icc... no
checking for suncc... no
checking whether clang and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-freebsd11.2
checking host system type... x86_64-unknown-freebsd11.2
checking target system type... x86_64-unknown-freebsd11.2
checking for PHP prefix... /usr/local/php72
checking for PHP includes... -I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718
checking for PHP installed headers prefix... /usr/local/php72/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for mcrypt support... yes, shared
checking for libmcrypt version... >= 2.5.6
checking for mcrypt_module_open in -lmcrypt... yes
checking for ld used by clang... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/local/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/local/bin/nm -B output from clang object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if clang supports -fno-rtti -fno-exceptions... yes
checking for clang option to produce PIC... -fPIC
checking if clang PIC flag -fPIC works... yes
checking if clang static flag -static works... yes
checking if clang supports -c -o file.o... yes
checking whether the clang linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... freebsd11.2 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... no
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
checking whether the clang++ linker (/usr/bin/ld) supports shared libraries... yes
checking for clang++ option to produce PIC...
checking if clang++ static flag works... yes
checking if clang++ supports -c -o file.o... yes
checking whether the clang++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd11.2 ld.so
(cached) (cached) checking how to hardcode library paths into programs... unsupported
configure: creating ./config.status
config.status: creating config.h
[root@server /usr/local/mcrypt-1.0.1]# make CFLAGS=-fpic
/bin/sh /usr/local/mcrypt-1.0.1/libtool --mode=compile clang -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/usr/local/mcrypt-1.0.1 -DPHP_ATOM_INC -I/usr/local/mcrypt-1.0.1/include -I/usr/local/mcrypt-1.0.1/main -I/usr/local/mcrypt-1.0.1 -I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -fpic -c /usr/local/mcrypt-1.0.1/mcrypt.c -o mcrypt.lo
mkdir .libs
clang -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/usr/local/mcrypt-1.0.1 -DPHP_ATOM_INC -I/usr/local/mcrypt-1.0.1/include -I/usr/local/mcrypt-1.0.1/main -I/usr/local/mcrypt-1.0.1 -I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -fpic -c /usr/local/mcrypt-1.0.1/mcrypt.c -fPIC -DPIC -o .libs/mcrypt.o
/bin/sh /usr/local/mcrypt-1.0.1/libtool --mode=compile clang -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/usr/local/mcrypt-1.0.1 -DPHP_ATOM_INC -I/usr/local/mcrypt-1.0.1/include -I/usr/local/mcrypt-1.0.1/main -I/usr/local/mcrypt-1.0.1 -I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -fpic -c /usr/local/mcrypt-1.0.1/mcrypt_filter.c -o mcrypt_filter.lo
clang -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/usr/local/mcrypt-1.0.1 -DPHP_ATOM_INC -I/usr/local/mcrypt-1.0.1/include -I/usr/local/mcrypt-1.0.1/main -I/usr/local/mcrypt-1.0.1 -I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -fpic -c /usr/local/mcrypt-1.0.1/mcrypt_filter.c -fPIC -DPIC -o .libs/mcrypt_filter.o
/bin/sh /usr/local/mcrypt-1.0.1/libtool --mode=link clang -DPHP_ATOM_INC -I/usr/local/mcrypt-1.0.1/include -I/usr/local/mcrypt-1.0.1/main -I/usr/local/mcrypt-1.0.1 -I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -fpic -o ./mcrypt.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/local/mcrypt-1.0.1/modules mcrypt.lo mcrypt_filter.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lmcrypt -lltdl
clang -shared .libs/mcrypt.o .libs/mcrypt_filter.o -L/usr/local/lib /usr/local/lib/libmcrypt.a /usr/local/lib/libltdl.a -Wl,-rpath -Wl,/usr/local/lib -Wl,-soname -Wl,mcrypt.so -o ./.libs/mcrypt.so
/usr/bin/ld: /usr/local/lib/libmcrypt.a(mcrypt_extra.o): relocation R_X86_64_32 against `mps' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libmcrypt.a: could not read symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make: stopped in /usr/local/mcrypt-1.0.1
 
Last edited:
Ah, sorry, I did not pay a lot of attention to the output of the error :) It seems you have problems with libmcrypt, thus mcrypt extension compilation fails. Please try reinstalling libmcrypt with -fPIC.
 
hmmm strange, just the default install from ports... ok i'll check it out ty
 
You may just try the following in libmcrypt extracted folder:
Code:
./configure --disable-posix-threads --with-pic
make
make install
 
ok mate i'll do some more testing and get back to you ty again :)
 
Back
Top