简体   繁体   English

尝试在Mac OS X上编译基于Linux的应用程序

[英]Trying to compile a linux-based app on Mac OS X

I'm just trying to compile the linux-based FCEUX (NES emulator) on my mac, OS X 10.5 Leopard. 我只是想在我的Mac OS X 10.5 Leopard上编译基于Linux的FCEUX(NES模拟器)。

I got all the dependencies (SDL, GTK+ 2) going and everything but of all things this is now my problem: 我得到了所有的依赖项(SDL,GTK + 2),但除了所有这些以外,现在都是我的问题:

Undefined symbols: 
"_compress", referenced from: SaveSnapshot() in video.o
"_gzclose", referenced from: FCEU_fopen(char const*, char const*, char*, char*, int, char const**)in file.o
"_crc32", referenced from: CalcCRC32(unsigned int, unsigned char*, unsigned int)in crc32.o
_unzReadCurrentFile in unzip.o _unzReadCurrentFile in unzip.o
"_uncompress", referenced from: NetplayUpdate(unsigned char*)in netplay.o FCEUSS_LoadFP(EMUFILE*, ENUM_SSLOADPARAMS) in state.o
"_compress2", referenced from: FCEUNET_SendFile(unsigned char, char*)in netplay.o FCEUSS_SaveMS(EMUFILE*, int) in state.o
"_inflateEnd", referenced from: _unzCloseCurrentFile in unzip.o
"_inflate", referenced from: _unzReadCurrentFile in unzip.o
"inflateInit2", referenced from: _unzOpenCurrentFile in unzip.o
"_gzgetc", referenced from: FCEU_fopen(char const*, char const*, char*, char*, int, char const**)in file.o
"_gzopen", referenced from: FCEU_fopen(char const*, char const*, char*, char*, int, char const**)in file.o
"_gzread", referenced from: FCEU_fopen(char const*, char const*, char*, char*, int, char const**)in file.o
"_gzseek", referenced from: FCEU_fopen(char const*, char const*, char*, char*, int, char const*)in file.o 
ld: symbol(s) not found collect2: ld returned 1 exit status
scons: ** [src/fceux] Error 1 scons: building terminated because of errors.

Those are zlib functions. 这些是zlib函数。 It seems like it is loading the zlib.h ok, but the symbols aren't being linked in? 好像正在加载zlib.h好的,但是没有链接符号吗? Just to make sure I downloaded the latest zlib and did a make install, no help. 只是为了确保我下载了最新的zlib并进行了make安装,没有帮助。 I have no clue what's going on here, it seems like it should be pretty basic, that library is nothing special. 我不知道这里发生了什么,似乎应该很基本,这个库没什么特别的。 Help would be appreciated. 帮助将不胜感激。 Thanks. 谢谢。

