我正在OS X 10.5.8上编译C ++。 Macports版本显示db48 @ 4.8.30_4 + java,我的gcc版本是4.0.1。 Macports gcc_select版本显示@ 0.1_8
这是我的makefile.osx的样子:
`# -*- mode: Makefile; -*-
# Copyright (c) 2011 Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Mac OS X makefile for pwrcoin
# Originally by Laszlo Hanyecz (solar@heliacal.net)
CXX=llvm-g++
DEPSDIR=/opt/local
INCLUDEPATHS= \
-I"$(CURDIR)" \
-I"$(CURDIR)"/obj \
-I"$(DEPSDIR)/include" \
-I"$(DEPSDIR)/include/db48"
LIBPATHS= \
-L"$(DEPSDIR)/lib" \
-L"$(DEPSDIR)/lib/db48"
USE_UPNP:=1
USE_IPV6:=1
LIBS= -dead_strip
ifdef STATIC
# Build STATIC if you are redistributing the pwrcoind binary
LIBS += \
$(DEPSDIR)/lib/db48/libdb_cxx-4.8.a \
$(DEPSDIR)/lib/libboost_system-mt.a \
$(DEPSDIR)/lib/libboost_filesystem-mt.a \
$(DEPSDIR)/lib/libboost_program_options-mt.a \
$(DEPSDIR)/lib/libboost_thread-mt.a \
$(DEPSDIR)/lib/libssl.a \
$(DEPSDIR)/lib/libcrypto.a \
-lz
else
LIBS += \
-ldb_cxx-4.8 \
-lboost_system-mt \
-lboost_filesystem-mt \
-lboost_program_options-mt \
-lboost_thread-mt \
-lssl \
-lcrypto \
-lz
endif
DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE
ifdef RELEASE
# Compile for maximum compatibility and smallest size.
# This requires that dependencies are compiled
# the same way.
CFLAGS = -mmacosx-version-min=10.5 -arch x86_64 -O3 -msse2
else
CFLAGS = -g -msse2
endif
# ppc doesn't work because we don't support big-endian
CFLAGS += -Wall -Wextra -Wformat -Wno-ignored-qualifiers -Wformat-security -Wno-unused-parameter \
$(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
OBJS= \
obj/alert.o \
obj/version.o \
obj/checkpoints.o \
obj/netbase.o \
obj/addrman.o \
obj/crypter.o \
obj/key.o \
obj/db.o \
obj/init.o \
obj/keystore.o \
obj/main.o \
obj/miner.o \
obj/net.o \
obj/protocol.o \
obj/pwrcoinrpc.o \
obj/rpcdump.o \
obj/rpcnet.o \
obj/rpcmining.o \
obj/rpcwallet.o \
obj/rpcblockchain.o \
obj/rpcrawtransaction.o \
obj/script.o \
obj/sync.o \
obj/util.o \
obj/wallet.o \
obj/walletdb.o \
obj/noui.o \
obj/pbkdf2.o \
obj/kernel.o \
obj/scrypt.o \
obj/scrypt-x86.o \
obj/scrypt-x86_64.o \
obj/PWRcoin/Accumulator.o \
obj/PWRcoin/AccumulatorProofOfKnowledge.o \
obj/PWRcoin/Coin.o \
obj/PWRcoin/CoinSpend.o \
obj/PWRcoin/Commitment.o \
obj/PWRcoin/ParamGeneration.o \
obj/PWRcoin/Params.o \
obj/PWRcoin/SerialNumberSignatureOfKnowledge.o \
obj/PWRcoin/SpendMetaData.o \
obj/PWRcoin/PowerTest.o
ifndef USE_UPNP
override USE_UPNP = -
endif
ifneq (${USE_UPNP}, -)
DEFS += -DUSE_UPNP=$(USE_UPNP)
ifdef STATIC
LIBS += $(DEPSDIR)/lib/libminiupnpc.a
else
LIBS += -lminiupnpc
endif
endif
ifneq (${USE_IPV6}, -)
DEFS += -DUSE_IPV6=$(USE_IPV6)
endif
all: pwrcoind
LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
DEFS += $(addprefix -I,$(CURDIR)/leveldb/include)
DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
OBJS += obj/txdb-leveldb.o
leveldb/libleveldb.a:
@echo "Building LevelDB ..."; cd leveldb; make; cd ..
obj/txdb-leveldb.o: leveldb/libleveldb.a
# auto-generated dependencies:
-include obj/*.P
obj/build.h: FORCE
/bin/sh ../share/genbuild.sh obj/build.h
version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO
obj/%.o: %.cpp
$(CXX) -c $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
@cp $(@:%.o=%.d) $(@:%.o=%.P); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
rm -f $(@:%.o=%.d)
obj/PWRcoin/%.o: PWRcoin/%.cpp
$(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
@cp $(@:%.o=%.d) $(@:%.o=%.P); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
rm -f $(@:%.o=%.d)
obj/scrypt-x86.o: scrypt-x86.S
$(CXX) -c $(xCXXFLAGS) -MMD -o $@ $<
obj/scrypt-x86_64.o: scrypt-x86_64.S
$(CXX) -c $(xCXXFLAGS) -MMD -o $@ $<
pwrcoind: $(OBJS:obj/%=obj/%)
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
clean:
-rm -f pwrcoind
-rm -f obj/*.o
-rm -f obj/PWRcoin/*.o
-rm -f obj/*.P
-rm -f obj/PWRcoin/*.P
-rm -f obj/build.h
FORCE:`
这是调试对错误的显示:
Building LevelDB ...
g++ -dynamiclib -install_name /Users/Admin1/pwr/src/leveldb/libleveldb.dylib.1 -I. -I./include -fno-builtin-memcmp -DOS_MACOSX -DLEVELDB_PLATFORM_POSIX -O2 -DNDEBUG -fPIC db/builder.cc db/c.cc db/db_impl.cc db/db_iter.cc db/dbformat.cc db/filename.cc db/log_reader.cc db/log_writer.cc db/memtable.cc db/repair.cc db/table_cache.cc db/version_edit.cc db/version_set.cc db/write_batch.cc table/block.cc table/block_builder.cc table/filter_block.cc table/format.cc table/iterator.cc table/merger.cc table/table.cc table/table_builder.cc table/two_level_iterator.cc util/arena.cc util/bloom.cc util/cache.cc util/coding.cc util/comparator.cc util/crc32c.cc util/env.cc util/env_posix.cc util/env_win.cc util/filter_policy.cc util/hash.cc util/histogram.cc util/logging.cc util/options.cc util/status.cc port/port_posix.cc -o libleveldb.dylib.1.13
db/version_set.cc: In member function Ôvoid leveldb::VersionSet::Builder::Apply(leveldb::VersionEdit*)Õ:
./db/version_edit.h:100: error: Ôstd::vector<std::pair<int, leveldb::InternalKey>, std::allocator<std::pair<int, leveldb::InternalKey> > > leveldb::VersionEdit::compact_pointers_Õ is private
db/version_set.cc:672: error: within this context
./db/version_edit.h:100: error: Ôstd::vector<std::pair<int, leveldb::InternalKey>, std::allocator<std::pair<int, leveldb::InternalKey> > > leveldb::VersionEdit::compact_pointers_Õ is private
db/version_set.cc:673: error: within this context
./db/version_edit.h:100: error: Ôstd::vector<std::pair<int, leveldb::InternalKey>, std::allocator<std::pair<int, leveldb::InternalKey> > > leveldb::VersionEdit::compact_pointers_Õ is private
db/version_set.cc:675: error: within this context
./db/version_edit.h:87: error: Ôtypedef class std::set<std::pair<int, uint64_t>, std::less<std::pair<int, uint64_t> >, std::allocator<std::pair<int, uint64_t> > > leveldb::VersionEdit::DeletedFileSetÕ is private
db/version_set.cc:679: error: within this context
./db/version_edit.h:101: error: Ôstd::set<std::pair<int, uint64_t>, std::less<std::pair<int, uint64_t> >, std::allocator<std::pair<int, uint64_t> > > leveldb::VersionEdit::deleted_files_Õ is private
db/version_set.cc:679: error: within this context
./db/version_edit.h:102: error: Ôstd::vector<std::pair<int, leveldb::FileMetaData>, std::allocator<std::pair<int, leveldb::FileMetaData> > > leveldb::VersionEdit::new_files_Õ is private
db/version_set.cc:689: error: within this context
./db/version_edit.h:102: error: Ôstd::vector<std::pair<int, leveldb::FileMetaData>, std::allocator<std::pair<int, leveldb::FileMetaData> > > leveldb::VersionEdit::new_files_Õ is private
db/version_set.cc:690: error: within this context
./db/version_edit.h:102: error: Ôstd::vector<std::pair<int, leveldb::FileMetaData>, std::allocator<std::pair<int, leveldb::FileMetaData> > > leveldb::VersionEdit::new_files_Õ is private
db/version_set.cc:691: error: within this context
db/version_set.cc: In member function Ôvoid leveldb::VersionSet::Builder::SaveTo(leveldb::Version*)Õ:
./db/version_set.h:138: error: Ôstd::vector<leveldb::FileMetaData*, std::allocator<leveldb::FileMetaData*> > leveldb::Version::files_ [7]Õ is private
db/version_set.cc:722: error: within this context
./db/version_set.h:138: error: Ôstd::vector<leveldb::FileMetaData*, std::allocator<leveldb::FileMetaData*> > leveldb::Version::files_ [7]Õ is private
db/version_set.cc:726: error: within this context
db/version_set.cc: In member function Ôvoid leveldb::VersionSet::Builder::MaybeAddFile(leveldb::Version*, int, leveldb::FileMetaData*)Õ:
./db/version_set.h:138: error: Ôstd::vector<leveldb::FileMetaData*, std::allocator<leveldb::FileMetaData*> > leveldb::Version::files_ [7]Õ is private
db/version_set.cc:768: error: within this context
make[1]: *** [libleveldb.dylib.1.13] Error 1
llvm-g++ -c -g -msse2 -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE -DUSE_UPNP=0 -DUSE_IPV6=1 -I/Users/Admin1/pwr/src/leveldb/include -I/Users/Admin1/pwr/src/leveldb/helpers -DHAVE_BUILD_INFO -I"/Users/Admin1/pwr/src" -I"/Users/Admin1/pwr/src"/obj -I"/opt/local/include" -I"/opt/local/include/db48" -MMD -MF obj/txdb-leveldb.d -o obj/txdb-leveldb.o txdb-leveldb.cpp
llvm-g++ -g -msse2 -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE -DUSE_UPNP=0 -DUSE_IPV6=1 -I/Users/Admin1/pwr/src/leveldb/include -I/Users/Admin1/pwr/src/leveldb/helpers -DHAVE_BUILD_INFO -I"/Users/Admin1/pwr/src" -I"/Users/Admin1/pwr/src"/obj -I"/opt/local/include" -I"/opt/local/include/db48" -o pwrcoind -L"/opt/local/lib" -L"/opt/local/lib/db48" obj/alert.o obj/version.o obj/checkpoints.o obj/netbase.o obj/addrman.o obj/crypter.o obj/key.o obj/db.o obj/init.o obj/keystore.o obj/main.o obj/miner.o obj/net.o obj/protocol.o obj/pwrcoinrpc.o obj/rpcdump.o obj/rpcnet.o obj/rpcmining.o obj/rpcwallet.o obj/rpcblockchain.o obj/rpcrawtransaction.o obj/script.o obj/sync.o obj/util.o obj/wallet.o obj/walletdb.o obj/noui.o obj/pbkdf2.o obj/kernel.o obj/scrypt.o obj/scrypt-x86.o obj/scrypt-x86_64.o obj/PWRcoin/Accumulator.o obj/PWRcoin/AccumulatorProofOfKnowledge.o obj/PWRcoin/Coin.o obj/PWRcoin/CoinSpend.o obj/PWRcoin/Commitment.o obj/PWRcoin/ParamGeneration.o obj/PWRcoin/Params.o obj/PWRcoin/SerialNumberSignatureOfKnowledge.o obj/PWRcoin/SpendMetaData.o obj/PWRcoin/PowerTest.o obj/txdb-leveldb.o -dead_strip -ldb_cxx-4.8 -lboost_system-mt -lboost_filesystem-mt -lboost_program_options-mt -lboost_thread-mt -lssl -lcrypto -lz -lminiupnpc /Users/Admin1/pwr/src/leveldb/libleveldb.a /Users/Admin1/pwr/src/leveldb/libmemenv.a
i686-apple-darwin9-llvm-g++-4.2: /Users/Admin1/pwr/src/leveldb/libleveldb.a: No such file or directory
i686-apple-darwin9-llvm-g++-4.2: /Users/Admin1/pwr/src/leveldb/libmemenv.a: No such file or directory
make: *** [pwrcoind] Error 1
我尝试以下操作均未成功:
已添加到makefile.osx CFLAGS = -c -fno-access-control -I. -I./include $(PORT_CFLAGS)
$(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
然后在makefile.osx CXXFLAGS += -fno-access-control -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT)