Adrill icon indicating copy to clipboard operation
Adrill copied to clipboard

1>clang.exe: error: linker command failed with exit code 1 (use -v to see invocation)

Open mrkio9 opened this issue 1 year ago • 6 comments

I build it but it has error. i cannt understand this. please help me Build started... 1>------ Build started: Project: adrill, Configuration: Debug x64 ------ 1>ANDROID_HOME=F:\\Microsoft\AndroidSDK\25 1>ANT_HOME=D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Apps\apache-ant-1.9.3 1>JAVA_HOME=C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot 1>NDK_ROOT=F:\\Microsoft\AndroidNDK64\android-ndk-r16b 1>ANDROID_HOME=F:\\Microsoft\AndroidSDK\25 1>ANT_HOME=D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Apps\apache-ant-1.9.3 1>JAVA_HOME=C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot 1>NDK_ROOT=F:\\Microsoft\AndroidNDK64\android-ndk-r16b 1>main.cc 1>selinux.cc 1>sdk_code.cc 1>elf_dlfcn.cc 1>file_utils.cc 1>ptrace_wrapper.cc 1>call_procedure.cc 1>call_procedure-x86.cc 1>clang.exe: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument] 1>clang.exe: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument] 1> undefined reference to 'CallProcedure::returnValue()' 1> undefined reference to 'CallProcedure::returnValue()' 1> undefined reference to 'CallProcedure::returnValue()' 1> undefined reference to 'CallProcedure::returnValue()' 1> undefined reference to 'CallProcedure::_setupCall(unsigned long, std::__ndk1::vector<long, std::__ndk1::allocator<long> > const&)' 1> undefined reference to 'CallProcedure::_checkCall()' 1> undefined reference to 'strtof_l' 1> undefined reference to 'strtod_l' 1>clang.exe: error: linker command failed with exit code 1 (use -v to see invocation) 1>D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Application Type\Android\3.0\Android.Common.targets(119,5): error MSB6006: "clang.exe" exited with code 1. 1>Done building project "adrill.vcxproj" -- FAILED. 2>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug x64 ------ 2>Project not selected to build for this solution configuration ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 1 skipped ==========

mrkio9 avatar Mar 07 '23 17:03 mrkio9

From the file lists:

1>main.cc 1>selinux.cc 1>sdk_code.cc 1>elf_dlfcn.cc 1>file_utils.cc 1>ptrace_wrapper.cc 1>call_procedure.cc 1>call_procedure-x86.cc

And the build hint:

Configuration: Debug x64

You might have compiled call_procedure-x86.cc instead of call_procedure-x64.cc on x64 platform.

mustime avatar Mar 08 '23 00:03 mustime

From the file lists:

1>main.cc 1>selinux.cc 1>sdk_code.cc 1>elf_dlfcn.cc 1>file_utils.cc 1>ptrace_wrapper.cc 1>call_procedure.cc 1>call_procedure-x86.cc

And the build hint:

Configuration: Debug x64

You might have compiled call_procedure-x86.cc instead of call_procedure-x64.cc on x64 platform.