EDIT: Here is the link list: 编辑:这是链接列表:

    scons: done reading SConscript files.
    scons: Building targets ...
    g++ -o src/fceux -Wl,-framework,Cocoa src/asm.o src/cart.o src/cheat.o src/conddebug.o src/config.o src/debug.o src/drawing.o src/emufile.o src/fceu.o src/fds.o src/file.o src/filter.o src/ines.o src/input.o src/netplay.o src/nsf.o src/oldmovie.o src/palette.o src/ppu.o src/sound.o src/state.o src/unif.o src/video.o src/vsuni.o src/wave.o src/x6502.o src/movie.o src/lua-engine.o src/boards/01-222.o src/boards/103.o src/boards/106.o src/boards/108.o src/boards/112.o src/boards/117.o src/boards/120.o src/boards/121.o src/boards/15.o src/boards/164.o src/boards/175.o src/boards/176.o src/boards/177.o src/boards/178.o src/boards/179.o src/boards/183.o src/boards/185.o src/boards/186.o src/boards/187.o src/boards/189.o src/boards/199.o src/boards/208.o src/boards/222.o src/boards/23.o src/boards/235.o src/boards/253.o src/boards/3d-block.o src/boards/411120-c.o src/boards/43.o src/boards/57.o src/boards/603-5052.o src/boards/68.o src/boards/8157.o src/boards/8237.o src/boards/830118C.o src/boards/88.o src/boards/90.o src/boards/95.o src/boards/a9711.o src/boards/a9746.o src/boards/addrlatch.o src/boards/ax5705.o src/boards/bandai.o src/boards/bmc13in1jy110.o src/boards/bmc42in1r.o src/boards/bmc64in1nr.o src/boards/bmc70in1.o src/boards/bonza.o src/boards/bs-5.o src/boards/copyfami_mmc3.o src/boards/dance.o src/boards/datalatch.o src/boards/deirom.o src/boards/dream.o src/boards/__dummy_mapper.o src/boards/edu2000.o src/boards/fk23c.o src/boards/ghostbusters63in1.o src/boards/gs-2004.o src/boards/gs-2013.o src/boards/h2288.o src/boards/karaoke.o src/boards/kof97.o src/boards/konami-qtai.o src/boards/ks7032.o src/boards/malee.o src/boards/mmc1.o src/boards/mmc3.o src/boards/mmc5.o src/boards/n-c22m.o src/boards/n106.o src/boards/n625092.o src/boards/novel.o src/boards/sachen.o src/boards/sc-127.o src/boards/sheroes.o src/boards/sl1632.o src/boards/smb2j.o src/boards/subor.o src/boards/super24.o src/boards/supervision.o src/boards/t-227-1.o src/boards/t-262.o src/boards/tengen.o src/boards/tf-1201.o src/drivers/common/args.o src/drivers/common/cheat.o src/drivers/common/config.o src/drivers/common/hq2x.o src/drivers/common/hq3x.o src/drivers/common/scale2x.o src/drivers/common/scale3x.o src/drivers/common/scalebit.o src/drivers/common/vidblit.o src/drivers/common/configSys.o src/drivers/common/nes_ntsc.o src/input/arkanoid.o src/input/bworld.o src/input/cursor.o src/input/fkb.o src/input/ftrainer.o src/input/hypershot.o src/input/mahjong.o src/input/mouse.o src/input/oekakids.o src/input/powerpad.o src/input/quiz.o src/input/shadow.o src/input/suborkb.o src/input/toprider.o src/input/zapper.o src/utils/crc32.o src/utils/endian.o src/utils/general.o src/utils/guid.o src/utils/md5.o src/utils/memory.o src/utils/unzip.o src/utils/xstring.o src/mappers/151.o src/mappers/16.o src/mappers/17.o src/mappers/18.o src/mappers/193.o src/mappers/201.o src/mappers/202.o src/mappers/203.o src/mappers/204.o src/mappers/212.o src/mappers/213.o src/mappers/214.o src/mappers/215.o src/mappers/217.o src/mappers/21.o src/mappers/225.o src/mappers/227.o src/mappers/228.o src/mappers/229.o src/mappers/22.o src/mappers/230.o src/mappers/231.o src/mappers/232.o src/mappers/234.o src/mappers/241.o src/mappers/242.o src/mappers/244.o src/mappers/246.o src/mappers/24and26.o src/mappers/255.o src/mappers/25.o src/mappers/27.o src/mappers/32.o src/mappers/33.o src/mappers/40.o src/mappers/41.o src/mappers/42.o src/mappers/46.o src/mappers/50.o src/mappers/51.o src/mappers/59.o src/mappers/60.o src/mappers/61.o src/mappers/62.o src/mappers/65.o src/mappers/67.o src/mappers/69.o src/mappers/6.o src/mappers/71.o src/mappers/72.o src/mappers/73.o src/mappers/75.o src/mappers/76.o src/mappers/77.o src/mappers/79.o src/mappers/80.o src/mappers/82.o src/mappers/83.o src/mappers/85.o src/mappers/86.o src/mappers/89.o src/mappers/8.o src/mappers/91.o src/mappers/92.o src/mappers/97.o src/mappers/99.o src/mappers/emu2413.o src/mappers/mmc2and4.o src/mappers/simple.o src/lua/src/lapi.o src/lua/src/lauxlib.o src/lua/src/lbaselib.o src/lua/src/lcode.o src/lua/src/ldblib.o src/lua/src/ldebug.o src/lua/src/ldo.o src/lua/src/ldump.o src/lua/src/lfunc.o src/lua/src/lgc.o src/lua/src/linit.o src/lua/src/liolib.o src/lua/src/llex.o src/lua/src/lmathlib.o src/lua/src/lmem.o src/lua/src/loadlib.o src/lua/src/lobject.o src/lua/src/lopcodes.o src/lua/src/loslib.o src/lua/src/lparser.o src/lua/src/lstate.o src/lua/src/lstring.o src/lua/src/lstrlib.o src/lua/src/ltable.o src/lua/src/ltablib.o src/lua/src/ltm.o src/lua/src/lundump.o src/lua/src/lvm.o src/lua/src/lzio.o src/lua/src/print.o src/drivers/sdl/input.o src/drivers/sdl/config.o src/drivers/sdl/sdl.o src/drivers/sdl/sdl-joystick.o src/drivers/sdl/sdl-sound.o src/drivers/sdl/sdl-throttle.o src/drivers/sdl/sdl-video.o src/drivers/sdl/unix-netplay.o 
