1. 程式人生 > >Ubuntu下編譯AllJoyn原始碼及遇到的問題

Ubuntu下編譯AllJoyn原始碼及遇到的問題

環境:

作業系統 ubuntu-14.04-desktop-i386

到https://allseenalliance.org網站上下載原始碼包 alljoyn-suite-14.06.00_beta-src.tar.gz

copy到/opt下,解壓,更名為/opt/alljoyn-14.06

下載好junit-4.9.jar

$ sudo cp junit-4.9.jar /usr/share/java/

環境變數 

JAVA_HOME=/usr/java/jdk1.7.0_25

CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:/usr/share/java/junit-4.9.jar

PATH=$JAVA_HOME/bin:$PATH

AJ_ROOT=/opt/alljoyn-14.06

下面開始記錄過程

$ cd $AJ_ROOT/core/alljoyn

檢視該目錄結構,初始的內容如下

$ tree -L 1
.
├── alljoyn_c
├── alljoyn_core
├── alljoyn_java
├── alljoyn_js
├── alljoyn_objc
├── alljoyn_unity
├── build_core
├── build.xml
├── common
├── README.md
├── README.txt
├── SConstruct
└── services

由於我不需要JavaScript, Objective-C, Unity的BINDINGS,我可以直接把這3個相關的目錄刪掉,也可以在編譯時指定引數,如

$ scons OS=linux CPU=x86 BINDINGS=c,cpp,java

命令開始執行後,一開始編譯cpp時,進展還比較順利。可當編譯到Java時,輸出內容包括以下幾類資訊

(1)

warning: [path] bad path element "/usr/share/java/junit4.9.jar": no such file or directory
alljoyn_java/test/org/alljoyn/bus/AddressBookTest.java:23: error: package junit.framework does not exist

(2)

alljoyn_java/test/org/alljoyn/bus/MarshalTest.java:1153: warning: [rawtypes] found raw type: TreeMap
        TreeMap<String, String>[] aaess = (TreeMap<String, String>[]) new TreeMap[2];
                                                                          ^
  missing type arguments for generic class TreeMap<K,V>
  where K,V are type-variables:
    K extends Object declared in class TreeMap
    V extends Object declared in class TreeMap

alljoyn_java/test/org/alljoyn/bus/MultipleReturnValuesTest.java:69: warning: [rawtypes] found raw type: HashMap
            HashMap<String,String>[] hm = (HashMap<String,String>[]) new HashMap[2];
                                                                         ^
  missing type arguments for generic class HashMap<K,V>
  where K,V are type-variables:
    K extends Object declared in class HashMap
    V extends Object declared in class HashMap
(3)
(......前面還有若干行類似的)
alljoyn_java/test/org/alljoyn/bus/ifaces/IntrospectableTest.java:54: warning: [rawtypes] found raw type: Class
                                                         new Class[] { Introspectable.class });
                                                             ^
  missing type arguments for generic class Class<T>
  where T is a type-variable:
    T extends Object declared in class Class
alljoyn_java/test/org/alljoyn/bus/ifaces/PeerTest.java:64: warning: [rawtypes] found raw type: Class
                                                         new Class[] { Peer.class });
                                                             ^
  missing type arguments for generic class Class<T>
  where T is a type-variable:
    T extends Object declared in class Class
100 errors
93 warnings
scons: *** [alljoyn_java/test/build/linux/x86/debug/obj/classes/org/alljoyn/bus/AddressBookInterface.class] Error 1
scons: building terminated because of errors.
第(1)類errors很多,都是跟junit相關的。其實我在閱讀官方文件時已經注意到junit的問題了,junit-4.9.jar的包也下好了,也添加了相應的環境變數,可坑爹的是,我設定環境變數時少打了個"-",囧rz。如果你壓根沒下載junit的jar包,或者沒設定junit的環境變數,那麼編譯java的時候肯定是會報這些errors的。

第(2)(3)類warnings,一看就是泛型的問題,忽略之。

更正錯誤,在CLASSPATH環境變數裡面新增/usr/share/java/junit-4.9.jar後

再次輸入編譯命令

$ scons OS=linux CPU=x86 BINDINGS=c,cpp,java

輸出資訊包括

wsbuild(["ws"], ["build_core/$DISTDIR"])
Evaluating whitespace compliance...
Config: /opt/alljoyn-14.06/core/alljoyn/build_core/tools/conf/ajuncrustify.cfg
Note: enter 'scons -h' to see whitespace (WS) options
whitespace.db not found a new one will be created.
It appears that 'uncrustify' is not installed or is not on your PATH. Please check your system and try again.
scons: *** [ws] Explicit exit, status 2
scons: building terminated because of errors.

檢視官方文件可以看到這麼一段:

Whitespace policy checker

By default the whitespace policy checker runs every time. If you continually get build errors associated with the whitespace.py script, it can be shut off using this command:
$ scons WS=off
If the whitespace policy checker reports a whitespace policy violation, it lists which files have the violation. To see the lines of code that are violating the AllJoyn whitespace policy, run:
$ scons WS=detail
Uncrustify can automatically fix your files to adhere to the whitespace policy.
$ scons WS=fix

於是將編譯命令改為

$ scons OS=linux CPU=x86 WS=off BINDINGS=c,cpp,java

終於得到輸出

scons: done building targets.

而且可以看到

[email protected]:/opt/alljoyn-14.06/core/alljoyn/build/linux/x86/debug/dist/java/lib$ ls
liballjoyn_java.so

終於得到想要的liballjoyn_java.so,這是linux下的共享庫,有點類似Windows下的.dll檔案。

