fatal error: could not build module 'Darwin' - swift

I'm new to vapor and I just installed in on MacOS, I'm getting following error when I build it. Does anyone know how to fix it? I've searched but most of the solution mentioned are for iOS rather than MacOS.
While building module 'Darwin' imported from /Users/imac1/ROOT/Vapor/Hello/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/c_nio_http_parser.h:35:
In file included from <module-includes>:357:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/ncurses.h:141:
/opt/local/include/unctrl.h:60:63: error: unknown type name 'SCREEN'
NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype);
^
/opt/local/include/unctrl.h:60:53: error: function cannot return function type 'char *(int *, chtype)' (aka 'char *(int *, unsigned int)')
NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype);
^
/opt/local/include/unctrl.h:60:54: error: a parameter list without types is only allowed in a function definition
NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype);
^
In file included from /Users/imac1/ROOT/Vapor/Hello/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/c_nio_http_parser.c:24:
/Users/imac1/ROOT/Vapor/Hello/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include/c_nio_http_parser.h:35:10: fatal error: could not build module 'Darwin'
#include <stddef.h>
~~~~~~~~^
4 errors generated.
[0/20] Compiling CNIOHTTPParser c_nio_http_parser.c
[1/20] Compiling CNIOLinux shim.c
[2/20] Compiling CNIOZlib empty.c
[3/20] Compiling CNIOLinux ifaddrs-android.c
[3/20] Compiling CNIOOpenSSL shims.c
[3/20] Compiling CNIOOpenSSL helpers.c
[3/20] Compiling CNIODarwin shim.c
[3/20] Compiling CNIOSHA1 c_nio_sha1.c

Uninstall MacPorts - it installs header files where they shouldn’t be and the compiler uses those header files rather than the ones bundled with Xcode

Related

Problems to recompile a UE4 plugin

