Mono on osx seems to ignore #I in compiled source files - macos

I'm battling paths in Fsharp and Mono on OSX. I have 2 questions:
Is there any way to make mono follow #I paths in Fsharp?
Is some way that I may include the dll in the exe, such that files compiled on one machine may run on another without having to duplicate installation of packages?
Example of the problem is the following: I've installed MathNet.Numerics in a local directory "packages" one level above my source directory using nugget.exe. Running the example:
#I "../packages/MathNet.Numerics.3.6.0/lib/net40/"
#r "MathNet.Numerics.dll"
open MathNet.Numerics
let v = SpecialFunctions.Gamma(0.5)
printfn "%g" v
followed by ";;" gives
...
1.77245
val v : float = 1.772453851
val it : unit = ()
while, when placed in the file monoIgnoresPaths.fsx, I have to also tell mono, where the dll is:
Solsikke:src sporring$ mono --version
Mono JIT compiler version 3.12.0 ((detached/a813491 Thu Dec 11 12:24:44 EST 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: altstack
Notification: kqueue
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: yes(3.6.0svn-mono-(detached/5486eb2)
GC: sgen
Solsikke:src sporring$ echo $MONO_PATH
Solsikke:src sporring$ fsharpc monoIgnoresPaths.fsx
F# Compiler for F# 3.1 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License
Solsikke:src sporring$ mono monoIgnoresPaths.exe
Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'MathNet.Numerics, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'MathNet.Numerics, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null'
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'MathNet.Numerics, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'MathNet.Numerics, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null'
Solsikke:src sporring$ export MONO_PATH=`pwd`/../packages/MathNet.Numerics.3.6.0/lib/net40/;
Solsikke:src sporring$ mono monoIgnoresPaths.exe
1.77245
Is this a bug in Mono?
Thanks, Jon

fsharpc ignores #I (by design), the directive is meant to be used only in fsharpi.
For your second question, you can use --standalone to compile all the references into the binary.

Related

Visual Studio crashes after typing

I haven't used Visual Studio for the past year because of this problem. When I type anything in Visual Studio 2020, 2019, or 2017, the program freezes up to 5 seconds later, and then crashes, leaving no error.
After I crashed in VS 2019 I did some digging and found the errors in AppData\Roaming\Microsoft\VisualStudio\16.0_39fc2ef8\ActivityLog.xml
I found these 4 errors:
Still unable to load MEF component DLL: Could not load file or assembly 'Microsoft.VisualStudio.CppSvc.Internal, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CodeAnalysis\Microsoft.VisualStudio.CodeAnalysis.VCPlugin.dll
Still unable to load MEF component DLL: Could not load file or assembly 'Microsoft.Windows.Simulator.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\platform\diagnosticshub\Microsoft.DiagnosticsHub.VisualStudio.Package.dll
Still unable to load MEF component DLL: Could not load file or assembly 'Microsoft.VisualStudio.LiveShare.LanguageServices.16.3, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\managedlanguages\vbcsharp\languageservices\Microsoft.VisualStudio.LanguageServices.LiveShare.dll
Still unable to load MEF component DLL: Could not load file or assembly 'Microsoft.VisualStudio.LiveShare.LanguageServices.16.3, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\LIVESHARE\Microsoft.PythonTools.LiveShare.dll
System information:
Windows 10 Pro
Visual Studio 16.6.1

LNK1112: Module machine type 'X86' conflicts with target machine type 'x64' Visual Studio Command Prompt error

Before this is flagged as a duplicate: I did make sure that I loaded it in the correct version of VS.
C:\...>vcvars32
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.7.4
** Copyright (c) 2020 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
C:\...>clang build/obj/Core/apu.c.o build/obj/Core/camera.c.o build/obj/Core/cheats.c.o build/obj/Core/debugger.c.o build/obj/Core/display.c.o build/obj/Core/gb.c.o build/obj/Core/joypad.c.o build/obj/Core/mbc.c.o build/obj/Core/memory.c.o build/obj/Core/printer.c.o build/obj/Core/random.c.o build/obj/Core/rewind.c.o build/obj/Core/rumble.c.o build/obj/Core/save_state.c.o build/obj/Core/sgb.c.o build/obj/Core/sm83_cpu.c.o build/obj/Core/sm83_disassembler.c.o build/obj/Core/symbol_hash.c.o build/obj/Core/timing.c.o build/obj/Windows/utf8_compat.c.o build/obj/SDL/font.c.o build/obj/SDL/gui.c.o build/obj/SDL/main.c.o build/obj/SDL/opengl_compat.c.o build/obj/SDL/shader.c.o build/obj/SDL/utils.c.o build/obj/OpenDialog/windows.c.o build/obj/SDL/audio/sdl.c.o build/obj/Windows/resources.o -o build/bin/SDL/sameboy.exe -lmsvcrt -lcomdlg32 -luser32 -lSDL2main -Wl,/MANIFESTFILE:NUL -Wl,/NODEFAULTLIB:libcmt.lib -lSDL2 -lopengl32 -Wl,/subsystem:windows
build\obj\Windows\resources.o : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'
clang: error: linker command failed with exit code 1112 (use -v to see invocation)
Emphasis on the vcvars32, the 'x86', and the ultimate problem of "target machine type 'x64'".
I already tried completely deleting the /build/ folder to ensure that artifacts of a previous build attempts were not causing problems. The project in question (SameBoy) is intended to be built for x86. I also tried completely redoing everything with make (after ensuring that I was in an x86 prompt), and I've been certain to link only to x86 libraries. All of the above encounters the same error.

qbs.h not found while compiling Qt Creator 4.7.0 from source on Mac

I'm trying to compile Qt Creator from source on MacOS 10.13 from the following repository:
https://github.com/qt-creator/qt-creator
I followed the instructions in README.md but had no success.
Most likely I missed out something.
Steps that I've done:
Installed latest Xcode
Installed LLVM using brew install --with-toolchain llvm
Installed QBS using brew install qbs
(that also brew-installed qt 5.11.1 as a dependency to /usr/local/opt/qt)
Installed precompiled Qt 5.11.1 with QtWebEngine (without sources)
Cloned Qt Creator repository into /Users/username/builds/qtcreator_src
Created directory for out-of-source build: /Users/username/builds/qtc_build
From that directory ran following commands:
export LLVM_INSTALL_DIR=/usr/local/opt/llvm
export QBS_INSTALL_DIR=/usr/local/opt/qbs
PATH=/usr/local/opt/qt/bin:/usr/local/opt/llvm/bin:$PATH
qmake -r /Users/username/builds/qtcreator_src/4.7
make
After approximately 40 minutes of compilation I get following error:
../../../../qtcreator_src/4.7/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp:29:10: fatal error: 'qbs.h' file not found
#include <qbs.h>
(I checked that the file is present in /usr/local/opt/qbs/include/qbs directory).
One more question. If I use make -j8, that boosts the build process, but then
I end up with following obscure error:
mv -f libDebugger.dylib ../../../bin/Qt\ Creator.app/Contents/PlugIns/
make[1]: *** [sub-plugins-make_first-ordered] Error 2
I could find neither additional error messages in the console output above, nor
any error.log files.
P.S. Here are original build instructions from github README.md:
# Optional, needed for the Clang Code Model if llvm-config is not in PATH:
export LLVM_INSTALL_DIR=/path/to/llvm (or "set" on Windows)
# Optional, needed to let the QbsProjectManager plugin use system Qbs:
export QBS_INSTALL_DIR=/path/to/qbs
# Optional, needed for the Python enabled dumper on Windows
set PYTHON_INSTALL_DIR=C:\path\to\python
cd $SOURCE_DIRECTORY
qmake -r
make (or mingw32-make or nmake or jom, depending on your platform)
Installation ("make install") is not needed. It is however possible, using
make install INSTALL_ROOT=$INSTALL_DIRECTORY
Update 2:
after excluding Qt from PATH I receive another error:
In file included from ../../../../qtcreator_src/4.7/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp:29:
/usr/local/Cellar/qbs/1.12.0/include/qbs/qbs.h:63:10: fatal error:
'tools/settingsrepresentation.h' file not found
#include "tools/settingsrepresentation.h"
Update 3: I managed to build Qt Creator with the following commands issued from the build directory:
export LLVM_INSTALL_DIR=/usr/local/opt/llvm
/usr/local/opt/qt/bin/qmake /Users/username/builds/qtcreator_src/4.7
make
But even though build process completed without errors, the application doesn't run:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: EXC_I386_GPFLT
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libBookmarks.dylib 0x0000000115166cb0 Bookmarks::Internal::BookmarksPlugin::~BookmarksPlugin() + 32
1 libExtensionSystem.4.7.0.dylib 0x000000010b58b3eb ExtensionSystem::Internal::PluginSpecPrivate::kill() + 27
2 libExtensionSystem.4.7.0.dylib 0x000000010b576778 ExtensionSystem::Internal::PluginManagerPrivate::loadPlugins() + 888
3 org.qt-project.qtcreator 0x000000010b558159 main + 13353
4 libdyld.dylib 0x00007fff7e352115 start + 1
Qt for sure shouldn’t be in the path — it’s superfluous. You can have multiple Qt versions coexisting and they are selected by invoking their respective qmake’s. Whether LLVM should be — not sure. qmake’s -r option is for the project mode and unnecessary.
cd build_dir
/qt/bin/qmake /path/to/sources
make
The whole point of using qbs would be that you replace qmake+make with just qbs. First tell qbs about the Qt version you want to use (do this just once):
qbs setup-qt /qt/bin/qmake myqt
qbs config defaultProfile myqt
Of course myqt can be whatever you want it to be.
Then build creator:
cd build_dir
qbs -f /path/to/sources

Build Faild for TFS

Error:
C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.103.2\agent\Worker\Tools\nuget.exe
failed with return code: 1
Packages failed to install Return code: 1
Delivery_Analytics\Delivery_Analytics\Delivery_Analytics.csproj (0, 0)
Cannot resolve Assembly or Windows Metadata file 'System.Runtime.Handles.dll'
C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\8.2\Microsoft.Windows.UI.Xaml.Common.targets
(264, 5)
Type universe cannot resolve assembly: System.Runtime.Handles, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
Process 'msbuild.exe' exited with code '1'
2016-08-16T12:16:14.5082366Z System.Security.Cryptography.Cng 4.2.0 is not compatible with UAP,Version=v10.0 (win10-x64-aot).
2016-08-16T12:16:14.5082366Z System.Security.Cryptography.Encoding 4.0.0 is not compatible with UAP,Version=v10.0 (win10-x64-aot).
2016-08-16T12:16:14.5092363Z System.Security.Cryptography.Primitives 4.0.0 is not compatible with
UAP,Version=v10.0 (win10-x64-aot).
2016-08-16T12:16:14.5092363Z System.Collections.NonGeneric 4.0.1 is not compatible with UAP,Version=v10.0 (win10-x64-aot).
2016-08-16T12:16:14.5092363Z System.Collections.Specialized 4.0.1 is not compatible with UAP,Version=v10.0 (win10-x64-aot).
2016-08-16T12:16:14.5102364Z System.Private.Uri 4.0.1 is not compatible with UAP,Version=v10.0 (win10-x64-aot).
2016-08-16T12:16:14.5102364Z System.Net.Requests 4.0.11 provides a compile-time reference assembly for System.Net.Requests on
UAP,Version=v10.0, but there is no run-time assembly compatible with
win10-x64-aot.
2016-08-16T12:16:14.5112357Z System.Runtime.WindowsRuntime.UI.Xaml 4.0.1 provides a compile-time reference assembly for System.Runtime.WindowsRuntime.UI.Xaml on UAP,Version=v10.0, but there
is no run-time assembly compatible with win10-x64-aot.
2016-08-16T12:16:14.5112357Z System.IO.Compression 4.1.1 provides a compile-time reference assembly for System.IO.Compression on
UAP,Version=v10.0, but there is no run-time assembly compatible with
win10-x64-aot.
2016-08-16T12:16:14.5412349Z Generating MSBuild file Delivery_Analytics.nuget. targets.
2016-08-16T12:16:14.5432359Z Generating MSBuild file Delivery_Analytics.nuget. props.
2016-08-16T12:16:14.5712346Z ##[debug]rc:1
2016-08-16T12:16:14.5722353Z ##[debug]success:false
2016-08-16T12:16:14.5812337Z ##[error]Error: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.104.1\
agent\ Worker\ Tools\nuget.exe failed with return code: 1
2016-08-16T12:16:14.5812337Z ##[error]Packages failed to install
2016-08-16T12:16:14.5822348Z ##[debug]task result: Failed
2016-08-16T12:16:14.5822348Z ##[error]Return code: 1
Based on my test, changing Microsoft.NetCore.UniversalWindowsPlatform dependency version to 5.1.0, then it works fine. Based on this thread https://github.com/dotnet/coreclr/issues/3520, the 5.2.0 is prerelease and isn’t yet supported to be consumed by UWP apps.

Debugging Qt with Visual Studio

How is it possible to debug Qt 4.8 in Visual Studio 2005?
Building release does work but if i try to debug, I always get this message:
This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix this problem. For more details, please see the application event log.
How can I fix that? Thank you!
Update
I rebuild Qt for Visual Studio 2005 using configure -platform win32-msvc2005 and jom instead of nmake (damn thats fast) and now get following Errorcode:
The application was unable to start correctly (0xc0150002).Click OK to close the application.
Update2
How can I fix the DLLs and error messages?
Dependency Walker:
Missing DLLs
MSVCP90D.DLL
MSVCR90D.DLL
API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL
DCOMP.DLL
IESHIMS.DLL
Error messages
Error: The Side-by-Side configuration information for "c:\qt\4.8.6\bin\QTGUID4.DLL" contains errors.
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
Update 3
I now started from scratch:
Install qt-opensource-windows-x86-vs2008-4.8.6.exe (building from qt-everywhere-opensource-src-4.8.6.zip would even cause release mode not to work anymore, cannot find QtGuid4.lib and QtGui4.lib, but with building from installed Qt it finds the libs)
Install qt-vs-addin-1.1.11-opensource.exe
jom distclean "Error: File Makefile doesn't exist exit."
jom confclean "Error: File Makefile doesn't exist exit."
configure -platform win32-msvc2005
jom
Last few output lines of jom:
C:\Qt\4.8.6>jom
[...]
qimageiohandler.cpp
qimagereader.cpp
qimagewriter.cpp
qpaintengine_pic.cpp
qkeymapper_win.cpp
qiconloader.cpp
Code wird generiert...
Code wird generiert...
qimage.cpp
jom: C:\Qt\4.8.6\src\gui\Makefile.Release [tmp\obj\release_shared\qguiplatformpl
ugin.obj] Error 2
cl -c -FIqt_gui_pch.h -Yuqt_gui_pch.h -Fptmp\obj\release_shared\QtGui_pc
h.pch -nologo -Zm200 -Zc:wchar_t- -O2 -MD -W3 -w34100 -w34189 -GR -EHsc -DQT_SHA
RED -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -DQT_BUILD_GUI_LIB -DQT_NO_USING_NAMES
PACE -DQT_MAKEDLL -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -
DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -D_USE_MATH_DEFINES -DQT_NO_DIRECTDRAW -D
QT_USE_BUNDLED_LIBPNG -DPNG_NO_ASSEMBLER_CODE -DQT_NO_CUPS -DQT_NO_LPR -DQT_NO_O
PENTYPE -DQT_NO_STYLE_MAC -DQT_NO_STYLE_GTK -DQT_NO_STYLE_WINDOWSCE -DQT_NO_STYL
E_WINDOWSMOBILE -DQT_NO_STYLE_S60 -DQT_NO_EGL -DQ_INTERNAL_QAPP_SRC -DQT_NO_DIRE
CTWRITE -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_
HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DNDEBUG -I"..\..\include\QtCore" -I"..
\..\include" -I"..\..\include\QtGui" -I"tmp\rcc\debug_shared" -I"tmp" -I"..\3rdp
arty\wintab" -I"image" -I"..\3rdparty\libpng" -I"..\3rdparty\zlib" -I"..\3rdpart
y\zlib" -I"..\3rdparty\harfbuzz\src" -I"dialogs" -I"..\..\include\ActiveQt" -I"t
mp\moc\release_shared" -I"." -I"..\..\mkspecs\win32-msvc2005" -Fotmp\obj\release
_shared\ #C:\Users\fpieske\AppData\Local\Temp\qpicture.obj.5884.19719.jom
qpicture.cpp
qpictureformatplugin.cpp
qpixmap.cpp
qpixmapdata.cpp
Code wird generiert...
Code wird generiert...
jom: C:\Qt\4.8.6\src\gui\Makefile [release-all] Error 2
jom: C:\Qt\4.8.6\Makefile [sub-gui-make_default-ordered] Error 2
C:\Qt\4.8.6>
I got it! Was about to quit trying to debug with Visual Studio and use Qt Creator instead. While reading how to configure Qt Creator i read about installing Windows SDK. Well debugging with Qt Creator still does not work (Unknown debugger type "No Engine") but installing Windows SDK solved my debugging problem in Visual Studio!
Try the following:
Open a command prompt and traverse to the directory where your Qt .pro file resides.
Run the following command - qmake -tp vc {name of the project file}.
Open Visual Studio and browse to the same directory. There should now be a generated VS project inside it.
Open the project.
In VS Project Properties|Configuration Properties|Debugging set any Environment or Command Line Arguments.
Build a debug version of the application and run it.
Save solution.
If you encounter build problems it may be that there were incorrectly escaped strings (at least as far as VS is concerned) in the project file. For example
DEFINES+=\"DEFINE_NAME=$$quote(\\"SomeString\\")\"
Will need to be modifed temporarily to this:
DEFINES+=\"DEFINE_NAME=$$quote(\"\"\"SomeString\"\"\")\"

Resources