I am following the Udemy Haskell course, which at one point I'm shown to download Haskell using the Stack option. I've configured my $PATH and ran stack setup when I run into an issue.
configure: WARNING: configure can't recognize your CPP program, you may need to set --with-hs-cpp-flags=FLAGS explicitly
configure: error: in `/Users/Dylan/.stack/programs/x86_64-osx/ghc-8.0.2.temp/ghc-8.0.2':
configure: error: C compiler cannot create executables
I have looked into .stack/programs/x86_64-osx/ghc-8.0.2.temp/ghc-8.0.2/config.log and found this...
configure:2234: checking for path to top of build tree
configure:2255: result: /Users/Dylan/.stack/programs/x86_64-osx/ghc-8.0.2.temp/$
configure:2981: checking for perl
configure:2999: found /usr/bin/perl
configure:3011: result: /usr/bin/perl
configure:3070: checking for a BSD-compatible install
configure:3138: result: /usr/bin/install -c
configure:3152: checking whether ln -s works
configure:3156: result: yes
configure:3168: checking for gsed
configure:3199: result: sed
configure:3211: checking XCode version
configure:3222: result: 8.3.3
configure:3226: XCode version component 1: 8
configure:3228: XCode version component 2: 3
configure:3263: checking for gcc
configure:3281: found /usr/bin/gcc
configure:3293: result: /usr/bin/gcc
configure:3573: WARNING: configure can't recognize your CPP program, you may ne$
configure:3623: checking for llc-3.7
configure:3656: result: no
configure:3739: checking for llc
configure:3772: result: no
configure:3872: checking for opt-3.7
configure:3905: result: no
configure:3988: checking for opt
configure:4021: result: no
configure:4120: checking for ld
configure:4138: found /usr/bin/ld
configure:4150: result: /usr/bin/ld
configure:4388: checking for gcc
configure:4415: result: /usr/bin/gcc
configure:4644: checking for C compiler version
configure:4653: /usr/bin/gcc --version >&5
I am able to read configure: WARNING: configure can't recognize your CPP program, you may need to set --with-hs-cpp-flags=FLAGS explicitly, but I am not sure how or where to do that. I've found my settings.in file...
[("GCC extra via C opts", "#GccExtraViaCOpts#"),
("C compiler command", "#SettingsCCompilerCommand#"),
("C compiler flags", "#SettingsCCompilerFlags#"),
("C compiler link flags", "#SettingsCCompilerLinkFlags#"),
("C compiler supports -no-pie", "#SettingsCCompilerSupportsNoPie#"),
("Haskell CPP command","#SettingsHaskellCPPCommand#"),
("Haskell CPP flags","#SettingsHaskellCPPFlags#"),
("ld command", "#SettingsLdCommand#"),
("ld flags", "#SettingsLdFlags#"),
("ld supports compact unwind", "#LdHasNoCompactUnwind#"),
("ld supports build-id", "#LdHasBuildId#"),
("ld supports filelist", "#LdHasFilelist#"),
("ld is GNU ld", "#LdIsGNULd#"),
("ar command", "#SettingsArCommand#"),
("ar flags", "#ArArgs#"),
("ar supports at file", "#ArSupportsAtFile#"),
("touch command", "#SettingsTouchCommand#"),
("dllwrap command", "#SettingsDllWrapCommand#"),
("windres command", "#SettingsWindresCommand#"),
("libtool command", "#SettingsLibtoolCommand#"),
("perl command", "#SettingsPerlCommand#"),
("cross compiling", "#CrossCompiling#"),
("target os", "#HaskellTargetOs#"),
("target arch", "#HaskellTargetArch#"),
("target word size", "#WordSize#"),
("target has GNU nonexec stack", "#HaskellHaveGnuNonexecStack#"),
("target has .ident directive", "#HaskellHaveIdentDirective#"),
("target has subsections via symbols", "#HaskellHaveSubsectionsViaSymbols#"),
("Unregisterised", "#Unregisterised#"),
("LLVM llc command", "#SettingsLlcCommand#"),
("LLVM opt command", "#SettingsOptCommand#")
]
But again, I do not know what to do with it. Sorry, if my question is basic, but I have not done something similar to this before, and what I have found online has been difficult to interpret how it is applicable to my situation.
Any help would be greatly appreciated. 😀
#n.m Commented a link leading me to a question's answer that recommended I check my xCode listed version of the developer command line tools. Turns out my version was fine, but I did later find this line in .stack/programs/x86_64-osx/ghc-8.0.2.temp/ghc-8.0.2/config.log that led me to the solution of my problem.
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command
sudo xcodebuild -license allowed me to then run stack install successfully.
Related
I have a C++ project setup with CMake, running on Mac. Recently I am looking into adding Fortify to do auto code analyzation. I am using Fortify version 22.1.
After set up the CMake and shell scripts, I found that if I compile with more than one CPU (using -j), the compiler (c++ or g++) will have issues generating the libs. Sometimes it will pass and successfully generate the Fortify output, but others it will just error out. Multi CPUs compile fine for this project without running Fortify.
I also see this error when I compile with Fortify (no matter it success or not):
[error]: Translator execution failed. Please consult the Troubleshooting section of the User Manual.
Translator returned status 1:
error: unable to handle compilation, expected exactly one compiler job in ''
This error always happens after a "Linking CXX xxxxx xxxx". I can't find any documentation about them.
Does anyone know how to solve this? Thank you.
Update more details about my setup:
I use shell files to wrap the sourceanalyzer like this:
#!/bin/bash
exec sourceanalyzer -b MyApp /Library/Developer/CommandLineTools/usr/bin/c++ "$#"
And my CMake setup like this:
if (${ENABLE_FORTIFY} EQUAL 1)
set(CMAKE_CC_COMPILER ${AVSxAppDALDefaultImplementation_SOURCE_DIR}/scripts/fortify-build-cc.sh)
set(CMAKE_CXX_COMPILER ${AVSxAppDALDefaultImplementation_SOURCE_DIR}/scripts/fortify-build-cxx.sh)
endif()
My shell script to run CMake and then to the scan:
cmake $PACKAGEPATH \
...
-DENABLE_FORTIFY="${ENABLE_FORTIFY}"
echo "---BUILDING---"
make release
if [[ $ENABLE_FORTIFY == 1 ]]; then
echo "---RUNNING FORTIFY SCAN---"
sourceanalyzer -b ${CURRENT_PROJECT_NAME} -scan -f fortify_scan_result_${CURRENT_PROJECT_NAME}.txt
fi
I'm trying to compile the module in Eclipse and generate the additional output disassembles
I've added these Tool Flags
-fverbose-asm -Wa,-adhln -save-temps=obj > %OutFile%.asm
But I receive this error
clang: error: unsupported argument '-adhln' to option 'Wa,'
Does anybody had a similar issue? If so please help
Many Thanks
OK so the target was to generate the assemblies with the instructions HEX and relative addresses
I was not able to do that using Eclipse >> Tool Flags so I simply left one flag:
-save-temps=obj
Which generates AT&T systax assemblies but without details like (instruction Hex or relative address)
But I've managed to generate INTEL syntax assemblies with all the details I need to debug my problem using objdump
objdump -d -M intel -S DMAProcesor.o > DMAProcessor.asm
I'm trying to compile Valgring3.16.1 with aarch64-linux-gnu-gcc (for xilinx zynq-mp board)
the ./configure stage passed ok.
when I run:
make CC= ..... /bin/aarch64-linux-gnu-gcc
I got this error:
aarch64-linux-gnu-gcc: error: unrecognized command line option '-m64'
How can I fix it?
any help will be appreciated,
Tzipi Kluska
If you need to change compiler or flags, you should do that when you run configure, not when you run make. Otherwise configure sees and detects a different environment than what you get with make.
The docs have the answer you ask for.
-m64 is available for other architectures than AArch64.
If you need the "Machine-Dependent Options" you should read AArch64 options.
I'm running g++ compiler on windows 10 with mingw.
On checking compiler version in cmd I get the following:
g++ --version- g++ (MinGW.org GCC Build-2) 9.2.0
same with c++ --version
When I compiled a cpp program making use of structured bindings I got a warning:
warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
But otherwise the code ran fine.
Does everyone get this warning or am I running a lower version compiler?
I'm using an extension - Competitive programming helper, and this warning interrupts the process.
Hence, if it is the case that everyone gets this warning, is there a way I can block version specific warnings only without having to block all compiler warnings.
TIA.
As the warning itself says:
structured bindings only available with '-std=c++17' or '-std=gnu++17'.
Meaning, you are using cpp version 14 or lower as compiler. However, you also have cpp 17 or higher installed on your system to get such kind of warning.
Your program will still run but with the warning.
For Windows:
If you are using VS code (assuming that you are already using code runner) then,
Open Settings(UI) of VS code (Ctrl + ,)
Search for Code-runner: Executor Map
Click on Edit in settings.json
Something like this will appear:
In cpp section: change it to "cd $dir && g++ -std=c++17 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt" as in the picture above.
It is finally done now.
Below steps are for linux.
Open .bashrc file using command sudo gedit ~/.bashrc in terminal.
In the .bashrc file, add alias g++="g++ --std=c++2a" at the end of the file.
This will always compile your file in cpp+20 version.
Once done, you will not get any warning.
Note:
It is not mandatory to use cpp+20. You can use any version you like.
Change the version according to this website
https://www.learncpp.com/cpp-tutorial/configuring-your-compiler-choosing-a-language-standard/
I am trying to compile kernel for Cyanogenmod 13. I am getting error
ERROR: modpost: Found 2 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
To build the kernel despite the mismatches, build with:
'make CONFIG_NO_ERROR_ON_MISMATCH=y'
(NOTE: This is not recommended)
I read it here. That i need to compile my kernel using 4.7.
How can i choose the version of toolchain during cyanogenmod build ??
I believe you need to setup gcc version 4.7 and use CC variable to set it as a compiler. E.g. make target CC=/bin/gcc4.7
More information here and here.
Thanks to #nopasara and his valuable comment.
So i did little research further and discovered that the kernel is compatiable with arm-eabi tool chain not arm-linux-androideabi toolchain. So here is the command i used
export PATH=$PATH:~/android/system/prebuilts/gcc/linux-x86/arm/arm-linux-eabi-4.7/bin/ && export ARCH=arm && export SUBARCH=arm && export CROSS_COMPILE=arm-linux-eabi- && make msm8226_defconfig O=~/android/system/out/target/product/E6790/obj/KERNEL_OBJ
and
make O=~/android/system/out/target/product/E6790/obj/KERNEL_OBJ zImage -j4
To do with this Cyanogenmod add following line to your BoardConfig.mk
TARGET_KERNEL_CROSS_COMPILE_PREFIX := arm-eabi-
and either use
export TARGET_LEGACY_GCC_VERSION=4.7
Or edit ~/android/system/build/core/combo/TARGET_linux-arm.mk and set version in
$(combo_2nd_arch_prefix)TARGET_LEGACY_GCC_VERSION := 4.7