今天编译一个软件 被搞死了的搞
Aug 21st, 2009 by song

首先提示是语法错误 AC_MSG_ERROR
搜了半天没啥有用的信息
后来才发现 我用的 automake1.0
执行
sudo port -v install automake
安装了一个1.1的 OK了
但是在 /opt/local/bin
最傻的替换法把所有 /usr/bin 里面 automake autoreconf autoheader 等 rename为 *.bak
后来发现 aclocal 导致版本错误
找不到 openssl 明明有装
在这里最好的方法就是 export PATH=/opt/local/bin:$PATH
现在继续出现错误
../../../dep/ACE_wrappers/configure: line 35635: syntax error near unexpected token `fi’
../../../dep/ACE_wrappers/configure: line 35635: `fi’
现在从新
[code]cd build
autoreconf -vif ..

../configure --prefix=/usr/local --datadir=/usr/local/share --sysconfdir=/usr/local/etc --enable-cli --enable-ra LIBS="-lcrypto" CFLAGS="-O2" CXXFLAGS="-O2"
[/code]
[code]
if ac_fn_cxx_try_compile "$LINENO"; then :

                 if test "$ace_user_enable_reentrant_funcs" = yes; then
                   $as_echo "#define ACE_HAS_POSIX_GETPWNAM_R 1" >>confdefs.h

                 fi

#else 注释掉这句继续


fi[/code]

整了半天又下载心的 ACE还是不行
继续中

一个make 说明 记录下免得忘了
Aug 21st, 2009 by song

Compiling For Multiple Architectures
====================================

  You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory.  To do this, you can use GNU `make’.  `cd’ to the
directory where you want the object files and executables to go and run
the `configure’ script.  `configure’ automatically checks for the
source code in the directory that `configure’ is in and in `..’.

  With a non-GNU `make’, it is safer to compile the package for one
architecture at a time in the source code directory.  After you have
installed the package for one architecture, use `make distclean’ before
reconfiguring for another architecture.

  On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types–known as “fat” or
“universal” binaries–by specifying multiple `-arch’ options to the
compiler but only a single `-arch’ option to the preprocessor.  Like
this:

    ./configure CC=”gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64″ \
                CXX=”g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64″ \
                CPP=”gcc -E” CXXCPP=”g++ -E”

  This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo’ tool if you have problems.

Installation Names
==================

  By default, `make install’ installs the package’s commands under
`/usr/local/bin’, include files under `/usr/local/include’, etc.  You
can specify an installation prefix other than `/usr/local’ by giving
`configure’ the option `–prefix=PREFIX’.

  You can specify separate installation prefixes for
architecture-specific files and architecture-independent files.  If you
pass the option `–exec-prefix=PREFIX’ to `configure’, the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.

  In addition, if you use an unusual directory layout you can give
options like `–bindir=DIR’ to specify different values for particular
kinds of files.  Run `configure –help’ for a list of the directories
you can set and what kinds of files go in them.

  If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure’ the
option `–program-prefix=PREFIX’ or `–program-suffix=SUFFIX’.

Optional Features

mangos mac os patch change
Aug 19th, 2009 by song

