Error while compiling Ethos framework - plugins

I'm trying make Ethos framework on Mac OS Lion.
git://git.dronelabs.com/ethos
Here result of ./configure:
Ethos 0.2.3
Prefix...................: /usr/local
Debug level..............: minimum
Maintainer Compiler flags: no
Build API reference......: no
Enable test suite........: yes
Bindings
GObject Introspection....: no
Vala Bindings............: no
Python Bindings..........: no
Javascript Bindings......: no
Now type `make' to compile ethos
Then I do sudo make, and while compiling arise an error:
Making all in c-plugins
CC libsample.so
Undefined symbols for architecture x86_64:
"_ethos_plugin_get_type", referenced from:
_my_plugin_get_type in cc3gPLKS.o
_my_plugin_class_init in cc3gPLKS.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[3]: *** [libsample.so] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
How can I fix it?

I found that Ethos can be installed on Mac OS X 10.7 after the following modifications:
1)Edit file: ethos_dir/ethos/ethos_manager.c (:194):
FROM:
while (NULL != (filename = g_dir_read_name (dir))) {
if (g_str_has_suffix (filename, "." G_MODULE_SUFFIX)) {
abspath = g_build_filename (loaders_dir, filename, NULL);
loader = ethos_manager_create_plugin_loader (manager, abspath);
if (loader != NULL)
loaders = g_list_prepend (loaders, loader);
g_free (abspath);
}
}
TO:
while (NULL != (filename = g_dir_read_name (dir))) {
#ifdef __APPLE__
gchar* suffix = "dylib"; // to able find ethos-plugin-loader
#else
gchar* suffix = ("." G_MODULE_SUFFIX);
#endif
if (g_str_has_suffix (filename, suffix)) {
abspath = g_build_filename (loaders_dir, filename, NULL);
loader = ethos_manager_create_plugin_loader (manager, abspath);
if (loader != NULL)
loaders = g_list_prepend (loaders, loader);
g_free (abspath);
}
}
2)Disable making for: ethos-dir/tests,
Change in Makefile.am
FROM:
line#: contents
02: SUBDIRS = c-plugins manager-dep
30: manager_sources = manager.c
31: plugin_info_sources = plugin-info.c
TO:
02: #SUBDIRS = c-plugins manager-dep
30: #manager_sources = manager.c
31: #plugin_info_sources = plugin-info.c
This is necessary because, while making process it cannot find libethos.

Related

C++ macOS M1 ld: symbol(s) not found for architecture arm64 clang: error

i have a project about sorting data from files. However when i tried to implement main.cpp, i got an error.
TERMINAL OUTPUT:
Executing task: /usr/bin/clang++ -std=c++17 -stdlib=libc++ -g /Users/utku/Desktop/workspaces/cppworkspace/homework-1/main.cpp -o /Users/utku/Desktop/workspaces/cppworkspace/homework-1/main
Undefined symbols for architecture arm64:
"TestBed::setAlgorithm(int, int)", referenced from:
_main in main-f84827.o
"TestBed::execute()", referenced from:
_main in main-f84827.o
"TestBed::TestBed()", referenced from:
_main in main-f84827.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The terminal process "/bin/zsh '-c', '/usr/bin/clang++ -std=c++17 -stdlib=libc++ -g /Users/utku/Desktop/workspaces/cppworkspace/homework-1/main.cpp -o /Users/utku/Desktop/workspaces/cppworkspace/homework-1/main'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
(Using VSCode and M1 MacBook) ,
¨
using namespace std;
int main(int argc, char *argv[]) {
string testfile;
if (argc < 2) {
cout << "Enter a test file name:" << endl;
cin >> testfile;
}
else {
testfile = argv[1];
}
ifstream file(testfile.c_str());
if (file.is_open()) {
cin.rdbuf(file.rdbuf());
}
else {
cout << "Error: cannot read the test file!" << endl;
return -1;
}
int algorithmType = 0;
int k = 0;
// Numbers are obtained from the file line by line with cin
cin >> algorithmType;
cin >> k;
// Create a TestBed object, initialize and execute the algorithm
TestBed *test = new TestBed() ;
test->setAlgorithm(algorithmType,k);
test->execute();
return 0;
}¨

LLD vs LD Linker Script Discrepancy

I'm moving a project from LD to LLD. An error has cropped up which appears due to the lack of global expression support in LLD. Are variables supported like this?
An simplified example of something that works in LD:
example.ld
_Flash_Origin = 0x01000000;
_App_Length = 16K;
_App_Origin = _Flash_Origin;
MEMORY
{
APP(rx) : ORIGIN = _App_Origin, LENGTH = _App_Length
}
The error is symbol not found: _App_Length. I'm looking for the reason this occurs only in LLD.
The args provided are as follows:
--gc-sections (list of object files...) -Bstatic -L(big path...)clang/10.0.1/lib/baremetal -T example.ld -T sections.ld -o output.elf

Can not compile wine on Centos 7 with 64

I trying to compile wine-0.9.1 on CentOS7.
The configure finish okay, I run
./configure --enable-win64
When I run:
'make depend && make'
I get:
make[2]: Entering directory `/../wine-0.9.1/libs/unicode'
gcc -shared -Wl,-soname,libwine_unicode.so.1 -Wl,--version-script=./wine_unicode.map casemap.o collation.o compose.o cptable.o fold.o mbtowc.o sortkey.o string.o utf8.o wctomb.o wctype.o c_037.o c_424.o c_437.o c_500.o c_737.o c_775.o c_850.o c_852.o c_855.o c_856.o c_857.o c_860.o c_861.o c_862.o c_863.o c_864.o c_865.o c_866.o c_869.o c_874.o c_875.o c_878.o c_932.o c_936.o c_949.o c_950.o c_1006.o c_1026.o c_1250.o c_1251.o c_1252.o c_1253.o c_1254.o c_1255.o c_1256.o c_1257.o c_1258.o c_10000.o c_10006.o c_10007.o c_10029.o c_10079.o c_10081.o c_20866.o c_20932.o c_21866.o c_28591.o c_28592.o c_28593.o c_28594.o c_28595.o c_28596.o c_28597.o c_28598.o c_28599.o c_28600.o c_28603.o c_28604.o c_28605.o c_28606.o -o libwine_unicode.so.1
compose.o: In function `lstrcpynW':
/../wine-0.9.1/libs/unicode/../../include/winbase.h:2029: multiple definition of `lstrcpynW'
casemap.o:/../wine-0.9.1/libs/unicode/../../include/winbase.h:2029: first defined here
compose.o: In function `lstrcpynA':
/../wine-0.9.1/libs/unicode/../../include/winbase.h:2044: multiple definition of `lstrcpynA'
casemap.o:/../wine-0.9.1/libs/unicode/../../include/winbase.h:2044: first defined here
compose.o: In function `lstrlenW':
...
/../wine-0.9.1/libs/unicode/../../include/winbase.h:2092: multiple definition of `lstrcatA'
casemap.o:/../wine-0.9.1/libs/unicode/../../include/winbase.h:2092: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [libwine_unicode.so.1] Error 1
make[2]: Leaving directory `/../wine-0.9.1/libs/unicode'
make[1]: *** [unicode] Error 2
make[1]: Leaving directory `/../wine-0.9.1/libs'
make: *** [libs] Error 2
How can I find what cause the problem?
Thanks.