-L/usr/local/lib
-lgtk-quartz-2.0
-lgdk-quartz-2.0
-latk-1.0
-lgio-2.0
-lgdk_pixbuf-2.0
-lpangocairo-1.0
-lpango-1.0
-lcairo
-lgobject-2.0
-lgmodule-2.0
-lgthread-2.0
-lglib-2.0
-lintl
-lSDLmain
-lSDL

SConstruct file: SConstruct文件:

import os
import sys
import platform 

opts = Variables()
opts.AddVariables(
  BoolVariable('FRAMESKIP', 'Enable frameskipping', 1),
  BoolVariable('OPENGL',    'Enable OpenGL support', 1),
  BoolVariable('LSB_FIRST', 'Least signficant byte first (non-PPC)', 1),
  BoolVariable('DEBUG',     'Build with debugging symbols', 1),
  BoolVariable('LUA',       'Enable Lua support', 1),
  BoolVariable('NEWPPU',    'Enable new PPU core', 1),
  BoolVariable('CREATE_AVI', 'Enable avi creation support (SDL only)', 0),
  BoolVariable('LOGO', 'Enable a logoscreen when creating avis (SDL only)', '1'),
  BoolVariable('GTK', 'Enable GTK2 GUI (SDL only)', 1),
  BoolVariable('GTK_LITE', 'Enable GTK2 for dialogs only', 0)
)

env = Environment(options = opts)

# LSB_FIRST must be off for PPC to compile
if platform.system == "ppc":
  env['LSB_FIRST'] = 0

# Default compiler flags:
env.Append(CCFLAGS = ['-Wall', '-Wno-write-strings', '-Wno-sign-compare', '-O2', '-Isrc/lua/src'])

if os.environ.has_key('PLATFORM'):
  env.Replace(PLATFORM = os.environ['PLATFORM'])
if os.environ.has_key('CC'):
  env.Replace(CC = os.environ['CC'])
if os.environ.has_key('CXX'):
  env.Replace(CXX = os.environ['CXX'])
if os.environ.has_key('WINDRES'):
  env.Replace(WINDRES = os.environ['WINDRES'])
if os.environ.has_key('CFLAGS'):
  env.Append(CCFLAGS = os.environ['CFLAGS'].split())
if os.environ.has_key('LDFLAGS'):
  env.Append(LINKFLAGS = os.environ['LDFLAGS'].split())

print "platform: ", env['PLATFORM']

# special flags for cygwin
# we have to do this here so that the function and lib checks will go through mingw
if env['PLATFORM'] == 'cygwin':
  env.Append(CCFLAGS = " -mno-cygwin")
  env.Append(LINKFLAGS = " -mno-cygwin")
  env['LIBS'] = ['wsock32'];

if env['PLATFORM'] == 'win32':
  env.Append(CPPPATH = [".", "drivers/win/", "drivers/common/", "drivers/", "drivers/win/zlib", "drivers/win/directx", "drivers/win/lua/include"])
  env.Append(CPPDEFINES = ["PSS_STYLE=2", "WIN32", "_USE_SHARED_MEMORY_", "NETWORK", "FCEUDEF_DEBUGGER", "NOMINMAX", "NEED_MINGW_HACKS", "_WIN32_IE=0x0600"])
  env.Append(LIBS = ["rpcrt4", "comctl32", "vfw32", "winmm", "ws2_32", "comdlg32", "ole32", "gdi32", "htmlhelp"])
