Clang on Raspberry Pi/Raspbian Error? - linux

When I try to run clang as my C compiler I get an error (I think a linker error)
Compilation started at Sun Nov 11 14:34:55
make -k
clang -std=c99 -ggdb -o0 -Wall -Werror helloworld.c -o helloworld
clang: warning: unknown platform, assuming -mfloat-abi=soft
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [helloworld] Error 1
Compilation exited abnormally with code 2 at Sun Nov 11 14:34:56
I actually re-installed the Raspbian image thinking that the problem would go away but it persists. Raspbian version is the latest Raspbian Wheezy hard float ABI (2012-10-28).

As you've essentially figured out, the installed clang is unusably broken. If you installed this through a package manager, complain to whoever distributes the package, because they clearly didn't bother testing it.

Related

Running ghc fails with message about iOS simulator

I tried running ghc to compile a haskell program, and I get the following error:
$ ghc --make main
Linking main ...
ld: building for macOS, but linking in object file built for iOS Simulator, file 'main.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`clang' failed in phase `Linker'. (Exit code: 1)
Here are some details about my machine:
macOS Catalina 10.15.7
Xcode 12.2
The Xcode developer tools were installed with xcode-select --install
I installed ghc with brew install ghc
Some other output that might be relevant:
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
If I run ghc --make main -v, this is what the output looks like right before it fails (apologies for the long line, not sure how to format this better):
clang -o main -fno-common -U__PIC__ -D__PIC__ -Wl,-no_compact_unwind main.o -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/base-4.14.0.0 -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/integer-gmp-1.0.3.0 -L/usr/local/Cellar/ghc/8.10.1_2/libexec/integer-gmp/lib -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/ghc-prim-0.6.1 -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/rts /var/folders/5j/wwtlv8lx0m5fmhc3hy5w5_000000gp/T/ghc49162_0/ghc_2.o -Wl,-u,_base_GHCziTopHandler_runIO_closure -Wl,-u,_base_GHCziTopHandler_runNonIO_closure -Wl,-u,_ghczmprim_GHCziTuple_Z0T_closure -Wl,-u,_ghczmprim_GHCziTypes_True_closure -Wl,-u,_ghczmprim_GHCziTypes_False_closure -Wl,-u,_base_GHCziPack_unpackCString_closure -Wl,-u,_base_GHCziWeak_runFinalizzerBatch_closure -Wl,-u,_base_GHCziIOziException_stackOverflow_closure -Wl,-u,_base_GHCziIOziException_heapOverflow_closure -Wl,-u,_base_GHCziIOziException_allocationLimitExceeded_closure -Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure -Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure -Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure -Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure -Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure -Wl,-u,_base_ControlziExceptionziBase_absentSumFieldError_closure -Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure -Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure -Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure -Wl,-u,_base_GHCziConcziSync_runSparks_closure -Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_closure -Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure -Wl,-u,_base_GHCziConcziSignal_runHandlersPtr_closure -Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure -Wl,-u,_base_GHCziTopHandler_runMainIO_closure -Wl,-u,_ghczmprim_GHCziTypes_Czh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Izh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Fzh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Dzh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Wzh_con_info -Wl,-u,_base_GHCziPtr_Ptr_con_info -Wl,-u,_base_GHCziPtr_FunPtr_con_info -Wl,-u,_base_GHCziInt_I8zh_con_info -Wl,-u,_base_GHCziInt_I16zh_con_info -Wl,-u,_base_GHCziInt_I32zh_con_info -Wl,-u,_base_GHCziInt_I64zh_con_info -Wl,-u,_base_GHCziWord_W8zh_con_info -Wl,-u,_base_GHCziWord_W16zh_con_info -Wl,-u,_base_GHCziWord_W32zh_con_info -Wl,-u,_base_GHCziWord_W64zh_con_info -Wl,-u,_base_GHCziStable_StablePtr_con_info -Wl,-u,_hs_atomic_add8 -Wl,-u,_hs_atomic_add16 -Wl,-u,_hs_atomic_add32 -Wl,-u,_hs_atomic_add64 -Wl,-u,_hs_atomic_sub8 -Wl,-u,_hs_atomic_sub16 -Wl,-u,_hs_atomic_sub32 -Wl,-u,_hs_atomic_sub64 -Wl,-u,_hs_atomic_and8 -Wl,-u,_hs_atomic_and16 -Wl,-u,_hs_atomic_and32 -Wl,-u,_hs_atomic_and64 -Wl,-u,_hs_atomic_nand8 -Wl,-u,_hs_atomic_nand16 -Wl,-u,_hs_atomic_nand32 -Wl,-u,_hs_atomic_nand64 -Wl,-u,_hs_atomic_or8 -Wl,-u,_hs_atomic_or16 -Wl,-u,_hs_atomic_or32 -Wl,-u,_hs_atomic_or64 -Wl,-u,_hs_atomic_xor8 -Wl,-u,_hs_atomic_xor16 -Wl,-u,_hs_atomic_xor32 -Wl,-u,_hs_atomic_xor64 -Wl,-u,_hs_cmpxchg8 -Wl,-u,_hs_cmpxchg16 -Wl,-u,_hs_cmpxchg32 -Wl,-u,_hs_cmpxchg64 -Wl,-u,_hs_atomicread8 -Wl,-u,_hs_atomicread16 -Wl,-u,_hs_atomicread32 -Wl,-u,_hs_atomicread64 -Wl,-u,_hs_atomicwrite8 -Wl,-u,_hs_atomicwrite16 -Wl,-u,_hs_atomicwrite32 -Wl,-u,_hs_atomicwrite64 -Wl,-search_paths_first -Wl,-dead_strip -lHSbase-4.14.0.0 -lHSinteger-gmp-1.0.3.0 -lHSghc-prim-0.6.1 -lHSrts -lCffi -liconv -lgmp -lm -ldl -Wl,-dead_strip_dylibs
ld: building for macOS, but linking in object file built for iOS Simulator, file 'main.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Error building ace in solaris and linux

I have issues building ace 5.3 in linux. I get the following error.
g++ -W -Wall -Wpointer-arith -pipe -O3 -g -Wno-uninitialized -fno-implicit-templates -DACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT -I/home/vwickram/Ubuntu_Release/tmp/ACE_wrappers -DACE_HAS_EXCEPTIONS -L/home/vwickram/Ubuntu_Release/tmp/ACE_wrappers/ace -L./ -o gperf .obj/gperf.o .obj/Options.o .obj/Iterator.o .obj/Gen_Perf.o .obj/Key_List.o .obj/List_Node.o .obj/Hash_Table.o .obj/Bool_Array.o .obj/Vectors.o .obj/Version.o -lACE -ldl -lpthread
/home/vwickram/Ubuntu_Release/tmp/ACE_wrappers/ace/libACE.so: undefined reference to `aio_return'
/home/vwickram/Ubuntu_Release/tmp/ACE_wrappers/ace/libACE.so: undefined reference to `aio_read'
/home/vwickram/Ubuntu_Release/tmp/ACE_wrappers/ace/libACE.so: undefined reference to `aio_cancel'
/home/vwickram/Ubuntu_Release/tmp/ACE_wrappers/ace/libACE.so: undefined reference to `aio_error'
/home/vwickram/Ubuntu_Release/tmp/ACE_wrappers/ace/libACE.so: undefined reference to `aio_write'
/home/vwickram/Ubuntu_Release/tmp/ACE_wrappers/ace/libACE.so: undefined reference to `aio_suspend'
collect2: ld returned 1 exit status
make[2]: *** [gperf] Error 1
make[2]: Leaving directory `/home/vwickram/Ubuntu_Release/tmp/ACE_wrappers/apps/gperf/src'
make[1]: *** [src.subdir] Error 2
make[1]: Leaving directory `/home/vwickram/Ubuntu_Release/tmp/ACE_wrappers/apps/gperf'
make: *** [all.nested] Error 2
When I googled I found out it is a bug in ace5.3 and it is fixed in later versions. So I got the ace 6.3 version and managed to build in linux. However, ace 6.3 wouldn't build in SolarisX86 with sunstudio 11 compiler. I get the following.
ACE::Monitor_Control::Monitor_Point_Registry*ACE_Singleton<ACE::Monitor_Control::Monitor_Point_Registry,ACE_Thread_Mutex>::instance() /home/vwickram/Ubuntu_Release/ace6.3/tmp/ACE_wrappers/lib/libACE.so
ld: fatal: Symbol referencing errors. No output written to ace_gperf
gmake[1]: *** [ace_gperf] Error 1
gmake[1]: Leaving directory `/home/vwickram/Ubuntu_Release/ace6.3/tmp/ACE_wrappers/apps/gperf/src'
gmake: *** [gperf] Error 2
Could someone help please? I would still prefer using ace 5.3 version and use a patch to fix the bug and make it build on linux.
I faced a similar issue on ubuntu 14.04 for Ace 5.5.
I checked the whole console log and it couldnt find librt.so in /usr/lib and librt.so.1 in /lib/
I searched for these and found them in /usr/lib/x86_64-linux-gnu/librt.so and /lib/x86_64-linux-gnu/librt.so.1
I copied them to respected folders and then it worked fine without any errors.
On i386 librt is found in /usr/lib/i386-linux-gnu/librt.so
Install the asynchronous library.
For example in Fedora-linux it'll be libaio-devel. (Mostly not needed, but some issues may occur if not installed)
After Installing compile with the following flags.
cc file.c -lrt
-lrt - link (lrt)read time library.