i tried but its not impossible `F:\Adrill-main\Adrill-main>F:\Adrill-main\Adrill-main\build.bat

F:\Adrill-main\Adrill-main>cmake -S . -B build -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=21 -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_ANDROID_NDK=F:/SDK/ndk/22.0.7026061 -- Building for: Visual Studio 16 2019 -- Android: Targeting API '21' with architecture 'x86', ABI 'x86', and processor 'i686' -- Android: Selected unified Clang toolchain -- The C compiler identification is Clang 5.0.300080 -- The CXX compiler identification is Clang 5.0.300080 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: F:/SDK/ndk/22.0.7026061/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: F:/SDK/ndk/22.0.7026061/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done (4.7s) -- Generating done (0.0s) CMake Warning: You are using Visual Studio tools for Android, which does not support standalone executables. However, the following executable targets do not have the ANDROID_GUI property set, and thus will not be built as expected. They will be built as shared libraries with executable filenames:

adrill

-- Build files have been written to: F:/Adrill-main/Adrill-main/build

F:\Adrill-main\Adrill-main>cmake --build build --parallel 8 --target adrill Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

ANDROID_HOME=F:\Microsoft\AndroidSDK\25 ANT_HOME=D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Apps\apache-ant-1.9.3 JAVA_HOME=C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot NDK_ROOT=F:\Microsoft\AndroidNDK64\android-ndk-r16b 1>Checking Build System ANDROID_HOME=F:\Microsoft\AndroidSDK\25 ANT_HOME=D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Apps\apache-ant-1.9.3 JAVA_HOME=C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot NDK_ROOT=F:\Microsoft\AndroidNDK64\android-ndk-r16b 1>Building Custom Rule F:/Adrill-main/Adrill-main/CMakeLists.txt main.cc selinux.cc sdk_code.cc elf_dlfcn.cc file_utils.cc ptrace_wrapper.cc call_procedure.cc call_procedure-x86.cc clang.exe: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument] clang.exe: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument] undefined reference to 'CallProcedure::returnValue()' undefined reference to 'CallProcedure::returnValue()' undefined reference to 'CallProcedure::returnValue()' undefined reference to 'CallProcedure::returnValue()' undefined reference to 'CallProcedure::_setupCall(unsigned long, std::__ndk1::vector<long, std::__ndk1::allocator > const&)' undefined reference to 'CallProcedure::_checkCall()' undefined reference to 'strtof_l' undefined reference to 'strtod_l' clang.exe: error: linker command failed with exit code 1 (use -v to see invocation) D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Application Type\Android\3.0\A ndroid.Common.targets(119,5): error MSB6006: "clang.exe" exited with code 1. [F:\Adrill-main\Adrill-main\build\adrill.v cxproj]`

mrkio9 avatar Mar 09 '23 08:03 mrkio9

From the file lists:

1>main.cc 1>selinux.cc 1>sdk_code.cc 1>elf_dlfcn.cc 1>file_utils.cc 1>ptrace_wrapper.cc 1>call_procedure.cc 1>call_procedure-x86.cc

And the build hint:

Configuration: Debug x64

You might have compiled call_procedure-x86.cc instead of call_procedure-x64.cc on x64 platform.

I build it by add 3 lines in all file in backend bool CallProcedure::_setupCall(uintptr_t remoteAddr, const std::vector<intptr_t>& args){} intptr_t CallProcedure::returnValue() {} bool CallProcedure::_checkCall() {}

but after build that, it has error again. and now, i cannt understand how to fix it ? too hard to build adrill but i loved it C:\Users\Admin>adb shell "su 0 /data/local/tmp/adrill -pname com.ketchapp.rider --libpath /data/local/tmp/libsoLib.so" /data/local/tmp/adrill: no closing quote <- how to fix it?

mrkio9 avatar Mar 09 '23 15:03 mrkio9

-- Check for working CXX compiler: F:/SDK/ndk/22.0.7026061/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe

The output above indicates the clang compiler is of arch x86_64. That won't gonna work on x86 compilation

mustime avatar Mar 10 '23 02:03 mustime

See call_procedure-x86.cc limitation here:

https://github.com/mustime/Adrill/blob/b8edc3c1d6dd2615623f0e4e465d39e3e85e0996/source/backend/x86/call_procedure-x86.cc#L11

It means the following code would not be compiled at all unless the compiler is arch x86. That's why you got the undefined references linking error.

I don't have Windows right now. But on my MacOS's NDK, the x86 version of NDK compiler should be ${NDK_ROOT}/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android21-clang++.

mustime avatar Mar 10 '23 02:03 mustime

From the file lists:

1>main.cc 1>selinux.cc 1>sdk_code.cc 1>elf_dlfcn.cc 1>file_utils.cc 1>ptrace_wrapper.cc 1>call_procedure.cc 1>call_procedure-x86.cc

And the build hint:

Configuration: Debug x64

You might have compiled call_procedure-x86.cc instead of call_procedure-x64.cc on x64 platform.

I build it by add 3 lines in all file in backend bool CallProcedure::_setupCall(uintptr_t remoteAddr, const std::vector<intptr_t>& args){} intptr_t CallProcedure::returnValue() {} bool CallProcedure::_checkCall() {}

but after build that, it has error again. and now, i cannt understand how to fix it ? too hard to build adrill but i loved it C:\Users\Admin>adb shell "su 0 /data/local/tmp/adrill -pname com.ketchapp.rider --libpath /data/local/tmp/libsoLib.so" /data/local/tmp/adrill: no closing quote <- how to fix it?

And for the no closing quote error, try command like this:

adb shell "su -c '/data/local/tmp/adrill --pname com.ketchapp.rider --libpath /data/local/tmp/libsoLib.so'"

mustime avatar Mar 10 '23 02:03 mustime