else:
  conf = Configure(env)
  if not conf.CheckLib('SDL'):
    print 'Did not find libSDL or SDL.lib, exiting!'
    Exit(1)
  if env['GTK'] or env['GTK_LITE']:
    # Add compiler and linker flags from pkg-config
    env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
    env.Append(CPPDEFINES=["_GTK2"])
  if env['GTK']:
    env.Append(CCFLAGS = ["-D_GTK"])
    env.Append(CCFLAGS =["-D_GTK_LITE"])
  if env['GTK_LITE']:
    env.Append(CCFLAGS =["-D_GTK_LITE"])

  ### Lua platform defines
  ### Applies to all files even though only lua needs it, but should be ok
  if env['LUA']:
    if env['PLATFORM'] == 'darwin':
      # Define LUA_USE_MACOSX otherwise we can't bind external libs from lua
      env.Append(CCFLAGS = ["-DLUA_USE_MACOSX"])      
    if env['PLATFORM'] == 'posix':
      # If we're POSIX, we use LUA_USE_LINUX since that combines usual lua posix defines with dlfcn calls for dynamic library loading.
      # Should work on any *nix
      env.Append(CCFLAGS = ["-DLUA_USE_LINUX"])

  ### Search for gd if we're not in Windows
  if env['PLATFORM'] != 'win32' and env['PLATFORM'] != 'cygwin' and env['CREATE_AVI'] and env['LOGO']:
    gd = conf.CheckLib('gd', autoadd=1)
    if gd == 0:
      env['LOGO'] = 0
      print 'Did not find libgd, you won\'t be able to create a logo screen for your avis.'

  if conf.CheckFunc('asprintf'):
    conf.env.Append(CCFLAGS = "-DHAVE_ASPRINTF")
  if env['OPENGL'] and conf.CheckLibWithHeader('GL', 'GL/gl.h', 'c++', autoadd=1):
    conf.env.Append(CCFLAGS = "-DOPENGL")
  conf.env.Append(CPPDEFINES = ['PSS_STYLE=1'])
  # parse SDL cflags/libs
  env.ParseConfig('sdl-config --cflags --libs')

  env.Append(CPPDEFINES=["_S9XLUA_H"])
  env = conf.Finish()

if sys.byteorder == 'little' or env['PLATFORM'] == 'win32':
  env.Append(CPPDEFINES = ['LSB_FIRST'])

if env['FRAMESKIP']:
  env.Append(CPPDEFINES = ['FRAMESKIP'])

print "base CPPDEFINES:",env['CPPDEFINES']
print "base CCFLAGS:",env['CCFLAGS']

if env['DEBUG']:
  env.Append(CPPDEFINES=["_DEBUG"], CCFLAGS = ['-g'])

if env['PLATFORM'] != 'win32' and env['PLATFORM'] != 'cygwin' and env['CREATE_AVI']:
  env.Append(CPPDEFINES=["CREATE_AVI"])
else:
  env['CREATE_AVI']=0;

Export('env')
SConscript('src/SConscript')

# Install rules
exe_suffix = ''
if env['PLATFORM'] == 'win32':
  exe_suffix = '.exe'

fceux_src = 'src/fceux' + exe_suffix
fceux_dst = 'bin/fceux' + exe_suffix

auxlib_src = 'src/auxlib.lua'
auxlib_dst = 'bin/auxlib.lua'

fceux_h_src = 'src/drivers/win/help/fceux.chm'
fceux_h_dst = 'bin/fceux.chm'

env.Command(fceux_h_dst, fceux_h_src, [Copy(fceux_h_dst, fceux_h_src)])
env.Command(fceux_dst, fceux_src, [Copy(fceux_dst, fceux_src)])
env.Command(auxlib_dst, auxlib_src, [Copy(auxlib_dst, auxlib_src)])

# TODO: Fix this build script to gracefully install auxlib and the man page
#env.Alias(target="install", source=env.Install(dir="/usr/local/bin/", source=("bin/fceux", "bin/auxlib.lua")))
env.Alias(target="install", source=env.Install(dir="/usr/local/bin/", source="bin/fceux"))

I dug into scons to find my answer. 我钻进骗子找到我的答案。

I added this to the SConstruct file (in one of the non-win32 sections): 我将此添加到SConstruct文件中(非win32部分之一):

env['LIBS'] = ['z']

Think this would be worth mentioning to the FCE team or is this something that typically isn't a problem on linux machines? 认为这值得FCE团队提及,或者这在Linux机器上通常不是问题吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM