basho / eleveldb

Erlang LevelDB API
263 stars 176 forks source link

MacOS M2 compile failure due to ld: archive member '/' not a mach-o file in file libleveldb.a #278

Open hsalap7 opened 10 months ago

hsalap7 commented 10 months ago

When trying to compile in MacOS M2 mach-o error pops up causing clang: error: linker command failed with exit code 1 To reproduce call make ldb in macos m2 system with sonoma installed

Logs for the same has been attached below

cc -I. -I./include -mmacosx-version-min=10.8 -DOS_MACOSX -stdlib=libc++ -DLEVELDB_PLATFORM_POSIX  -O2 -g -DNDEBUG     -fPIC -O3 -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -pedantic -DLZ4_VERSION=\"r130\"  -c util/lz4.c -o util/lz4.o
clang: warning: argument unused during compilation: '-stdlib=libc++' [-Wunused-command-line-argument]
util/lz4.c:373:20: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
int LZ4_sizeofState() { return LZ4_STREAMSIZE; }
                   ^
                    void
util/lz4.c:1474:26: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
int LZ4_sizeofStreamState() { return LZ4_STREAMSIZE; }
                         ^
                          void
2 warnings generated.
rm -f libleveldb.a
ar -rs libleveldb.a db/builder.o db/c.o db/db_impl.o db/db_iter.o db/dbformat.o db/filename.o db/log_reader.o db/log_writer.o db/memtable.o db/repair.o db/table_cache.o db/version_edit.o db/version_set.o db/write_batch.o leveldb_ee/cache_warm.o leveldb_ee/compile_opt.o leveldb_ee/expiry_ee.o leveldb_ee/hot_backup.o leveldb_ee/riak_object.o table/block.o table/block_builder.o table/filter_block.o table/format.o table/iterator.o table/merger.o table/table.o table/table_builder.o table/two_level_iterator.o util/arena.o util/bloom.o util/bloom2.o util/cache.o util/cache2.o util/coding.o util/comparator.o util/crc32c.o util/db_list.o util/env.o util/env_posix.o util/expiry_os.o util/filter_policy.o util/flexcache.o util/hash.o util/histogram.o util/hot_threads.o util/logging.o util/murmurhash.o util/options.o util/perf_count.o util/status.o util/thread_tasks.o util/throttle.o port/port_posix.o util/lz4.o
ar: creating libleveldb.a
/Library/Developer/CommandLineTools/usr/bin/make LDFLAGS=" -L~/eleveldb/c_src/system/lib -lsnappy" LD_LIBRARY_PATH="/eleveldb/c_src/system/lib:" -C leveldb tools
g++ -I. -I./include -mmacosx-version-min=10.8 -DOS_MACOSX -stdlib=libc++ -DLEVELDB_PLATFORM_POSIX  -O2 -g -DNDEBUG     -fPIC tools/leveldb_repair.cc -o leveldb_repair -L . -lleveldb -L~/eleveldb/c_src/system/lib -lsnappy
ld: archive member '/' not a mach-o file in '~/eleveldb/c_src/leveldb/libleveldb.a'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [leveldb_repair] Error 1
make: *** [ldb] Error 2
rybalkoss commented 9 months ago

same issue https://stackoverflow.com/questions/77444892/xcode-15-0-1-macos-sonoma-clang-archive-or-linking-issue