用AllJoyn框架編寫的Java程式在需要執行時,會用到liballjoyn_java.so

相關推薦

Ubuntu編譯AllJoyn原始碼遇到的問題

環境: 作業系統 ubuntu-14.04-desktop-i386 到https://allseenalliance.org網站上下載原始碼包 alljoyn-suite-14.06.00_beta-src.tar.gz copy到/opt下,解壓,更名為/opt/all

ubuntu編譯時遇到的錯誤解決方式

1、錯誤展示: [email protected]:~/test/test/protest/stack_test$ gcc  -c my_stack.c -o my_stack.o In file included from /usr/include/stdio.

ubuntu編譯ffmpeg+SDL+ffplay提取motion vector

ubunt cut object device .org 最新 編譯運行 sam draw 編譯ffmpeg: 第一步: 從官網http://ffmpeg.org/下載最新版本. 解壓tar -xjvf ffmpeg-3.3.1.tar.bz2 進入目錄cd ffmpeg

ubuntu編譯小知識點

enabled with ubun set 改變 led 特性 enable The 1 #改變編譯器選項 2 SET(CMAKE_C_COMPILER"g++") 3 #出現如下錯誤:添加C++11特性 4 #error: #error This file requir

Mac編譯JRTPLIB原始碼 For Android

一.工欲善其事必先利其器: 1.官網下載Jthread和Jrtplib 2.通過 "brew install ninja" 命令安裝ninja 二.解壓下載的Jthread與Jrtplib壓縮包並參考GitHub的文件編寫cmake檔案: 1.在Jthread解壓出的目錄下建立toolcha

Ubuntu安裝Qt環境Qt Creator開發工具

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

ubuntu編譯安裝php5.4

1、編譯引數 ./configure  --prefix=/usr/local/php5.4  --enable-fpm  --enable-fastcgi --enable-force-CGI-redirect --with-config-file-path=/u

ubuntu編譯安裝poco debian編譯安裝poco一模一樣。

系統環境:   ubuntu版本:Linux jfcai-VirtualBox 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux poco版本:poco-1.

Ubuntu編譯SqlCipher以及解密微信資料庫EnMicroMsg.db過程和坑

wget https://codeload.github.com/sqlcipher/sqlcipher/zip/v3.4.2 ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=

ubuntugit的安裝使用 2017.12.23

安裝git 檢查阿是否安裝git git version 若沒有安裝,則使用如下的命令 sudo apt-get install git 配置git的資訊 git config --global user.name "Your Name" git confi

ubuntu安裝git安裝使用

一、當前git已經成成為程式碼管理最受歡迎的工具之一,下面簡單說一下其使用。之前寫過一篇關於git關聯github的,可以檢視http://fuzhenwen.top:8000/article/22/preview 。    一般專案開發者,首先得把專案fork到自己的pro

Ubuntu Python pip3安裝問題AttributeError: module 'pip.__main__' has no attribute '_main'

先解除安裝掉原先的pip3 sudo apt-get remove python3-pip 再重新安裝 sudo apt-get install python3-pip 測試:輸入 pip3 -V之後出現問題 Traceback (most recent c

android開發-Windows環境編譯FFMPEG原始碼

1.簡介 之前有兩篇文章講到如何在windowsPC端使用FFMPEG命令列程式。 但是我想要在android開發時使用FFMPEG的功能又該怎麼辦?所以就需要編譯FFMPEG,然後才能使用。這才有了這篇文章。 1.先講思路,2.後講具體流程! 但是首先有個問題就是我

ubuntu編譯安裝opencv3

更新 apt-get(在安裝前最好先更新一下系統,不然可能會安裝失敗。) sudo apt-get update sudo apt-get upgrade   安裝依賴 (太多了,自己相應替換) sudo apt -y install libopencv-dev build-

Ubuntu更換阿里源通過yum安裝mysql

首先檢視自己的ubuntu系統的codename,直接導致你更新的源是否對你的系統起效果,檢視方法: lsb_release -a   我的系統顯示:Codename: bionic 確認阿里源支援  登陸以下網頁:http://mirr

windows編譯tensorflow原始碼 用其c++介面呼叫訓練好的模型

最近在研究如何用tensorflow的python庫訓練模型,生成pb檔案,再在c++中呼叫這個模型,完成前向的預測;所以就要使用其c++介面,這需要從原始碼編譯tensorflow。 根據官網給出的編譯器對應關係(詳見我的另一篇部落格),最新版(1.12版)的tensor

《Swift入門》ubuntu編譯執行Swift開發的Web後端示例

這裡只是演示如何在ubuntu下編譯執行Swift開發的Web後端專案。專案程式碼來自Bluemix上提供的示例程式碼,如果你有賬號,可以去自己的空間下載,沒有的話,可以通過下面的地址下載:http://download.csdn.net/detail/testcs_dn/9

linux編譯lua原始碼

步驟: 1.下載lua包 wget -c http://www.lua.org/ftp/lua-5.3.4.tar.gz 2.解壓lua包 tar zxvf lua-5.3.4.tar.g

ubuntu查詢安裝包安裝路徑

dpkg --list | grep mysql 列出所有的mysql安裝包,如下: dpkg -L libmysqlclient-dev,查詢libmysqlclient-dev的所有安裝檔案,如下: 

64位ubuntu編譯32位彙編程式(同時連結C庫)

cmd.s如下://.include "linux.s" .section .data output1: .ascii "There are %d parameters:\n\0" //output2: // .ascii "%s/0" .section .text