I am trying to recompile the Dialogo System plugin (https://forums.unrealengine.com/t/dialogue-system/44974) and I can't do it at all. I've tried several ways, including those suggested by the forum staff, but there's no way
This the error message I am getting:
Running C:/Program Files/Epic
Games/UE_4.26/Engine/Binaries/DotNET/UnrealBuildTool.exe Development
Win64 -Project="D:/Simulation/unreal/MyProject/MyProject.uproject"
-TargetType=Editor -Progress -NoEngineChanges -NoHotReloadFromIDE Invalidating makefile for MyProjectEditor (DialogueSystem.Build.cs
modified) #progress push 5% Parsing headers for MyProjectEditor
Running UnrealHeaderTool
"D:\Simulation\unreal\MyProject\MyProject.uproject"
"D:\Simulation\unreal\MyProject\Intermediate\Build\Win64\MyProjectEditor\Development\MyProjectEditor.uhtmanifest"
-LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="C:\Users\renat\AppData\Local\UnrealBuildTool\Log_UHT.txt" -installed Reflection code generated for MyProjectEditor in 4,3286771 seconds #progress pop
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTComposite_Context.cpp(1):
error: Expected BTComposite_Context.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTComposite_Question.cpp(1):
error: Expected BTComposite_Question.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTComposite_QuestionGroup.cpp(1):
error: Expected BTComposite_QuestionGroup.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTContextNode_Interface.cpp(1):
error: Expected BTContextNode_Interface.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTDialogueFunctionLibrary.cpp(1):
error: Expected BTDialogueFunctionLibrary.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTTask_CloseDialogue.cpp(1):
error: Expected BTTask_CloseDialogue.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTTask_ShowPhrases.cpp(1):
error: Expected BTTask_ShowPhrases.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\BTTask_WaitAnswer.cpp(1):
error: Expected BTTask_WaitAnswer.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\DialogueButton.cpp(1):
error: Expected DialogueButton.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\DialogueEventListener.cpp(1):
error: Expected DialogueEventListener.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\DialogueSettings.cpp(1):
error: Expected DialogueSettings.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\DialogueSystemModule.cpp(1):
error: Expected DialogueSystemModule.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Private\QuestBook.cpp(1): error: Expected QuestBook.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\BehaviorTreeEditor\QuestionCustomization.cpp(1):
error: Expected QuestionCustomization.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\BehaviorTreeEditor\ShowPhrasesCustomization.cpp(1):
error: Expected ShowPhrasesCustomization.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\QuestBookEditor\QuestBookEditor.cpp(1):
error: Expected QuestBookEditor.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\QuestBookEditor\QuestBookEditorCommands.cpp(1):
error: Expected QuestBookEditorCommands.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\QuestBookEditor\QuestBookEditorCustomization.cpp(1):
error: Expected QuestBookEditorCustomization.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\DialogueSystemEditorModule.cpp(1):
error: Expected DialogueSystemEditorModule.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\DialogueSystemStyle.cpp(1):
error: Expected DialogueSystemStyle.h to be first header included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\QuestBookAssetTypeActions.cpp(1):
error: Expected QuestBookAssetTypeActions.h to be first header
included.
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystemEditor\Private\QuestBookFactory.cpp(1):
error: Expected QuestBookFactory.h to be first header included.
Building MyProjectEditor... Using Visual Studio 2019 14.27.29111
toolchain (C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.27.29110) and Windows
10.0.19041.0 SDK (C:\Program Files (x86)\Windows Kits\10). Building 13 actions with 12 processes... #progress 'Compiling C++ source
code...' 0% #progress 'Compiling C++ source code...' 8% [1/13]
Default.rc2 #progress 'Compiling C++ source code...' 15% [2/13]
Default.rc2 #progress 'Compiling C++ source code...' 23% [3/13]
PCH.DialogueSystem.cpp
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Classes\BTTask_ShowPhrases.h(7):
fatal error C1083: It1s not possible to open file include: 'Widget.h':
No such file or directory
Please, some help. I really need to use this plugin to produce a demonstration of my project.
You could try what the log is suggesting and change the order of the includes. I suppose you're using a c++ project. Sometimes the order does matter.
Also check if the plugin is added in the dependecies list in the build.cs file. This file is located inside your project source folder. You will see that in the file there is already a dependecies list and you should include the plugin name in the list and build again.
BTComposite_Context.cpp(1): error: Expected BTComposite_Context.h to be first header included.
Taking this one as an example it looks like the .cpp files have been either corrupted or modified in a way. In general when you have a .cpp file you'll want it to start with the same header file as the first include. So open one of these files and see whether or not it starts with something like
#include BTComposite_Context.h
My guess since it looks to be an old plugin it probably improperly starts with something like
#include Engine/Core.h
D:\Simulation\unreal\MyProject\Plugins\UE4-DialogueSystem-master\Source\DialogueSystem\Classes\BTTask_ShowPhrases.h(7): fatal error C1083: It1s not possible to open file include: 'Widget.h': No such file or directory
This error is actually what's causing you not to be able to compile. Likely because Widget.h has been moved in a future version of UE4 compared to what it was when this plugin was made almost 7 years ago.
Try changing from #include Widget.h to #include "Components/Widget.h"
If you look at Widget.cpp in the engine source you can see this is now the correct include path that is expected.

raspiberry pi pjsip compile error: emmintrin.h no such file or directory

I'm trying to compile PJSIP (version 2.6) on my Raspberry Pi 3 model B.
While running make dep && make, I get this error:
../../webrtc/src/webrtc//system_wrappers/source/cpu_features.cc
../../webrtc/src/webrtc//modules/audio_processing/aec/aec_core_sse2.c:15:23: fatal error: emmintrin.h: No such file or directory
#include <emmintrin.h>
^
compilation terminated.
../../webrtc/src/webrtc//modules/audio_processing/aec/aec_rdft_sse2.c:13:23: fatal error: emmintrin.h: No such file or directory
#include <emmintrin.h>
^
compilation terminated.
How can this be fixed?
I ran into the exact same issue trying to do exactly what you are doing.
I found a few solutions online but was not satisfied with any of them. They all seemed like nasty hacks.
I looked into the configure script and discovered that sse2 is only required for compiling libwebrtc, which I did not need. Thus I simply disabled the compilation of libwebrtc alongside other things that I didn't need:
./configure --disable-sdl --disable-ffmpeg --disable-v4l2 --disable-openh264 --disable-libwebrtc
Note that --disable-v4l2 is referencing video4linux2.
After that the compilation completed successfully.
Looks like this was solved in this thread: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=178384

Error with "swift build" in Ubuntu 14.04

I have a problem when I tried to compile a Swift code, I believe that it's something about Swift in Ubuntu. Here is the error:
swift build
Compiling Swift Module 'testregex' (1 sources) /home/guillermo/Descargas/Hola/Sources/testregex.swift:4:1: error: statements are not allowed at the top level
if let range = str.rangeOfString("string$", options: .RegularExpressionSearch) { ^
<unknown>:0: error: build had 1 command failures
error: exit(1): ["/home/guillermo/Descargas/swift-DEVELOPMENT-SNAPSHOT-2016-01-25-a-ubuntu14.04/usr/bin/swift-build-tool", "-f", "/home/guillermo/Descargas/Hola/.build/debug/testregex.o/llbuild.yaml"]
If somebody know how to solve this weird problem, I'll be very greatful
:)
This is because swift build expects to find a main.swift file in the Sources folder.
Rename your testregex.swift file to main.swift and it will build properly.
You can have as many .swift files as you want in the Sources folder, but there has to be one main.swift file.

How are the libraries .h files included

I have successfully generated Objc .m and .h files from my simplistic Dagger-2 code.
https://gist.github.com/OscarRyz/ffd976fcae9acf87dbe1
Now I'm trying to compile those file using j2objcc but the error message says it can't find .h for the the Dagger-2 classes:
j2objcc -c -I. `find app -name *.m`
In file included from app/DaggerSearchComponent.m:10:
./app/SearchInPage_Factory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
app/SearchComponent.m:11:10: fatal error: 'dagger/Component.h' file not found
#include "dagger/Component.h"
^
1 error generated.
In file included from app/SearchInPage_Factory.m:8:
./app/SearchInPage_Factory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
In file included from app/SearchInPage_MembersInjector.m:9:
./app/SearchInPage_MembersInjector.h:10:10: fatal error: 'dagger/MembersInjector.h' file not found
#include "dagger/MembersInjector.h"
^
1 error generated.
app/SearchModule.m:10:10: fatal error: 'dagger/Module.h' file not found
#include "dagger/Module.h"
^
1 error generated.
In file included from app/SearchModule_ProvideHostFactory.m:8:
./app/SearchModule_ProvideHostFactory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
In file included from app/SearchModule_ProvideHttpClientFactory.m:9:
./app/SearchModule_ProvideHttpClientFactory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
Question: Does this means that I need to have the library source code while generating the ObjC code so the .h for those could be generated as well?
Original answer from #tabll
Dagger isn't distributed with j2objc, so you have to build it yourself. To do so (requires Maven, described in the Building J2ObjC wiki):
git clone https://github.com/google/dagger.git
cd dagger
mvn install
j2objc -d build -classpath $J2OBJC_HOME/lib/javax-inject.jar -sourcepath core/src/main/java `find core/src/main/java -name *.java`
cd build
j2objcc -c -I. `find dagger -name *.m`
ar -r libdagger.a *.o
Notes:
Specify J2OBJC_HOME either where your j2objc distribution was unzipped, or if you built j2objc, its dist directory. To test, "ls $J2OBJC_HOME/j2objc" should list the j2objc script.
These instructions generate the macosx architecture, useful when testing. The files need to be recompiled for each architecture you want to use -- the easiest way to do so is to create a static library project in Xcode, add the translated files, then include this project in your app and add it as a dependency of your app.
ar will warn that "libdagger.a(package-info.o) has no symbols", which can be ignored since it doesn't have any symbols.

Using WxWidgets with Eclipse for C++

I installed wxWidgets and then followed the instructions to make it with MSYS. After it was done, I copied a sample from a site and put it on a project in eclipse. The code was:
#include <wx/string.h>
int main(int argc, char **argv)
{
wxPuts(wxT("A wxWidgets console application"));
}
But when I compile I get this error:
**** Build of configuration Debug for project test2 ****
**** Internal Builder is used for build ****
g++ -O0 -g3 -Wall -c -fmessage-length=0 -osrc\test2.o ..\src\test2.cpp
..\src\test2.cpp:9:23: wx/string.h: No such file or directory
..\src\test2.cpp: In function `int main(int, char**)':
..\src\test2.cpp:13: error: `wxT' was not declared in this scope
..\src\test2.cpp:13: error: `wxPuts' was not declared in this scope
..\src\test2.cpp:13: warning: unused variable 'wxT'
..\src\test2.cpp:13: warning: unused variable 'wxPuts'
Build error occurred, build is stopped
Time consumed: 78 ms.
What did I do wrong?
I edited the settings but I still get this.
There is no -I still..
**** Build of configuration Debug for project Wx1 ****
**** Internal Builder is used for build ****
g++ -O0 -g3 -Wall -c -fmessage-length=0 -osrc\simple.o ..\src\simple.cpp
In file included from ..\src\simple.cpp:1:
..\src\simple.h:1:19: wx/wx.h: No such file or directory
In file included from ..\src\simple.cpp:1:
..\src\simple.h:4: error: expected class-name before '{' token
..\src\simple.h:6: error: expected `,' or `...' before '&' token
..\src\simple.h:6: error: ISO C++ forbids declaration of `wxString' with no type
..\src\simple.cpp:3: error: expected `,' or `...' before '&' token
..\src\simple.cpp:4: error: ISO C++ forbids declaration of `wxString' with no type
..\src\simple.cpp: In constructor `Simple::Simple(int)':
..\src\simple.cpp:4: error: class `Simple' does not have any field named `wxFrame'
..\src\simple.cpp:4: error: `NULL' was not declared in this scope
..\src\simple.cpp:4: error: `wxID_ANY' was not declared in this scope
..\src\simple.cpp:4: error: `title' was not declared in this scope
..\src\simple.cpp:4: error: `wxDefaultPosition' was not declared in this scope
..\src\simple.cpp:4: error: `wxSize' was not declared in this scope
..\src\simple.cpp:6: error: `Centre' was not declared in this scope
..\src\simple.cpp:6: warning: unused variable 'Centre'
..\src\simple.cpp:4: warning: unused variable 'NULL'
..\src\simple.cpp:4: warning: unused variable 'wxID_ANY'
..\src\simple.cpp:4: warning: unused variable 'title'
..\src\simple.cpp:4: warning: unused variable 'wxDefaultPosition'
..\src\simple.cpp:4: warning: unused variable 'wxSize'
Build error occurred, build is stopped
Time consumed: 63 ms.
Here is a screenshot
screenshot http://imgkk.com/i/aRjvDe.jpg
What am I doing wrong?
Seems like you didn't set the correct include directories to find the wx headers (There is no -I... on the compiler command line).
You could add include directories in the project settings of a CDT project under C++->Settings->GNU C++->Include directories (or similar I don't have Eclipse running at the moment so the names way vary).
EDIT:
You have changed the "GCC Assembler" include paths. Since you don't program assembler this part isn't used. You need to edit the include paths in the "GCC C++ Compiler" path!
Perhaps the guide here might help you, as you have already built this library I guess you only read for the section titled Verification that wxWidgets Libraries Are Working onwards.