I'm trying to do some reverse engineering on the MacOS's Mail.app.
For this, I'm using class-dump, but I receive the following output:
Silviu:~ silviu$ class-dump /System/Applications/Mail.app
2020-04-08 10:54:36.536 class-dump[52413:2202003] Unknown load command: 0x00000032
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#pragma mark -
//
// File: /System/Applications/Mail.app/Contents/MacOS/Mail
// UUID: 7C43215A-CB02-3FF4-9559-20231135B148
//
// Arch: x86_64
// Source version: 3608.40.2.2.4
//
//
// This file does not contain any Objective-C runtime information.
//
I cannot believe that there does not exist some Objective-C stuff.
Related
I'm trying to add other minecraft mods as dependencies in the mod I've been working on with Intellij Idea, but when I try to launch Minecraft, it always fails and gives an error I don't understand.
Here's the error
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
10 actionable tasks: 3 executed, 7 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':runClient'.
> Process 'command 'C:\Program Files\Temurin\jdk-8.0.302.8-hotspot\bin\java.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 26s
Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service. Do you accept these terms? [yes, no]
And here's my build.gradle file
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.16.5-1.0'
group = 'com.pinwheel.singlet' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'singlet'
java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.
repositories {
maven {
// location of the maven that hosts JEI files
name = "Progwml6 maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.k.4u.nl"
}
}
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
// The mappings can be changed at any time, and must be in the following format.
// Channel: Version:
// snapshot YYYYMMDD Snapshot are built nightly.
// stable # Stables are built at the discretion of the MCP team.
// official MCVersion Official field/method names from Mojang mapping files
//
// You must be aware of the Mojang license when using the 'official' mappings.
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
//
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20210309-1.16.5'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
// The markers can be changed as needed.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'SCAN, REGISTRIES, REGISTRYDUMP'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
mods {
singlet {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
// The markers can be changed as needed.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
mods {
singlet {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
// The markers can be changed as needed.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
property "mixin.env.remapRefMap", "true"
property "mixin.env.refMapRemappingFile", "buildFile.parent/build/createSrgToMcp/output.srg"
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', 'singlet', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
singlet {
source sourceSets.main
}
}
}
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.16.5-36.2.20'
// compile against the JEI API but do not include it at runtime
compileOnly fg.deobf("mezz.jei:jei-1.16.5:7.7.1.152:api")
// at runtime, use the full JEI jar
runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:7.7.1.152")
implementation fileTree(dir: 'libs', include: ['jei-1.16.5-7.7.1.152.jar'])
runtimeOnly fg.deobf("curse.maven:abnormalscore-382216:3607198")
// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
// compile "some.group:artifact:version"
// Real examples
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// These dependencies get remapped to your current MCP mappings
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
repositories {
flatDir {
dirs 'lib'
}
maven { url "https://maven.jaackson.me" }
maven { url "https://dvs1.progwml6.com/files/maven/" }
maven { url "https://modmaven.k-4u.nl" }
maven { url "https://www.cursemaven.com"}
}
// Example for how to get properties into the manifest for reading by the runtime..
jar {
manifest {
attributes([
"Specification-Title": "singlet",
"Specification-Vendor": "",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": project.name + ".mixins.json"
])
}
}
// Example configuration to allow publishing using the maven-publish task
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
When I build the gradle, it will end up as successful, so I'm not entirely sure what I'm doing wrong. Please be patient with me, as English is not my first language.
I am building a macOS app with Deployment Target 10.13
Works on 10.15 but crashes on 10.13
Termination Reason: DYLD, [0x4] Symbol missing
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Symbol not found: _NSAppearanceNameDarkAqua
You'll need to make the code that uses this variable dependent on the version of macOS that's executing:
if (#available(macOS 10.14, *)) {
return NSAppearanceNameDarkAqua;
} else {
return nil;
}
You can also go old-school and declare it as a weak link:
extern NSAppearanceName const NSAppearanceNameDarkAqua __attribute__((weak_import));
...
if (NSAppearanceNameDarkAqua!=NULL) {
...
Makes sense; dark mode wasn't introduced until 10.14. So if you're going to run on 10.13, you mustn't load anything — not code, not asset catalog, not storyboard — that "mentions" or depends upon light/dark mode.
I have a kotlin multi-platform project for which I am creating a release framework. My release framework is bigger than the debug framework.
Following is the gradle task to create the framework:
task packForXcode(type: Sync) {
final File frameworkDir = new File(buildDir, "xcode-frameworks")
final String mode = 'RELEASE'
final def framework = kotlin.targets.iosArm64.binaries.getFramework(frameworkName, mode)
inputs.property "mode", mode
dependsOn framework.linkTask
from { framework.outputFile.parentFile }
into frameworkDir
doLast {
new File(frameworkDir, 'gradlew').with {
text = "#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$#\n"
setExecutable(true)
}
}
}
The framework file generated when mode = 'RELEASE' is 5.3 kb but when mode = 'DEBUG' one is 3.8 Kb.
I have 2 questions:
Is this expected ?
How can reduce or remove unused code while creating such a framework like R8/pro-guard in android ?
This result can be expected, as only release frameworks are embedding bitcode, debug ones have only bitcode markers(see some details here). Unused code should be already removed by the compiler, so there is no need to apply other tools here.
Trying to build a PlugIn for Coda 2.5 with swift.I'm getting this error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_CodaPlugInsController", referenced from:
_get_field_types_PowPlugInViewController in PowPlugInViewController.o
_get_field_types_PowPlugIn in PowPlugin.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have cleaned my build folder.
I have created and added import statements to the project name-bridging-swift.h.
Here is a look at my project.
CodaPlugInsController.h
You can find this file here.
https://github.com/panicinc/CodaPluginKit/tree/master/Cocoa%20Plug-ins
Discription:
This header provides protocols and facilities to implement Coda
text-based, syntax validator and sidebar plug-in.
CodaPow-Bridging-Header.h
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "CodaPlugInsController.h"
PowPlugin.swift
import Foundation
class PowPlugIn: NSObject, CodaPlugIn, CodaSidebarPlugIn {
let PowBundle: CodaPlugInBundle
let PowController: CodaPlugInsController
required init(plugInController: CodaPlugInsController, plugInBundle: CodaPlugInBundle) {
self.PowBundle = plugInBundle
self.PowController = plugInController
super.init()
}
func name() -> String {
return "Coda Pow"
}
func didLoadSiteNamed(name: String!) {
}
func viewController() -> NSViewController {
return PowPlugInViewController(nibName: "PowPlugInView", plugInBundle: PowBundle, plugInController: PowController)!
}
}
PowPlugInViewController.swift
import Foundation
class PowPlugInViewController: NSViewController, CodaSidebarViewController {
let PowController: CodaPlugInsController
init?(nibName: String, plugInBundle: AnyObject, plugInController: CodaPlugInsController) {
self.PowController = plugInController
super.init(nibName: nibName, bundle: plugInBundle as? NSBundle)
}
// Xcode Says I need this.
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
I have two more source files.
ServerAndHosts.swift and
Shell.swift They don't use any of the classes in CodaPlugInsController.h. The Shell.swift file is just a set of Class functions.
Edit:
I can use swift as long as I don't subclass from the CodaPlugInsController.h or pass in an object that has been.
Swift and Obj-C versions of Project: https://www.dropbox.com/sh/bsw8cinn7kp9kfe/AAAgG_B44dbHNP5-JwJ3Amf8a?dl=0
The project compiles, so the bridging headers may not be the issue.
You fail at the linking stage, the compiler can't find a set of symbols for your current architecture.
This could either mean
1) The Coda library is not compiled for your architecture
or
2) the linker couldn't find the library at all.
I looked at your Obj-C project, and it appears the Coda library is not in the project, so I'm guessing its #2. You'll either want to move the lib into the project somehow, or add a path to the lib elsewhere on your system in your project's "library search paths"
I've noticed that programs where usage of System.Timers.Timer object appears is very CPU consumptive (almost 100percent for single CPU core).
I'm using Ubuntu 11.10, here is my version of mono:
mono -V
Mono JIT compiler version 2.10.5 (Debian 2.10.5-1)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
Here is sample program, which causes unexpected high CPU usage:
using System;
using System.Timers;
namespace MonoCPUTest
{
class Program
{
static Timer _refresh = new Timer();
static void Main(string[] args)
{
_refresh.Interval = 2000;
_refresh.AutoReset = true;
_refresh.Elapsed += (x, y) => refresh();
_refresh.Start();
while (true)
{
Console.WriteLine("loop");
System.Threading.Thread.Sleep(10000);
}
}
static void refresh()
{
Console.WriteLine("refresh");
}
}
}
Thank you very much for any help.
I've just tested (by copy pasting, compiling and executing your code) and cannot reproduce the issue, the CPU load is about 0. I'm using newer version of Mono, specifically the one compiled from the git tree couple days ago; so if there was an issue like that, it was fixed.
I guess upgrading your Mono is not possible without external PPA, but this is what should be done here if you are not forced to use this version for some other reason. You can also compile one from the source, which is as easy, as configure, make, make install ;)