I'm using QT and the ed25519-donna lib to validate my signature.
Linux I'm using this lib => libssl-dev
MacOs I'm using this lib => openssl
So when I try to compile by Linux its work but when I try in MacOs the donna libs give a error:
openssl/rand.h is not found
I've this line in my Makefile:
LIBS = $(SUBLIBS) -L/home/laion/Desktop/lethean-gui/lethean/lib -lwallet_merged -lepee -lunbound -leasylogging -lboost_serialization -lboost_thread -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_chrono -lboost_program_options -lssl -lcrypto -Wl,-Bdynamic -Wl,-Bdynamic -lunwind -ldl -lQt5Quick -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGL -lpthread
When you look to donna libs you can see a ed25519.c file and inside of that call the ed25519-randombytes.h, inside of this file has the openssl/rand.h include.
Inside of my .pro file I use this:
macx {
# mixing static and shared libs are not supported on mac
# CONFIG(static) {
# message("using static libraries")
# LIBS+= -Wl,-Bstatic
# }
LIBS+= \
-L/usr/local/lib \
-L/usr/local/opt/openssl/lib \
-L/usr/local/opt/boost/lib \
-lboost_serialization \
-lboost_thread-mt \
-lboost_system \
-lboost_system-mt \
-lboost_date_time \
-lboost_filesystem \
-lboost_regex \
-lboost_chrono \
-lboost_chrono-mt \
-lboost_program_options \
-lssl \
-lcrypto \
-ldl
INCLUDEPATH += /usr/local/opt/boost/include/
}
So, if I add this path in INCLUDEPATH:
/usr/local/opt/openssl/include \
/usr/local/opt/openssl/lib
I get a different error:
The program has unexpectedly finished.
// every donna file get this message
was built for newer osx version (10.13) than being linked (10.12)
For now I get this reference C++, Mac OS X, Xcode 8 : Compile Boost : Set deployment target to OS X 10.11 and I come back to let you know if works
FIXED << The problem was the version of Mac. To work with donna and openssl is necessary 10.12+ to compile
Related
I am currently attempting to cross-compile my C source code into a PE32+ executable, which hasn't yielded the greatest results.
I'm running macOS Ventura Beta 8 (macOS 13), using Clang which is bundled with LLVM (which was installed via the Homebrew tap).
Here is the command for compiling the source files:
/usr/local/opt/llvm/bin/clang \
--target=x86_64-unknown-windows-gnu \
-Wl,-e,_KernMain \
-o kernel.o \
src/Kernel/Kernel.c \
src/Kernel/Memory/KernMem.c \
src/Kernel/Graphics/KernGraphics.c \
-I/Users/kernel/Documents/edk2-master/edk2/MdePkg/Include/ \
-I/Users/kernel/Documents/edk2-master/edk2/MdePkg/Include/X64 \
-I/Users/kernel/Documents/edk2-master/edk2/KernelOSPkg/src/Common \
-I/Users/kernel/Downloads/mingw64/x86_64-w64-mingw32/include \
-L/Users/kernel/Documents/edk2-master/edk2/MdePkg/Library/ \
-L/Users/kernel/Downloads/mingw64/x86_64-w64-mingw32/lib \
-L/Users/kernel/Downloads/mingw64/x86_64-w64-mingw32/lib/ldscripts \
-L/usr/local/lib \
-fuse-ld="/usr/local/opt/llvm/bin/ld.lld"
It throws the following error:
lld: error: unable to find library -lgcc
lld: error: unable to find library -lgcc_eh
lld: error: unable to find library -lgcc
lld: error: unable to find library -lgcc_eh
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
CLANG info:
/usr/local/opt/llvm/bin/clang --version
Homebrew clang version 15.0.2
Target: x86_64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
ld.lld info:
/usr/local/opt/llvm/bin/ld.lld --version
Homebrew LLD 15.0.2 (compatible with GNU linkers)
The issue was that I didn't include the /path/to/mingw64/lib/gcc/x86_64-w64-mingw32/<version> directory, which included the libgcc.a and libgcc_eh.a files.
Though, I still do not know how to resolve the issue with an undefined symbol: WinMain. I will update this answer if I find a solution.
Error in question:
ld.lld: error: undefined symbol: WinMain
>>> referenced by libmingw32.a(lib64_libmingw32_a-crt0_c.o):(.text.startup)
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
Compilation command (does not compile successfully due to undefined symbol):
/usr/local/opt/llvm/bin/clang \
-target x86_64-unknown-windows-gnu \
-Wl,-e,KernMain \
-fuse-ld=lld \
-ffreestanding \
-o kernel.o \
src/Kernel/Kernel.c \
src/Kernel/Memory/KernMem.c \
src/Kernel/Graphics/KernGraphics.c \
-I/Users/kernel/Documents/edk2-master/edk2/MdePkg/Include/ \
-I/Users/kernel/Documents/edk2-master/edk2/MdePkg/Include/X64 \
-I/Users/kernel/Documents/edk2-master/edk2/KernelOSPkg/src/Common \
-I/Users/kernel/Downloads/mingw64/x86_64-w64-mingw32/include \
-L/Users/kernel/Downloads/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0 \
-L/Users/kernel/Documents/edk2-master/edk2/MdePkg/Library/ \
-L/Users/kernel/Downloads/mingw64/x86_64-w64-mingw32/lib \
-fshort-wchar
EDIT: To fix the aforementioned error with the undefined symbol, simply supply -nostdlib to the compiler.
I am trying to link with static C API version of the TensorFlow library.
I built the static library using the following commands:
// get the sources
git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
// create a build directory
mkdir builddir
cd builddir
// build the lib using CMake
cmake -S ../tensorflow_src/tensorflow/lite/c -DTFLITE_C_BUILD_SHARED_LIBS:BOOL=OFF
cmake --build . -j
This builds the libtensorflow-lite.a. However, the libtensorflow-lite.a is not self-contained and has its own set of 10 dependencies, stated here in the CMake file:
# TensorFlow Lite dependencies.
find_package(absl REQUIRED)
find_package(eigen REQUIRED)
find_package(farmhash REQUIRED)
find_package(fft2d REQUIRED)
find_package(flatbuffers REQUIRED)
find_package(gemmlowp REQUIRED)
find_package(neon2sse REQUIRED)
find_package(clog REQUIRED)
find_package(cpuinfo REQUIRED) #CPUINFO is used by XNNPACK and RUY library
find_package(ruy REQUIRED)
The question is, how do I find out the .a names of the required sub-libraries?
I used find ./builddir -type f -name "*.a" to list the libraries built by CMake, and expected roughly 10 libs, but the actual list is too long:
./_deps/xnnpack-build/libXNNPACK.a
./_deps/ruy-build/ruy/libruy_pack_avx2_fma.a
./_deps/ruy-build/ruy/libruy_have_built_path_for_avx2_fma.a
./_deps/ruy-build/ruy/libruy_block_map.a
./_deps/ruy-build/ruy/libruy_system_aligned_alloc.a
./_deps/ruy-build/ruy/libruy_have_built_path_for_avx512.a
./_deps/ruy-build/ruy/profiler/libruy_profiler_instrumentation.a
./_deps/ruy-build/ruy/libruy_trmul.a
./_deps/ruy-build/ruy/libruy_cpuinfo.a
./_deps/ruy-build/ruy/libruy_blocking_counter.a
./_deps/ruy-build/ruy/libruy_pack_arm.a
./_deps/ruy-build/ruy/libruy_apply_multiplier.a
./_deps/ruy-build/ruy/libruy_kernel_avx2_fma.a
./_deps/ruy-build/ruy/libruy_prepacked_cache.a
./_deps/ruy-build/ruy/libruy_tune.a
./_deps/ruy-build/ruy/libruy_context_get_ctx.a
./_deps/ruy-build/ruy/libruy_have_built_path_for_avx.a
./_deps/ruy-build/ruy/libruy_ctx.a
./_deps/ruy-build/ruy/libruy_wait.a
./_deps/ruy-build/ruy/libruy_allocator.a
./_deps/ruy-build/ruy/libruy_context.a
./_deps/ruy-build/ruy/libruy_kernel_avx.a
./_deps/ruy-build/ruy/libruy_prepare_packed_matrices.a
./_deps/ruy-build/ruy/libruy_pack_avx512.a
./_deps/ruy-build/ruy/libruy_kernel_arm.a
./_deps/ruy-build/ruy/libruy_denormal.a
./_deps/ruy-build/ruy/libruy_kernel_avx512.a
./_deps/ruy-build/ruy/libruy_frontend.a
./_deps/ruy-build/ruy/libruy_pack_avx.a
./_deps/ruy-build/ruy/libruy_thread_pool.a
./_deps/flatbuffers-build/libflatbuffers.a
./_deps/fft2d-build/libfft2d_fftsg2d.a
./_deps/fft2d-build/libfft2d_fftsg.a
./_deps/farmhash-build/libfarmhash.a
./_deps/clog-build/libclog.a
./_deps/abseil-cpp-build/absl/synchronization/libabsl_graphcycles_internal.a
./_deps/abseil-cpp-build/absl/synchronization/libabsl_synchronization.a
./_deps/abseil-cpp-build/absl/strings/libabsl_strings.a
./_deps/abseil-cpp-build/absl/strings/libabsl_str_format_internal.a
./_deps/abseil-cpp-build/absl/strings/libabsl_cord.a
./_deps/abseil-cpp-build/absl/strings/libabsl_strings_internal.a
./_deps/abseil-cpp-build/absl/status/libabsl_status.a
./_deps/abseil-cpp-build/absl/hash/libabsl_city.a
./_deps/abseil-cpp-build/absl/hash/libabsl_wyhash.a
./_deps/abseil-cpp-build/absl/hash/libabsl_hash.a
./_deps/abseil-cpp-build/absl/flags/libabsl_flags_reflection.a
./_deps/abseil-cpp-build/absl/flags/libabsl_flags_program_name.a
./_deps/abseil-cpp-build/absl/flags/libabsl_flags_internal.a
./_deps/abseil-cpp-build/absl/flags/libabsl_flags_private_handle_accessor.a
./_deps/abseil-cpp-build/absl/flags/libabsl_flags_marshalling.a
./_deps/abseil-cpp-build/absl/flags/libabsl_flags_commandlineflag_internal.a
./_deps/abseil-cpp-build/absl/flags/libabsl_flags_commandlineflag.a
./_deps/abseil-cpp-build/absl/flags/libabsl_flags_config.a
./_deps/abseil-cpp-build/absl/flags/libabsl_flags.a
./_deps/abseil-cpp-build/absl/numeric/libabsl_int128.a
./_deps/abseil-cpp-build/absl/debugging/libabsl_symbolize.a
./_deps/abseil-cpp-build/absl/debugging/libabsl_debugging_internal.a
./_deps/abseil-cpp-build/absl/debugging/libabsl_demangle_internal.a
./_deps/abseil-cpp-build/absl/debugging/libabsl_stacktrace.a
./_deps/abseil-cpp-build/absl/base/libabsl_spinlock_wait.a
./_deps/abseil-cpp-build/absl/base/libabsl_raw_logging_internal.a
./_deps/abseil-cpp-build/absl/base/libabsl_malloc_internal.a
./_deps/abseil-cpp-build/absl/base/libabsl_throw_delegate.a
./_deps/abseil-cpp-build/absl/base/libabsl_exponential_biased.a
./_deps/abseil-cpp-build/absl/base/libabsl_base.a
./_deps/abseil-cpp-build/absl/base/libabsl_log_severity.a
./_deps/abseil-cpp-build/absl/time/libabsl_time_zone.a
./_deps/abseil-cpp-build/absl/time/libabsl_civil_time.a
./_deps/abseil-cpp-build/absl/time/libabsl_time.a
./_deps/abseil-cpp-build/absl/container/libabsl_hashtablez_sampler.a
./_deps/abseil-cpp-build/absl/container/libabsl_raw_hash_set.a
./_deps/abseil-cpp-build/absl/types/libabsl_bad_variant_access.a
./_deps/abseil-cpp-build/absl/types/libabsl_bad_optional_access.a
./_deps/cpuinfo-build/libcpuinfo.a
The state of the libs seems to be the following:
absl: 30 libraries found
eigen: OK, template library defined in the headers
farmhash: OK, 1 library found
fft2d: OK, 2 libraries found
flatbuffers: OK, 1 library found
gemmlowp: OK, headers only
neon2sse: OK, headers only
clog: OK, 1 library found
cpuinfo: OK, 1 library found
ruy: 30 libraries found
All in all, most libs are OK, either there is 1 lib to link with, or the libs are header-only. What remains to be the problem are:
absl
ruy
because they contain about 30 .a libs.
Not sure if I have to link with all of those? It would be very cumbersome, as my build system is Meson and I am using custom_target() to link with TensorFlow.
A year later, but I just went through this myself, so here goes my answer.
Based on my experience (using a makefile and without your -DTFLITE_C_BUILD_SHARED_LIBS:BOOL=OFF) a program that performs inference does not need to link to Abseil.
You need to link to all other libs you mentioned, except ruy_kernel_arm and ruy_pack_arm, assuming you're running your program on the x64 platform. (Annoyingly -DTFLITE_ENABLE_RUY=OFF is not respected when building TfLite, so you're stuck with Ruy)
Detailed steps:
Build TfLite:
mkdir ~/my_tflite_project
cd ~/my_tflite_project/
git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
mkdir tflite_build_x64
cd tflite_build_x64/
cmake ../tensorflow_src/tensorflow/lite/
/* You may encounter two CMake messages:
-- The Fortran compiler identification is unknown
I believe a Fortran compiler is only necessary to build Fortran bindings for TfLite.
-- Could NOT find CLANG_FORMAT: Found unsuitable version "0.0", but required is exact version "9" (found CLANG_FORMAT_EXECUTABLE-NOTFOUND)
sudo apt install clang-format-9
Annoyingly you need clang-format-9, plain clang-format (version 13, the newest) won't do. */
cmake --build . -j 4
Relevant libs:
$ cd ~/my_tflite_project/tflite_build_x64
$ ls *.a
libtensorflow-lite.a
$ ls pthreadpool/*.a
pthreadpool/libpthreadpool.a
$ ls _deps/*/*.a
_deps/clog-build/libclog.a _deps/farmhash-build/libfarmhash.a _deps/fft2d-build/libfft2d_fftsg2d.a _deps/xnnpack-build/libXNNPACK.a
_deps/cpuinfo-build/libcpuinfo.a _deps/fft2d-build/libfft2d_fftsg.a _deps/flatbuffers-build/libflatbuffers.a
$ ls _deps/ruy-build/ruy/*.a
_deps/ruy-build/ruy/libruy_allocator.a _deps/ruy-build/ruy/libruy_ctx.a _deps/ruy-build/ruy/libruy_kernel_avx.a _deps/ruy-build/ruy/libruy_prepacked_cache.a
_deps/ruy-build/ruy/libruy_apply_multiplier.a _deps/ruy-build/ruy/libruy_denormal.a _deps/ruy-build/ruy/libruy_kernel_avx2_fma.a _deps/ruy-build/ruy/libruy_prepare_packed_matrices.a
_deps/ruy-build/ruy/libruy_block_map.a _deps/ruy-build/ruy/libruy_frontend.a _deps/ruy-build/ruy/libruy_kernel_avx512.a _deps/ruy-build/ruy/libruy_system_aligned_alloc.a
_deps/ruy-build/ruy/libruy_blocking_counter.a _deps/ruy-build/ruy/libruy_have_built_path_for_avx.a _deps/ruy-build/ruy/libruy_pack_arm.a _deps/ruy-build/ruy/libruy_thread_pool.a
_deps/ruy-build/ruy/libruy_context.a _deps/ruy-build/ruy/libruy_have_built_path_for_avx2_fma.a _deps/ruy-build/ruy/libruy_pack_avx.a _deps/ruy-build/ruy/libruy_trmul.a
_deps/ruy-build/ruy/libruy_context_get_ctx.a _deps/ruy-build/ruy/libruy_have_built_path_for_avx512.a _deps/ruy-build/ruy/libruy_pack_avx2_fma.a _deps/ruy-build/ruy/libruy_tune.a
_deps/ruy-build/ruy/libruy_cpuinfo.a _deps/ruy-build/ruy/libruy_kernel_arm.a _deps/ruy-build/ruy/libruy_pack_avx512.a _deps/ruy-build/ruy/libruy_wait.a
Construct MWE using TfLite:
$ cd ~/my_tflite_project
$ mkdir my_dev_x64
$ cd my_dev_x64/
/* Construct minimal.cpp and makefile below */
$ cat minimal.cpp
#include "tensorflow/lite/model.h"
#include "tensorflow/lite/interpreter.h"
#include "tensorflow/lite/kernels/register.h"
#include <iostream>
int main() {
std::unique_ptr<tflite::FlatBufferModel> model = tflite::FlatBufferModel::BuildFromFile("your_network_here.tflite");
tflite::ops::builtin::BuiltinOpResolver resolver;
std::cout "Done\n";
return EXIT_SUCCESS;
}
$ cat makefile
COMPILER := g++
LINKER := g++
CXX_FILES := minimal.cpp
OBJ_FILES := $(CXX_FILES:.cpp=.o)
EXE_FILE := app
INCLUDE_DIRS := -I../tensorflow_src -I../tflite_build_x64/flatbuffers/include
LIB_DIRS := \
-L../tflite_build_x64 \
-L../tflite_build_x64/_deps/fft2d-build \
-L../tflite_build_x64/_deps/flatbuffers-build \
-L../tflite_build_x64/_deps/ruy-build/ruy \
-L../tflite_build_x64/_deps/farmhash-build \
-L../tflite_build_x64/_deps/xnnpack-build \
-L../tflite_build_x64/_deps/cpuinfo-build \
-L../tflite_build_x64/_deps/clog-build \
-L../tflite_build_x64/pthreadpool
LIBS := \
-ltensorflow-lite \
-lfft2d_fftsg \
-lfft2d_fftsg2d \
-lflatbuffers \
-lruy_ctx \
-lruy_allocator \
-lruy_frontend \
-lruy_context_get_ctx \
-lruy_context \
-lruy_apply_multiplier \
-lruy_prepacked_cache \
-lruy_tune \
-lruy_cpuinfo \
-lruy_system_aligned_alloc \
-lruy_prepare_packed_matrices \
-lruy_trmul \
-lruy_block_map \
-lruy_denormal \
-lruy_thread_pool \
-lruy_blocking_counter \
-lruy_wait \
-lruy_kernel_avx \
-lruy_kernel_avx2_fma \
-lruy_kernel_avx512 \
-lruy_pack_avx \
-lruy_pack_avx2_fma \
-lruy_pack_avx512 \
-lruy_have_built_path_for_avx \
-lruy_have_built_path_for_avx2_fma \
-lruy_have_built_path_for_avx512 \
-lfarmhash \
-lXNNPACK \
-lpthreadpool \
-lcpuinfo \
-lclog
CXX_FLAGS := -Wall #-pedantic
LINK_FLAGS :=
#Do not print the output of the commands
.SILENT:
#Phony targets do not represent actual files, so files with the following names are ignored
.PHONY: clean depend
#Link object files to form an executable file
$(EXE_FILE): $(OBJ_FILES)
$(LINKER) $(LINK_FLAGS) $(OBJ_FILES) -o $(EXE_FILE) $(LIB_DIRS) $(LIBS)
#Compile cpp files to object files
%.o: %.cpp
$(COMPILER) $(CXX_FLAGS) $(INCLUDE_DIRS) -c $<
#Remove object files, executable, and possible linkinfo files
clean:
-rm -f $(OBJ_FILES) $(EXE_FILE)
#Generate dependency file
depend:
$(COMPILER) $(CXX_FLAGS) $(INCLUDE_DIRS) -MM $(CXX_FILES) > make.dep
#Include dependency file
-include make.dep
Build and run MWE:
$ cd ~/my_tflite_project/my_dev_x64
$ make
$ ./app
Done
Hopefully that helps you or some other poor fellow to get TfLite C++ working.
I planned on adding sound effects to a smal project.
i downloaded the SDL_Mixer dev-library for mingw32,
moved all the files from its lib folder to the mingw32 lib folder, did the same for include and bin.
But iam still not able to compile anything using #include SDL2/SDL_mixer.h.
´C:/Development/SDL Mixer/include/SDL2/SDL_mixer.h:25:10: fatal error: SDL_stdinc.h: No such file or directory´
Maybe it is my makefile.
´build:
gcc -Wfatal-errors \
-std=c99 \
./*.c \
-I"C:\Development\SDL2 MinGW 64\include" \
-L"C:\Development\SDL2 MinGW 64\lib" \
-I"C:\Development\SDL Mixer\include" \
-L"C:\Development\SDL Mixer\lib" \
-lmingw32 \
-lSDL2main \
-lSDL2 \
-o example.exe´
i dont know why files are missing.
I'm building an uClibc i486 cross toolchain for an embedded system. The toolchain is built on Debian Wheezy (x86-64) and consists of the following components:
Binutils 2.24
GCC 4.7.3
Linux 3.2.54
uClibc 0.9.33.2
GMP 5.1.3
MPFR 3.1.2
MPC 1.0.2
These steps are used to build the toolchain:
Install Linux 3.2.54 headers
make mrproper
make \
ARCH=x86 \
INSTALL_HDR_PATH=/home/build-user/toolchain/i486-linux-uclibc \
headers_install
This step is successfully completed.
Build Binutils 2.24
Binutils is built in a separate directory as specified in the documentation.
./configure \
--prefix=/home/build-user/toolchain/ \
--target=i486-linux-uclibc
--with-sysroot=/home/build-user/toolchain/i486-linux-uclibc \
--with-lib-path=/home/build-user/toolchain/i486-linux-uclibc/lib \
--disable-nls \
--disable-multilib
make configure-host
make
make install
This step is successfully completed.
Build GMP 5.1.3
./configure \
--prefix=/home/build-user/toolchain/gmp \
--disable-shared \
--enable-static
make
make install
This step is successfully completed.
Build MPFR 3.1.2
./configure \
--prefix=/home/build-user/toolchain/mpfr \
--with-gmp=/home/build-user/toolchain/gmp \
--disable-shared \
--enable-static
make
make install
This step is successfully completed.
Build MPC 1.0.2
./configure \
--prefix=/home/build-user/toolchain/mpc \
--with-gmp=/home/build-user/toolchain/gmp \
--with-mpfr=/home/build-user/toolchain/mpfr \
--disable-shared \
--enable-static
make
make install
This step is successfully completed.
Build static GCC 4.7.3
GCC is built in a separate directory as specified in the documentation.
./configure \
--prefix=/home/build-user/toolchain \
--target=i486-linux-uclibc \
--with-arch=i486 \
--with-sysroot=/home/build-user/toolchain/i486-linux-uclibc \
--disable-multiarch \
--disable-nls \
--disable-shared \
--without-headers \
--with-newlib \
--disable-decimal-float \
--disable-libgomp \
--disable-libmudflap \
--disable-libssp \
--disable-libquadmath \
--disable-threads \
--enable-languages=c \
--disable-multilib \
--with-gmp=/home/build-user/toolchain/gmp \
--with-mpfr=/home/build-user/toolchain/mpfr \
--with-mpc=/home/build-user/toolchain/mpc
make all-gcc all-target-libgcc
make install-gcc install-target-libgcc
This step is successfully completed.
Build uClibc 0.9.33.2
The configuration file for uClibc is default with following options enabled:
TARGET_i386=y
CONFIG_486=y
UCLIBC_HAS_FENV=y
LINUXTHREADS_OLD=y
make \
ARCH=x86 \
DESTDIR=/home/build-user/toolchain/i486-linux-uclibc \
CROSS=i486-linux-uclibc- \
RUNTIME_PREFIX=/ \
DEVEL_PREFIX=/ \
KERNEL_HEADERS=/home/build-user/toolchain/i486-linux-uclibc/include \
install
This step is successfully completed.
Build final GCC 4.7.3
GCC is built in a separate directory as specified in the documentation.
./configure \
--prefix=/home/build-user/toolchain \
--target=i486-linux-uclibc \
--with-arch=i486 \
--with-sysroot=/home/build-user/toolchain/i486-linux-uclibc \
--with-native-system-header-dir=/include \
--disable-multiarch \
--disable-nls \
--enable-libssp \
--enable-c99 \
--disable-libgomp \
--enable-long-long \
--disable-libmudflap \
--enable-languages=c \
--disable-multilib \
--with-gmp=/home/build-user/toolchain/gmp \
--with-mpfr=/home/build-user/toolchain/mpfr \
--with-mpc=/home/build-user/toolchain/mpc
make
This step fails with the following errors:
/bin/bash /home/build-user/toolchain/packages/gcc-4.7.3/libgcc/../mkinstalldirs .
/home/build-user/toolchain/gcc-final-build/./gcc/xgcc -B/home/build-user/toolchain/gcc-final-build/./gcc/ -B/home/build-user/toolchain/i486-linux-uclibc/bin/ -B/home/build-user/toolchain/i486-linux-uclibc/lib/ -isystem /home/build-user/toolchain/i486-linux-uclibc/include -isystem /home/build-user/toolchain/i486-linux-uclibc/sys-include -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o tf-signs_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/home/build-user/toolchain/i486-linux-uclibc/bin/ld: cannot find /lib/libc.so.0
/home/build-user/toolchain/i486-linux-uclibc/bin/ld: cannot find /lib/uclibc_nonshared.a
/home/build-user/toolchain/i486-linux-uclibc/bin/ld: cannot find /lib/ld-uClibc.so.0
collect2: error: ld returned 1 exit status
make[2]: *** [libgcc_s.so] Error 1
make[2]: Leaving directory `/home/build-user/toolchain/gcc-final-build/i486-linux-uclibc/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/home/build-user/toolchain/gcc-final-build'
make: *** [all] Error 2
I check the linker search path:
/home/build-user/toolchain/i486-linux-uclibc/bin/ld --verbose | grep SEARCH_DIR
SEARCH_DIR("/home/build-user/toolchain/i486-linux-uclibc/lib");
The path is correct, so I search for the allegedly missing files in the directory:
find /home/build-user/toolchain/i486-linux-uclibc/lib \( -name libc.so.0 -o -name uclibc_nonshared.a -o -name ld-uClibc.so.0 \)
/home/build-user/toolchain/i486-linux-uclibc/lib/uclibc_nonshared.a
/home/build-user/toolchain/i486-linux-uclibc/lib/ld-uClibc.so.0
/home/build-user/toolchain/i486-linux-uclibc/lib/libc.so.0
All the files are found in the directory.
Can someone tell me what I'm doing wrong?
This is a guess, but when I build GCC cross compilers, I use sysroot equal to prefix. This creates a special configuration for binutils and GCC which may help you here.
I've had a similar problem lately.
I've used: uClibc-ng-1.0.29, GCC-6.2.0, Linux from Analog Devices (4.6.0 or something close to it) and binutils-2.27. It was a cross-build for ARM. But I think it should also work in this case.
The problem is that when building uClibc, libc.so is not a real binary but a linker script that contains locations of libc.so.1, uclibc_nonshared.a and ld-uClibc.so.1. When uClibc is built the way you did, the linker script (libc.so) provides locations of these libraries with respect to /.
The solutions is to build uClibc like this:
D=home/build-user/toolchain/i486-linux-uclibc;
make \
ARCH=x86 \
DESTDIR=/ \
CROSS=i486-linux-uclibc- \
RUNTIME_PREFIX=${D}/ \
DEVEL_PREFIX=${D}/usr/ \
KERNEL_HEADERS=/home/build-user/toolchain/i486-linux-uclibc/include \
install
The eventual installation location remains the same, but the entrances in libc.so will contain now the correct paths to the missing/not-found libraries.
If you need for some reason RUNTIME_PREFIX to be the same as DEVEL_PREFIX then keep it. But uClibc's .config file suggests the way I proposed. Note that it may also affect building of GCC.
I have compiled Ffmpeg (1.0) with newt configuration:
./configure --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice --disable-avfilter --disable-pthreads --disable-everything --enable-muxer=flv --enable-encoder=flv --enable-encoder=h263 --disable-mmx --disable-shared --prefix=bin/ --disable-protocols --disable-network --disable-debug --disable-asm --disable-stripping
It compiled - no errors - headers and libs (static .a) are in place. (special experimental cigwin, experimental gcc, with no asm options, and no known by ffmpeg platform defines) (yet I have compiled and tested boost on it)
Now I try to compile my app. I get next exceptions:
../ffmpeg-1.0/bin/lib/libavcodec.a: error: undefined reference to 'exp'
../ffmpeg-1.0/bin/lib/libavcodec.a: error: undefined reference to 'log'
My compiler build line looks like this:
g++ -static -emit-swf -o CloudClient.swf -I../boost/boost_libraries/install-dir/include -I../ffmpeg-1.0/bin/include -L../boost/boost_libraries/install-dir/lib -L../ffmpeg-1.0/bin/lib \
timer.o \
audio_encoder.o \
audio_generator.o \
video_encoder.o \
video_generator_rainbow.o \
simple_synchronizer.o \
multiplexer.o \
transmitter.o \
graph_runner.o \
cloud_client.o \
-pthread \
-lswscale \
-lavutil \
-lavformat \
-lavcodec \
-lboost_system \
-lboost_date_time \
-lboost_thread
So as you see quite complex and I already have all object files compiled and ready... Only one thing left - link it all to ffmpeg (striped from ffmpeg version compiled with boost)
Tried adding -lm - no help...
Well here my question is - how to get list of libraries ffmpeg linked to (like -lm etc)?
If in Linux, try
ldd /path/to/ffmpeg-binary
or
ldd `which ffmpeg`