默认官方有一个错误
修改了下
[code]diff --git a/src/framework/Platform/CompilerDefs.h b/src/framework/Platform/CompilerDefs.h
index e835491..011035f 100644
--- a/src/framework/Platform/CompilerDefs.h
+++ b/src/framework/Platform/CompilerDefs.h
@@ -29,7 +29,9 @@
#  define PLATFORM PLATFORM_WINDOWS
#elif defined( __WIN32__ ) || defined( WIN32 ) || defined( _WIN32 )
#  define PLATFORM PLATFORM_WINDOWS
-#elif defined( __APPLE_CC__ )
+// Use appropriate macros as suggested by Apple.
+// http://developer.apple.com/technotes/tn2002/tn2071.html#Section10
+#elif defined( __APPLE__ ) && defined( __MACH__ )
#  define PLATFORM PLATFORM_APPLE
#elif defined( __INTEL_COMPILER )
#  define PLATFORM PLATFORM_INTEL
diff --git a/src/framework/Platform/Define.h b/src/framework/Platform/Define.h
index 8318493..7263beb 100644
--- a/src/framework/Platform/Define.h
+++ b/src/framework/Platform/Define.h
@@ -53,14 +53,21 @@
#  define MANGOS_LOAD_LIBRARY(a) dlopen(a,RTLD_NOW)
#  define MANGOS_CLOSE_LIBRARY dlclose
#  define MANGOS_GET_PROC_ADDR dlsym
-#  if defined(__APPLE_CC__) && defined(BIG_ENDIAN)
+// longcall calling convention is only supported on Big Endian (non-intel) compilers
+// BIG_ENDIAN can be defined on some Macs, but set to 0!
+#  if MANGOS_ENDIAN == MANGOS_BIGENDIAN
#    define MANGOS_IMPORT __attribute__ ((longcall))
#  elif defined(__x86_64__)
#    define MANGOS_IMPORT
#  else
#    define MANGOS_IMPORT __attribute__ ((cdecl))
-#  endif //__APPLE_CC__ && BIG_ENDIAN
-#  define MANGOS_SCRIPT_EXT ".so"
+#  endif //MANGOS_IMPORT
+// OS X uses .dylib as the dynamic library file name suffix
+#  if PLATFORM == PLATFORM_APPLE
+#    define MANGOS_SCRIPT_EXT ".dylib"
+#  else //PLATFORM != PLATFORM_APPLE
+#    define MANGOS_SCRIPT_EXT ".so"
+#  endif //MANGOS_SCRIPT_EXT
#  define MANGOS_SCRIPT_NAME "libmangosscript"
#  define MANGOS_PATH_MAX PATH_MAX
#endif //PLATFORM
diff --git a/src/game/ScriptCalls.cpp b/src/game/ScriptCalls.cpp
index adbdcb1..4a3f146 100644
--- a/src/game/ScriptCalls.cpp
+++ b/src/game/ScriptCalls.cpp
@@ -47,6 +47,19 @@ bool LoadScriptingModule(char const* libName)

    testScript->hScriptsLib=MANGOS_LOAD_LIBRARY(name.c_str());

+// OSX: Hack for people who install into /opt but don't add it to their paths
+#if PLATFORM == PLATFORM_APPLE
+    if(!testScript->hScriptsLib )
+    {
+        // Library was not found within standard dynamic loader search paths
+        // $HOME/lib; /usr/local/lib; /usr/lib
+        // Try relative path instead for those who install into non-standard directory
+        std::string fullPath = "@executable_path/../lib/";
+        fullPath += name;
+        testScript->hScriptsLib=MANGOS_LOAD_LIBRARY(fullPath.c_str());
+    }
+#endif
+
    if(!testScript->hScriptsLib )
    {
        printf("Error loading Scripts Library %s !\n",name.c_str());
diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp
index 5e7c05d..2be7967 100644
--- a/src/mangosd/CliRunnable.cpp
+++ b/src/mangosd/CliRunnable.cpp
@@ -266,7 +266,7 @@ bool ChatHandler::HandleServerSetLogLevelCommand(const char *args)

/// @}

-#ifdef linux
+#if defined( linux ) || PLATFORM == PLATFORM_APPLE
// Non-blocking keypress detector, when return pressed, return 1, else always return 0
int kb_hit_return()
{
@@ -303,7 +303,7 @@ void CliRunnable::run()
    while (!World::IsStopped())
    {
        fflush(stdout);
-        #ifdef linux
+        #if defined( linux ) || PLATFORM == PLATFORM_APPLE
        while (!kb_hit_return() && !World::IsStopped())
            // With this, we limit CLI to 10commands/second
            usleep(100);
diff --git a/src/shared/Threading.cpp b/src/shared/Threading.cpp
index 496e863..e74b12e 100644
--- a/src/shared/Threading.cpp
+++ b/src/shared/Threading.cpp
@@ -222,7 +222,8 @@
    int _priority = m_TpEnum.getPriority(type);
    int _ok = ACE_Thread::setprio(m_hThreadHandle, _priority);
    //remove this ASSERT in case you don't want to know is thread priority change was successful or not
-    ASSERT (_ok == 0);
+    //OS X Hack: ASSERT is raised and prevents worldd from executing
+  //ASSERT (_ok == 0);
}

void Thread::Sleep(unsigned long msecs)
[/code]

SIDEBAR
»
S
I
D
E
B
A
R
«
»  Substance:WordPress   »