ProcursusTeam / Procursus

Modern *OS Bootstrap
https://apt.procurs.us
BSD Zero Clause License
868 stars 126 forks source link

Clang is unable to find dependencies #549

Closed AR-Spectacular closed 3 years ago

AR-Spectacular commented 3 years ago

Hi, when using clang to compile a library, for example, clang downloader.c -o downloader -lcurl I get a library not found error this has to be overcome by explisitly setting dylib However, this task becomes s especially tedious when using automake/autoconf as each include directory and lib has to be set.

Diatrus commented 3 years ago

Does setting -L(library path) not work? I have people who compile Procursus with their phones and it works fine for them.

AR-Spectacular commented 3 years ago

Unfortunately that is not the case: clang -v curl.c -I/usr/include -L/usr/lib -lcurl

clang version 10.0.0 (https://github.com/ProcursusTeam/Procursus.git 4c55e9c553549f0f842d3e03247f7f47be2c6e76)
Target: arm64-apple-ios12.0
Thread model: posix
InstalledDir: /usr/bin
 "/usr/lib/llvm-10/bin/clang-10" -cc1 -triple arm64-apple-ios14.3.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-
function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name curl.c -mrelocation-model pic 
-pic-level 2 -mthread-model posix -mframe-pointer=non-leaf -fno-rounding-math -masm-verbose -munwind-tables -target-sdk-version=14.3 -target-cpu ap
ple-a7 -target-feature +fp-armv8 -target-feature +neon -target-feature +crypto -target-feature +zcm -target-feature +zcz -target-feature +sha2 -tar
get-feature +aes -target-abi darwinpcs -fallow-half-arguments-and-returns -dwarf-column-info -debugger-tuning=lldb -target-linker-version 609.7 -v 
-resource-dir /usr/lib/llvm-10/lib/clang/10.0.0 -isysroot /var/mobile/theos/sdks/iPhoneOS14.3.sdk -I /usr/include -internal-isystem /var/mobile/the
os/sdks/iPhoneOS14.3.sdk/usr/local/include -internal-isystem /usr/lib/llvm-10/lib/clang/10.0.0/include -internal-externc-isystem /var/mobile/theos/
sdks/iPhoneOS14.3.sdk/usr/include -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 147 -stack-protector 1 -fblocks -fencode-extended-
block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fobjc-runtime=ios-14.3.0 -fmax-type-align=16 -fdiagnostics-show-option -f
color-diagnostics -o /var/tmp/curl-aebd1e.o -x c curl.c
clang -cc1 version 10.0.0 based upon LLVM 10.0.0 default target arm64-apple-ios12.0
ignoring nonexistent directory "/var/mobile/theos/sdks/iPhoneOS14.3.sdk/usr/local/include"
ignoring nonexistent directory "/var/mobile/theos/sdks/iPhoneOS14.3.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include
 /usr/lib/llvm-10/lib/clang/10.0.0/include
 /var/mobile/theos/sdks/iPhoneOS14.3.sdk/usr/include
 /var/mobile/theos/sdks/iPhoneOS14.3.sdk/System/Library/Frameworks (framework directory)
End of search list.
 "/usr/bin/ld" -demangle -lto_library /usr/lib/llvm-10/lib/libLTO.dylib -no_deduplicate -dynamic -arch arm64 -platform_version ios 14.3.0 14.3 -sys
libroot /var/mobile/theos/sdks/iPhoneOS14.3.sdk -o a.out -L/usr/lib /var/tmp/curl-aebd1e.o -lcurl -lSystem
ld: library not found for

Another thing to note, that although clang says that it will include /usr/include it doesn't - the -I/usr/include flag has to be used.

Diatrus commented 3 years ago

I can fix it not including usr/include by default sometime soon. Can you confirm for me that you have libcurl-openssl-dev installed?

AR-Spectacular commented 3 years ago

Yes, I do indeed have that package installed. Perhaps, you could ask those who build on their phone if they experience the same issue

Diatrus commented 3 years ago

I actually do build on my phone and don't experience it, that's why I'm trying to get more information from you.

AR-Spectacular commented 3 years ago

I actually do build on my phone and don't experience it, that's why I'm trying to get more information from you.

I meant no offence Is there any other information I can provide you with.

Diatrus commented 3 years ago

I think I've isolated the issue. For some odd reason it just really doesn't want to include /usr/lib (and only /usr/lib) in the search path. I will look into this.

AR-Spectacular commented 3 years ago

Thank you for your time. by the way, is there any way I can contribute to the project - I think it's awesome

Diatrus commented 3 years ago

If you would like to contribute, feel free to join the Discord server at https://diatr.us/discord and get some more information there. Our contribution docs are currently outdated, but the people in that server and I will be happy to help you.

badger200 commented 3 years ago

@AR-Spectacular btw, there are a variety of nasty issues you can experience building source from anything under /var/mobile. I would strongly advise you to move your source etc to something like /var/theos/ (your logs mention /var/mobile/theos.)

Wish I could give you a link to explain but my notes aren’t accessible at the moment. iOS has issues executing certain syslevel things from the user Data partition.

Diatrus commented 3 years ago

This should be fixed in the clang updates I'm pushing today. 👍