【问题标题】:Can't make REDIS 2.8.19 on AIX 6.1 and GCC无法在 AIX 6.1 和 GCC 上制作 REDIS 2.8.19
【发布时间】:2015-03-19 20:15:58
【问题描述】:

我正在尝试使用 gcc 在 AIX 6.1 机器上编译 redis-2.8.19 标记上的代码。

我解压缩文件,然后启动以下命令:

gmake distclean; CC=`which gcc` gmake -j

我尝试了使用和不使用 -j 标志,结果相同:

[...after lots of warnings and compiler messages...]

LINK redis-server
INSTALL redis-sentinel
find: 0652-019 The status on redis-sentinel is not valid.
install: 0653-233 File redis-server was not found.
gmake[1]: **** [redis-sentinel] Error 2
gmake[1]: Leaving directory '/users/carlos/redis/redis-2.8.19/src'
gmake: **** [all] Error 2`

但是如果你检查 src 目录,你会看到 redis-server 文件就在那里:

 ll redis-server
 -rwxr-xr-x    1 ta_des   gitgrp      3179825 Jan 20 12:37 redis-server

知道发生了什么吗?还是我应该做点别的?

卡洛斯

【问题讨论】:

  • 我还没有构建 redis(但我确实在 AIX 上构建了很多开源包)。通常在 make 文件中有一种方法可以让它输出正在执行的实际命令。我会看看“安装”实际上是在做什么。将其捕获到可以重复执行的脚本中,然后慢慢调试脚本。
  • 感谢 pedz 的提示,我会尝试的。让我们看看这个脚本里面有什么。

标签: gcc redis aix


【解决方案1】:

我最近在 AIX 上编译了 Redis,并且不得不修复几个构建问题,但最终结果(到目前为止)对于我们的目的来说工作正常。

这是我想出的脚本。 之后一项测试失败(我们可以忍受),请参阅redis 2.8.19 on AIX: BRPOPLPUSH does not affect WATCH

#!/usr/bin/env bash
#
# GccCompileRedis
# Compile redis from source, on AIX.
# 64 bit, compiled with references to our standard paths including /opt/freeware/lib64
# TW 2014 Q1
#

# Check for root user, exit hard if not
#
if [ `whoami` != "root" ] ; then
  echo "You must run this script as root. sudo -E is allowed (to do the build in your HOME dir)."
  exit 1
fi

lclRedisVersion=$1

if [ "${lclRedisVersion}" == "" ]
then
  echo "Supply a redis version, for example \"2.8.19\""
  exit 1
fi

lclAborted=0
lclMake=/usr/bin/gmake

if [ $lclAborted == 0 ]
then
  clear
  pwd
  echo
  echo This script does a $lclMake of redis ${lclRedisVersion} \(from source, including download\).
  echo Build dir \(automatically created\): /home/${LOGIN}/src/redis-${lclRedisVersion}
  echo Info: Everything is deleted and re-downloaded. Continue? To abort: Ctrl+C.
  echo
  read -sn 1 -p "Press any key to continue..." ; echo
  lclAborted=$?
fi

if [ $lclAborted == 0 ]
then
  mkdir /home/${LOGIN}/src >/dev/null 2>&1
  cd /home/${LOGIN}/src
  rm redis-${lclRedisVersion}.tar.gz >/dev/null 2>&1
  rm redis-${lclRedisVersion}.tar >/dev/null 2>&1
  rm -rf redis-${lclRedisVersion} >/dev/null 2>&1
  wget http://download.redis.io/releases/redis-${lclRedisVersion}.tar.gz
  gunzip redis-${lclRedisVersion}.tar.gz
  tar -xf redis-${lclRedisVersion}.tar
  cd /home/${LOGIN}/src/redis-${lclRedisVersion}
  echo
  pwd
  echo
  echo Run make via $lclMake ?
  echo
  read -sn 1 -p "Press any key to continue..." ; echo
  lclAborted=$?
fi

if [ $lclAborted == 0 ]
then
  clear
  echo Make...
  echo "redis-sentinel errors will be fixed, look at end result." > make_${lclRedisVersion}.log 2>&1
  echo >> make_${lclRedisVersion}.log 2>&1

  # Not a clue how redis-sentinel binary is produced. On linux redis-server and redis-sentinel are byte-identical or hardlinked.
  # So we first build redis-server, and then do a simple cp -p to redis-sentinel, afterwards continue the make.

  # First only: redis-server
  $SCRIPTS/GccEnvironment $lclMake V=1 redis-server >> make_${lclRedisVersion}.log 2>&1
  tail -n14 make_${lclRedisVersion}.log

  # Then: redis-sentinel
  $SCRIPTS/GccEnvironment $lclMake V=1 redis-sentinel >> make_${lclRedisVersion}.log 2>&1

  # If fail, just copy redis-server binary
  if [ -f "src/redis-server" -a ! -f "src/redis-sentinel" ]
  then
    echo "FIX: Make a copy of redis-server to fix a missing redis-sentinel." >> make_${lclRedisVersion}.log 2>&1
    cp -p "src/redis-server" "src/redis-sentinel" >> make_${lclRedisVersion}.log 2>&1
  fi

  # Build the rest
  $SCRIPTS/GccEnvironment $lclMake V=1 redis-cli >> make_${lclRedisVersion}.log 2>&1
  $SCRIPTS/GccEnvironment $lclMake V=1 redis-benchmark >> make_${lclRedisVersion}.log 2>&1
  $SCRIPTS/GccEnvironment $lclMake V=1 redis-check-dump >> make_${lclRedisVersion}.log 2>&1
  $SCRIPTS/GccEnvironment $lclMake V=1 redis-check-aof >> make_${lclRedisVersion}.log 2>&1

  tail -n14 make_${lclRedisVersion}.log
  echo
  echo 'You can run the tests at this point, if you wish. Instructions:'
  echo '  >sudo -i'
  echo '  >. /etc/profile'
  echo "  >cd /home/tw/src/redis-${lclRedisVersion}"
  echo '  >. $SCRIPTS/GccEnvironment'
  echo '  >./runtest'
  echo 'Note1: tcl must be installed. Check with which tclsh. Perzl package available.'
  echo 'Note2: On 2015-01-12, we had one failing test: "BRPOPLPUSH does not affect WATCH while still blocked".'
  echo '       See: https://groups.google.com/forum/#!topic/redis-db/8nboMaWfiEU'
  echo
  echo 'make install does not work on AIX. Do you want to let this script copy the binaries and make symbolic links?'
  echo
  read -sn 1 -p "Press any key to continue..." ; echo
  lclAborted=$?
fi

if [ $lclAborted == 0 ]
then
  sudo -E slibclean
  clear
  rm -rf /opt/freeware/redis-${lclRedisVersion} >/dev/null 2>&1
  mkdir /opt/freeware/redis-${lclRedisVersion}

  cp -p /home/${LOGIN}/src/redis-${lclRedisVersion}/src/redis-server        /opt/freeware/redis-${lclRedisVersion}/ 
  cp -p /home/${LOGIN}/src/redis-${lclRedisVersion}/src/redis-sentinel      /opt/freeware/redis-${lclRedisVersion}/ 
  cp -p /home/${LOGIN}/src/redis-${lclRedisVersion}/src/redis-cli           /opt/freeware/redis-${lclRedisVersion}/ 
  cp -p /home/${LOGIN}/src/redis-${lclRedisVersion}/src/redis-benchmark     /opt/freeware/redis-${lclRedisVersion}/ 
  cp -p /home/${LOGIN}/src/redis-${lclRedisVersion}/src/redis-check-dump    /opt/freeware/redis-${lclRedisVersion}/ 
  cp -p /home/${LOGIN}/src/redis-${lclRedisVersion}/src/redis-check-aof     /opt/freeware/redis-${lclRedisVersion}/
  cp -p /home/${LOGIN}/src/redis-${lclRedisVersion}/redis.conf              /opt/freeware/redis-${lclRedisVersion}/
  cp -p /home/${LOGIN}/src/redis-${lclRedisVersion}/sentinel.conf           /opt/freeware/redis-${lclRedisVersion}/
  cp -p /home/${LOGIN}/src/redis-${lclRedisVersion}/utils/install_server.sh /opt/freeware/redis-${lclRedisVersion}/
  ln -sf /opt/freeware/redis-${lclRedisVersion}/redis-server                 /usr/bin/redis-server     
  ln -sf /opt/freeware/redis-${lclRedisVersion}/redis-sentinel               /usr/bin/redis-sentinel   
  ln -sf /opt/freeware/redis-${lclRedisVersion}/redis-cli                    /usr/bin/redis-cli        
  ln -sf /opt/freeware/redis-${lclRedisVersion}/redis-benchmark              /usr/bin/redis-benchmark  
  ln -sf /opt/freeware/redis-${lclRedisVersion}/redis-check-dump             /usr/bin/redis-check-dump 
  ln -sf /opt/freeware/redis-${lclRedisVersion}/redis-check-aof              /usr/bin/redis-check-aof

  echo 'Done: Binaries are copied, symbolic links are made.'

  read -sn 1 -p "Press any key to continue..." ; echo
  lclAborted=$?
fi

if [ $lclAborted == 0 ]
then 
  echo $0 has finished.
else
  echo $0 was aborted.
fi

#EOF

GccEnvironment 做了这样的事情:

echo Calling slibclean, to prevent file-in-use issues
sudo -E slibclean
echo Done with slibclean

alias make="gmake"

export CC=gcc
export CFLAGS="-maix64 -O2 -D_AIX -D_AIX53 -D_AIX61 -D_AIX71 -I/opt/freeware/include -I/usr/include${CFLAGS_XTRA}"
export CXX=g++
export CXXFLAGS=$CFLAGS
export LDFLAGS="-maix64 -L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib/pthread/ppc64:/opt/freeware/lib:/usr/lib:/lib,-bmaxdata:0x80000000"

export AR="ar -X64"
export LIBPATH=.:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib
export OBJECT_MODE=64
echo Gcc environment variables \(CC,CFLAGS,LDFLAGS,LIBPATH,etc\) are set.

if [ "$1" != "--noexec" ]
then
exec "$@"
fi

echo GccEnvironment has finished.

希望这会有所帮助,TW

【讨论】:

  • 嘿,我遇到了一些麻烦......现在我在制作 redis 服务器时遇到了这个错误:/tmp//cciyYokl.s: line 14078: 1252-149 Instruction fsel is not implemented in the current assembly mode PPC64.。命令行如下:gcc -std=c99 -pedantic -Wall -W -O2 -g -ggdb -maix64 -O3 -ffast-math -D_AIX -D_AIX53 -D_AIX61 -I/opt/freeware/include -I/usr/include -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -c t_zset.c。而 GCC 版本是 4.4.6,我认为这是问题的根源。有什么想法吗?
  • 你好!我不得不稍微修改你的脚本,但终于让它工作了!问题出在 gcc 标志上。 Redis 放置了自己的标志,而您的脚本正在干扰它们。具体来说,我必须将 CFLAGSvariable 更改为以下内容:export CFLAGS="-maix64 -D_AIX -D_AIX53 -D_AIX61 -I/opt/freeware/include -I/usr/include${CFLAGS_XTRA}" -O3 干扰了 -O2 并且 -ffast-math 使 fsel 指令(浮点)不可用,并且不应与任何-O(根据gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Optimize-Options.html)非常感谢!
  • 顺便说一句,它修复了 BRPOPLPUSH 的错误,但与复制有关的错误:[exception]: Executing test client: NOREPLICAS Not enough good slaves to write.. NOREPLICAS Not enough good slaves to write.
  • @cdelgado 我通过删除 -ffast-math 更新了我的答案。旁注:我没有遇到缺少的 fsel 指令,并且在重建后,我仍然在 BRPOPLPUSH 上出现错误,并且我没有收到 NOREPLICAS 消息。可能是因为我在 AIX7.1 上,而你在 AIX6.1 上。对我们来说这不是什么大问题。
猜你喜欢
  • 2013-04-09
  • 2011-10-14
  • 2011-12-10
  • 2013-03-11
  • 2015-05-29
  • 2014-01-26
  • 2012-02-16
  • 2012-12-21
  • 2014-10-13
相关资源
最近更新 更多