Adding support for 32-bit Ubuntu to Swift

I'm trying to build Swift from source on a 32-bit Ubuntu virtual machine.
I've done the following modifications, mostly in the build scripts:
(see https://pastebin.com/rmWecTu7)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 112b5d6..16db3ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
## -538,12 +538,16 ##
endif()
endif()
+message(STATUS ">>> CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR})
+
# If SWIFT_HOST_VARIANT_ARCH not given, try to detect from the CMAKE_SYSTEM_PROCESSOR.
if(SWIFT_HOST_VARIANT_ARCH)
set(SWIFT_HOST_VARIANT_ARCH_default, "${SWIFT_HOST_VARIANT_ARCH}")
else()
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
set(SWIFT_HOST_VARIANT_ARCH_default "x86_64")
+ elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
+ set(SWIFT_HOST_VARIANT_ARCH_default "i686")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
set(SWIFT_HOST_VARIANT_ARCH_default "aarch64")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64")
## -613,10 +617,14 ##
set(SWIFT_HOST_VARIANT "linux" CACHE STRING
"Deployment OS for Swift host tools (the compiler) [linux].")
+ message(STATUS ">>> SWIFT_HOST_VARIANT_ARCH: " ${SWIFT_HOST_VARIANT_ARCH})
+
# Calculate the host triple
if("${SWIFT_HOST_TRIPLE}" STREQUAL "")
if("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "x86_64")
set(SWIFT_HOST_TRIPLE "x86_64-unknown-linux-gnu")
+ elseif("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "i686")
+ set(SWIFT_HOST_TRIPLE "i686-unknown-linux-gnu")
elseif("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "aarch64")
set(SWIFT_HOST_TRIPLE "aarch64-unknown-linux-gnu")
elseif("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "(powerpc64|powerpc64le)")
diff --git a/stdlib/public/SwiftShims/LibcShims.h b/stdlib/public/SwiftShims/LibcShims.h
index e726a62..5fd7826 100644
--- a/stdlib/public/SwiftShims/LibcShims.h
+++ b/stdlib/public/SwiftShims/LibcShims.h
## -33,7 +33,9 ##
// This declaration is not universally correct. We verify its correctness for
// the current platform in the runtime code.
-#if defined(__linux__) && defined (__arm__)
+#if defined(__linux__) && defined(__arm__)
+typedef int __swift_ssize_t;
+#elif defined(__linux__) && defined(__i386__)
typedef int __swift_ssize_t;
#elif defined(_WIN32)
#if defined(_M_ARM) || defined(_M_IX86)
diff --git a/utils/build-script-impl b/utils/build-script-impl
index 1bfbcc5..b058b22 100755
--- a/utils/build-script-impl
+++ b/utils/build-script-impl
## -449,6 +449,9 ##
--$(tolower "${PLAYGROUNDLOGGER_BUILD_TYPE}")
)
;;
+ linux-i686)
+ SWIFT_HOST_VARIANT_ARCH="i686"
+ ;;
linux-armv6)
SWIFT_HOST_VARIANT_ARCH="armv6"
SWIFT_HOST_TRIPLE="armv6-unknown-linux-gnueabihf"
diff --git a/utils/swift_build_support/swift_build_support/targets.py b/utils/swift_build_support/swift_build_support/targets.py
index f4b5bb0..690a3d3 100644
--- a/utils/swift_build_support/swift_build_support/targets.py
+++ b/utils/swift_build_support/swift_build_support/targets.py
## -112,6 +112,7 ##
is_simulator=True)
Linux = Platform("linux", archs=[
+ "i686",
"x86_64",
"armv6",
"armv7",
## -174,6 +175,8 ##
return StdlibDeploymentTarget.Linux.powerpc64le
elif machine == 's390x':
return StdlibDeploymentTarget.Linux.s390x
+ elif machine == 'i686':
+ return StdlibDeploymentTarget.Linux.i686
elif system == 'Darwin':
if machine == 'x86_64':
Build fails when trying to build stdlib, giving some error related to Float80: (see https://pastebin.com/ue8MRquU)
swift: /home/gigi/local/Source/apple/swift/lib/IRGen/StructLayout.cpp:357: void swift::irgen::StructLayoutBuilder::setAsBodyOfStruct(llvm::StructType *) const: Assertion `(!isFixedLayout() || IGM.DataLayout.getStructLayout(type)->getSizeInBytes() == CurSize.getValue()) && "LLVM size of fixed struct type does not match StructLayout size"' failed.
/home/gigi/local/Source/apple/build/Ninja-ReleaseAssert/swift-linux-i686/bin/swift[0xc335ea0]
Stack dump:
0. Program arguments: /home/gigi/local/Source/apple/build/Ninja-ReleaseAssert/swift-linux-i686/bin/swift -frontend -c -filelist /tmp/sources-628097 -disable-objc-attr-requires-foundation-module -target i686-unknown-linux-gnu -disable-objc-interop -sdk / -I /home/gigi/local/Source/apple/build/Ninja-ReleaseAssert/swift-linux-i686/./lib/swift/linux/i686 -warn-swift3-objc-inference-complete -module-cache-path /home/gigi/local/Source/apple/build/Ninja-ReleaseAssert/swift-linux-i686/./module-cache -module-link-name swiftCore -nostdimport -parse-stdlib -resource-dir /home/gigi/local/Source/apple/build/Ninja-ReleaseAssert/swift-linux-i686/./lib/swift -swift-version 3 -O -D INTERNAL_CHECKS_ENABLED -group-info-path /home/gigi/local/Source/apple/swift/stdlib/public/core/GroupInfo.json -enable-sil-ownership -Xllvm -sil-inline-generics -Xllvm -sil-partial-specialization -Xcc -D__SWIFT_CURRENT_DYLIB=swiftCore -parse-as-library -module-name Swift -o /home/gigi/local/Source/apple/build/Ninja-ReleaseAssert/swift-linux-i686/stdlib/public/core/linux/i686/Swift.o
1. While running pass #147 SILFunctionTransform "SIL alloc_stack Hoisting" on SILFunction "#_T0s7Float80V15_representationAB01_A14RepresentationVvg".
for getter for _representation at /home/gigi/local/Source/apple/swift/stdlib/public/core/FloatingPointTypes.swift.gyb:342:16
2. While converting type 'Float80' (declared at [/home/gigi/local/Source/apple/swift/stdlib/public/core/FloatingPointTypes.swift.gyb:74:8 - line:3662:1] RangeText="struct Float80 {
public // #testable
var _value: Builtin.FPIEEE80
/// Creates a value initialized to zero.
#_inlineable // FIXME(sil-serialize-all)
#_transparent
public init() {
let zero: Int64 = 0
self._value = Builtin.sitofp_Int64_FPIEEE80(zero._value)
}
#_inlineable // FIXME(sil-serialize-all)
#_transparent
public // #testable
init(_bits v: Builtin.FPIEEE80) {
self._value = v
}
}")
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
ninja: build stopped: subcommand failed.
/home/gigi/local/Source/apple/swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
gigi#gigi-VirtualBox:~$ ]
Using ~/local/Source/apple/swift/utils/build-script --release to build.
I'm guessing the error has to do with this modification:
#elif defined(__linux__) && defined(__i386__)
typedef int __swift_ssize_t;
The official Swift project does not support 32bit architecture yet. There is an official ticket: Port Swift to Linux x86 32-bit
You will have more chance to get support on this ticket if you want to add this port yourself.

Theos tweak MSHookFunction

I followed http://brandontreb.com/beginning-jailbroken-ios-development-building-and-deployment
to make a tweak.
but after i done successfully with the helloworld tweak.
I hook the fopen using MSHookFunction
and then i meet a linking error
Making all for tweak hw...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
Linking tweak hw...
Undefined symbols for architecture armv7:
"_MSHookFunction", referenced from:
global constructors keyed to Tweak.xm.mmin Tweak.xm.51941273.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
make[2]: *** [.theos/obj/hw.dylib.ba964c90.unsigned] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [hw.all.tweak.variables] Error 2
this is Tweak.xm
#import "substrate.h"
static FILE * (*s_orig_fopen) ( const char * filename, const char * mode );
static FILE * my_fopen ( const char * filename, const char * mode ){
return s_orig_fopen(filename, mode);
}
static void entry(void) __attribute__ ((constructor));
static void entry(void) {
MSHookFunction(fopen, my_fopen, &s_orig_fopen);
}
does anyone know how to fix it?
You can try this:
#import "substrate.h"
static FILE * (*s_orig_fopen) ( const char * filename, const char * mode );
static FILE * my_fopen ( const char * filename, const char * mode ){
return s_orig_fopen(filename, mode);
}
%ctor {
MSHookFunction(fopen, my_fopen, &s_orig_fopen);
}