fatal error: 'algorithm' file not found while running Debian Linux

I recently updated my clang++ compiler in my debian Linux to version 3.5. I compile my file using clang++ with the line in terminal
clang++ -std=c++1y -stdlib=libc++ -c -g -O0 -Wall -Wextra -pedantic main.cpp
what show up afterward is
main.cpp:5:10:fatal error: 'algorithm' file not found
#include <algorithm>
1 error generated
*** [main.o] Error 1
but when I tried using
locate algorithm
There are many file in the /usr/include/c++/4.6/ showed up, so I believe that the file are in there. I am new to Linux and if possible, please make explanation to be more detailed.
Thanks for your time.

ssocr #my_libs#: No such file or directory

I recently downloaded ssocr, and also install all dependencies. But when I want to run make I get the following error:
cc: error: #my_libs#: No such file or directory
make: * [ssocr] Error 1
I have no idea what is the problem and also can't find any solution for it.
The os i have tryed to intall the ssocr is Ubuntu 14.04 LTS (Trusty Tahr)
UPDATE (whole output)
cc ssocr.o imgproc.o help.o -L/usr/local/lib -lImlib2 #my_libs# -o ssoc
cc: error: #my_libs#: No such file or directory
make: * [ssocr] Error 1
the link-command comes from
imlib2-config --libs
Try to repair the imlib2-config output. Second, I had also to add -lm. The commandline looks for me like
cc ssocr.o imgproc.o help.o -L/usr/lib64 -lImlib2 -L/lib64 -lX11 -lm -o ssocr

Build sqlcipher on ubuntu

Hi I'm trying to build sqlcipher on ubuntu (11.10 minimal). On Mac OS X I had no problems though.
I followed the instructions from sqlcipher.net. First step was configure. I tried to execute configure with the following command:
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
but I got the following error message: "configure: error: C compiler cannot create executables"
In the config.log some lines caught my eyes but I don't know how to fix it:
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
configure:2544: $? = 0
configure:2551: gcc -V >&5
gcc: error: unrecognized option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2555: $? = 4
configure:2578: checking for C compiler default output file name
configure:2600: gcc -DSQLITE_HAS_CODEC -lcrypto conftest.c >&5
/usr/bin/ld: cannot find -lcrypto
collect2: ld returned 1 exit status
Has anybody successfully build sqlcipher on ubuntu yet? Regards
You will need to install the GNU compiler toolchain in order to build from source. Execute the following command in a terminal.
$ sudo apt-get install build-essential

Resources