I am trying to build a GNUStep program on OpenBSD. I installed packages gnustep-base and gnustep-make.
my main.m:
#import <Foundation/Foundation.h>
int main(void)
{
NSLog(#"Hello World!");
return 0;
}
GNUmakefile:
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = main
main_OBJC_FILES = main.m
include $(GNUSTEP_MAKEFILES)/tool.make
Then, I initialize the GNUstep environment using
. /usr/local/share/GNUstep/Makefiles/GNUstep.sh
And then I run:
make
This does not recognize the GNUmakefile.
Does anybody know how I can build a GNUstep program on OpenBSD?
On my Arch Linux installation, similar procedure works fine.
Try make -f GNUmakefile. If this command fails, install gmake and try gmake -f GNUmakefile.
Related
Unable to build the library using cargo lipo --release
I am trying to make a cross-platform library using rust for ios target. I am following this article (Building and Deploying a Rust library on iOS).
*Note: I followed the same steps and my project structure also looks the same *
After completing the code and project setup the last step is to build the library. When I try to build the library using cargo lipo --release. It throws this error:
[ERROR cargo_lipo] No library target found for "my-project-name"
Also, note that I am only able to install support for two platforms. (aarch64-apple-ios and x86_64-apple-darwin). I think the reason is that they have dropped the support for 32-bit architectures.
So, when I run
rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios.
It throws error: error: component 'rust-std' for target 'armv7-apple-ios' is unavailable for download for channel stable
Cargo.toml
[package]
name = "rustylib"
version = "0.1.0"
edition = "2018"
crate-type = ["staticlib", "cdylib"]
rustylib.rs
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
char *hello(const char *to);
void hello_release(char *s);
The rest of the project structure is the usual rust code.
The output of rustup show
Default host: x86_64-apple-darwin
rustup home: /Users/my-username/.rustup
installed toolchains
stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin (default)
installed targets for active toolchain
aarch64-apple-ios
x86_64-apple-darwin
active toolchain
nightly-x86_64-apple-darwin (default)
rustc 1.52.0-nightly (acca81892 2021-03-13)
OS & Rust
Rust: rustc 1.50.0 (cb75ad5db 2021-02-10)
OS: macOS Bug Sur (11.2.3)
Xcode & Command line tools: 12.4
Your Cargo.toml is wrong.
If you look into the guide you linked in your question, you can see, that the crate-type has to be below the [lib] tag like so:
[package]
name = "greetings"
version = "0.1.1"
authors = ["fluffyemily <fluffyemily#mozilla.com>"]
description = "Example static library project built for iOS"
publish = false
[lib]
name = "greetings"
crate-type = ["staticlib", "cdylib"]
Also your code has to be in cargo/src/lib.rs by default as stated in the document (and not in rustylib.rs).
You can run cargo new rustylib --lib from the command line to create all the boilerplate, so that you only have to add the dependencies and the crate-type in the [lib] section of your Cargo.toml.
Edit
I think there is another problem:
You have entered C code in your rustylib.rs file, which can not work. I think what you intended to do, was to create the C bridge, which is called cargo/src/greetings.h in the guide you linked.
I downloaded the source of LuaJIT and compiled it with msvc120.dll (VS 2013 x64). When I run it from the command line I have no problems executing some basic lua. Now the LuaJIT installation guide mentions moving luajit.exe and lua51.dll into their own folder. From there it says to create a lua folder and under that a jit folder with the contents of src/jit moved underneath the newly created jit folder.
From my understanding my folder should look like and contain:
luajit.exe
lua51.dll
/lua
/jit
bc.lua
[rest of jit files]
vmdef.lua
Is this correct or am I missing files?
Now after I built my luajit I tried to wire it up into my luarocks to act as my interpreter using
install.bat /LUA C:\LuaJIT\2.0.3\[folder with above content]
However this cannot find the header files. I then copied over what are the header files into the folder above and that wires it up, but I can never actually get anything to compile when pointed over to LuaJIT. Edit: The error I get is the following,
C:\LuaJIT\2.0.3\bin\lua51.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2D0
Error: Failed installing dependency: https://rocks.moonscript.org/luafilesystem-1.6.2-2.src.rock - Build error: Failed compiling module lfs.dll
Is the correct way to handle this to simply point to my lua binaries and from there leverage LuaJIT to run my files or am I doing something wrong with wiring up LuaJIT and luarocks? The former seems to work for the most part, since I only ran into one library compilation issue, lua-cjson.
I've run on exactly the same problem, but they've found a solution right here:
https://github.com/keplerproject/luafilesystem/issues/22
I knew that for "linking DLLs statically" there is a so-called "export" .lib file, which is passed to the linker (and not the DLL itself).
So, for example, when compiling, LuaRocks was doing this:
cl /nologo /MD /O2 -c -Fosrc/mime.obj -ID:/LuaJIT-2.0.4/include/ src/mime.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DNDEBUG -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) mime.c
link -dll -def:core.def -out:mime/core.dll D:/LuaJIT-2.0.4/bin/lua51.dll src/mime.obj
My LuaJIT was compiled from source in D:\LuaJIT-2.0.4\src, but I made two folders myself: D:\LuaJIT-2.0.4\include with all *.h files copied from src and D:\LuaJIT-2.0.4\bin with luajit.exe, lua51.dll, and then later lua51.exp and lua51.lib. Still same error, but this was the right track.
Fix
Now, check where your LuaRocks configs are:
luarocks.bat help
Scroll down to a section like:
CONFIGURATION
Lua version: 5.1
Configuration files:
System: D:/luarocks/config-5.1.lua (ok)
User : (... snip ...)
Edit the System configuration file, specifically see the part:
variables = {
MSVCRT = 'VCRUNTIME140',
LUALIB = 'lua51.dll'
}
Here! LUALIB should be the .lib file. If your export lib is alongside the DLL, you just need to change to:
variables = {
MSVCRT = 'VCRUNTIME140',
LUALIB = 'lua51.lib' -- here!
}
Verification
And now:
luarocks.bat install luasocket
(...)
link -dll -def:core.def -out:socket/core.dll D:/LuaJIT-2.0.4/bin/lua51.lib src/luasocket.obj (...)
(...)
luasocket 3.0rc1-2 is now built and installed in D:\luarocks\systree (license: MIT)
Note the first argument passed to the linker.
Below is my simple test code.
I have compile it using
$gcc test.c -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -locilib
It compile successfully but when i run it it show error-
./a.out: error while loading shared libraries: libocilib.so.3: cannot open shared object file: No such file or directory
I have added below path to my bashrc file -
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib
export ORACLE_HOME=/usr/lib/oracle/11.2/client
export TNS_ADMIN=/usr/lib/oracle/11.2/client/network/admin
#include "ocilib.h"
int main(void)
{
OCI_Connection *cn;
if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT))
return EXIT_FAILURE;
cn = OCI_ConnectionCreate("sam", "SYSTEM", "oracle", OCI_SESSION_DEFAULT);
printf("Server major version : %i\n", OCI_GetServerMajorVersion(cn));
printf("Server minor version : %i\n", OCI_GetServerMinorVersion(cn));
printf("Server revision version : %i\n\n", OCI_GetServerRevisionVersion(cn));
printf("Connection version : %i\n\n", OCI_GetVersionConnection(cn));
OCI_Cleanup();
return EXIT_SUCCESS;
}
i don't know what's the reason. please help. I know little bit about linux.
The OCILIB shared library folder is not in your LD_LIBRARY_PATH variable....
Can also work by typing when compiling: "-static":
gcc -static test.c -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -locilib
and run the program normally:
./a.out
I am trying to get a screen shot using the following code;
#include <stdio.h>
#include </wand/MagickWand.h>
int main(int argc, char **argv)
{
MagickWandGenesis();
MagickWand *wand = NULL;
wand = NewMagickWand();
MagickReadImage(wand,"x:root"); // <-- Invoke ImportImageCommand
MagickWriteImage(wand,"screen_shot.png");
if(wand)wand = DestroyMagickWand(wand);
MagickWandTerminus();
return 0;
}
however I am getting the following error message, magick-config.h is in the specified folder 'magick/magick-config.h' , I do not understand what the problem is;
$ make screenshot
cc screenshot.c -o screenshot
In file included from /wand/MagickWand.h:29:0,
from screenshot.c:2:
/magick/magick-config.h:29:3: warning: #warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default"
/magick/magick-config.h:30:3: warning: #warning "this is an obsolete behavior please fix your makefile"
/magick/magick-config.h:52:3: warning: #warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default"
/magick/magick-config.h:53:3: warning: #warning "this is an obsolete behavior please fix yours makefile"
In file included from /wand/MagickWand.h:70:0,
from screenshot.c:2:
/magick/MagickCore.h:29:36: fatal error: magick/magick-config.h: No such file or directory
compilation terminated.
<builtin>: recipe for target `screenshot' failed
make: *** [screenshot] Error 1
Any help would be much appreciated.
Thanks
Yes, Actually I had a problem like that and it was fixed when I installed the package libmagickcore-dev with following command:
sudo apt-get install libmagickcore-dev
through the Ubuntu Repositories. :-)
Also If it did not work, you try installing the package called "graphicsmagick-libmagick-dev-compat".
AC;
You might have installed too much?
Try to remove Image-magick-"Perl Module"
The Perl Module.
And then again try the process to install ImageMagick with PECL or your other way.
Often this problem is occurring because of installation made with make install on a platform.
Remove all other installations and just do the installation from pure sources if you already started doing that.
.deb and .rpm packages might be installed in different ways than making from source.
I'm working on running a Hello World program on the Linksys WRT54G-V4 running either dd-wrt or OpenWRT.
Right now this router is running dd-wrt for reasons I'll explain below. I'd like to switch this router to OpenWRT, because I've not been able to build dd-wrt or its toolchain. I 'assume' that the OpenWRT toolchain should produce executable binaries that will run on dd-wrt also.
OpenWRT was pretty straightforward to build, since it has a nice menu driven make system. Using this handy tool I built a toolchain that will cross compile from my x86 Ubuntu box to a MIPS target.
Following the instructions I've been able to build OpenWRT and produce images for brcm47xx and brcm63xx.
For example, here is a successful compile of my little Hello World program:
jim#ubuntu:~/Desktop/tests$ cat helloC.c
#include <stdio.h>
int main (int argc, char **argv)
{
printf("Hello World\n");
return 0;
}
jim#ubuntu:~/Desktop/tests$
jim#ubuntu:~/Desktop/tests$ mipsel-openwrt-linux-gcc -o HelloWorld helloC.c
jim#ubuntu:~/Desktop/tests$
jim#ubuntu:~/Desktop/tests$ file HelloWorld
HelloWorld: ELF 32-bit LSB executable, MIPS, MIPS32 version 1, dynamically linked (uses shared libs), with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x3040000, not stripped
jim#ubuntu:~/Desktop/tests$
Sadly, when I try to run HelloWorld on my WRT54G-V4 running dd-wrt I get a seg fault.
Looking at Wikipedia, I see that this router uses the Broadcom BCM5352.
When I run make menuconfig in by OpenWRT/trunk directory I don't see an option for the BCM5352, which is why I'm reluctant to flash my router with one of the images I've created in the brcm47xx or brcm63xx directories. I don't want to guess wrong and brick the router.
Question 1 - Which Broadcom configuration should I select using make menuconfig to target my WRT54G-V4 with its BCM5352 chipset?
Question 2 - Should my 'HelloWorld' executable file I generated above run directly from the command line on the 54G, or must I make it a package per http://www.gargoyle-router.com/wiki/doku.php?id=openwrt_coding ?
TIA
You can follow the official howto (from: http://www.dd-wrt.com/forum/viewtopic.php?p=21499&sid=de90601a8d51747d1c8ccec29284127d)
1. The helloworld.c source
Code:
#include <stdio.h>
int main ( void ) {
printf( "Hello world!\n" );
}
2. Get and unpack the toolchain in your homedir
Code:
cd ~
wget ftp://ftp.dd-wrt.com/sourcecode/toolchains.x86.debian.sp1.tar.bz2
tar -jxf toolchains.x86.debian.sp1.tar.bz2
3. Add the path to your cross-compiler executable to your path environment variable and compile helloworld.c
Code:
PATH=~/toolchains/4.1.0-uclibc-0.9.28/bin:$PATH mipsel-linux-uclibc-gcc helloworld.c -o helloworld
4. Check if its correctly compiled with the cross-compiler
Code:
file helloworld
helloworld: ELF 32-bit LSB executable, MIPS, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
5. Finally, transfer the helloworld binary file to your router, set the executable bit and run it.
Tested with Ubuntu 6.06.1 LTS.